dphelper 0.0.8 → 0.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dphelper",
3
- "version": "0.0.8",
3
+ "version": "0.1.2",
4
4
  "description": "Many utils for your projects",
5
5
  "main": "index.js",
6
6
  "scripts": {
File without changes
@@ -23,7 +23,7 @@ dphelper.anchorToOnClick = function(){
23
23
  Loader( 'body' , null );
24
24
  })
25
25
  .css('cursor','pointer')
26
- .addClass( wng.pathRail()[3].replace(/\//g, '') )
26
+ .addClass( dphelper.pathRail()[3].replace(/\//g, '') )
27
27
  .removeAttr( 'href' )
28
28
  .on( 'click', function(){
29
29
  window.location.href = href;
@@ -14,7 +14,7 @@ dphelper.arrayItemFinder = (id, array) => {
14
14
  if (node.id === id) return node;
15
15
 
16
16
  if (node.children) {
17
- let finalNode = wng.arrayFindItem(id, node.children);
17
+ let finalNode = dphelper.arrayFindItem(id, node.children);
18
18
  if (finalNode) return finalNode;
19
19
  }
20
20
  }
@@ -12,7 +12,7 @@
12
12
  dphelper.arrayMerge = (target, source) => {
13
13
 
14
14
  for (const key of Object.keys(source)) {
15
- if (source[key] instanceof Object && target[key]) Object.assign(source[key], wng.mergeArrays(target[key], source[key]));
15
+ if (source[key] instanceof Object && target[key]) Object.assign(source[key], dphelper.mergeArrays(target[key], source[key]));
16
16
  }
17
17
 
18
18
  Object.assign(target || {}, source);
@@ -11,31 +11,33 @@
11
11
 
12
12
  dphelper.disableSelect = function( e ){
13
13
 
14
- const $ = require("jquery");
14
+ const disabling = ( e ) => {
15
+
16
+ const $ = require("jquery");
15
17
 
16
- $( 'body' ).each( function(){
18
+ $( 'body' ).each( function(){
17
19
 
18
- $( this )
19
- .prop( "unselectable" , "on" )
20
- .css( "MozUserSelect" , "none" )
21
- .css( "WebKitUserSelect" , "none" )
22
- .on( "select" , function(){ return false; })
23
- .on( "selectstart" , function(){ return false; });
20
+ $( this )
21
+ .prop( "unselectable" , "on" )
22
+ .css( "MozUserSelect" , "none" )
23
+ .css( "WebKitUserSelect" , "none" )
24
+ .on( "select" , function(){ return false; })
25
+ .on( "selectstart" , function(){ return false; });
24
26
 
25
- //this.onselectstart = function() { return false }
26
- //this.oncontextmenu = function() { return false }
27
+ //this.onselectstart = function() { return false }
28
+ //this.oncontextmenu = function() { return false }
27
29
 
28
- $( 'img, a, input, button' ).on( 'dragstart' , function( e ) {
29
- e.preventDefault();
30
- return false;
31
- });
32
-
33
- });
30
+ $( 'img, a, input, button' ).on( 'dragstart' , function( e ) {
31
+ e.preventDefault();
32
+ return false;
33
+ });
34
34
 
35
- };
35
+ });
36
+
37
+ };
38
+
39
+ document.body.addEventListener('mousedown',function( e ){ disabling( e ); }, false );
40
+ document.body.onmousedown = function( e ){ disabling( e ); };
41
+ console.debug("%cSelection Disabled:%c true", "color:gray", "");
36
42
 
37
- if( wng.selectionDisabled === true ){
38
- document.body.addEventListener('mousedown',function( e ){ DisableSelect(); }, false );
39
- document.body.onmousedown = function( e ){ DisableSelect( e ); };
40
- console.debug("%cSelection Disabled:%c " + wng.selectionDisabled, "color:gray", "");
41
- }
43
+ };
@@ -11,6 +11,6 @@
11
11
 
12
12
  dphelper.printInfo = () => {
13
13
  console.groupCollapsed('%cApi:%c', "color:orange", "");
14
- console.debug(wng.api);
14
+ console.debug(dphelper.api);
15
15
  console.groupEnd();
16
16
  };
@@ -10,5 +10,5 @@
10
10
  /***********************************************************************/
11
11
 
12
12
  dphelper.rnd = () => {
13
- return Math.floor(100000 + Math.random() * wng.tmr());
13
+ return Math.floor(100000 + Math.random() * dphelper.tmr());
14
14
  };
@@ -10,5 +10,5 @@
10
10
  /***********************************************************************/
11
11
 
12
12
  dphelper.tmr = () => {
13
- return Math.round(wng.epoch() / 1000);
13
+ return Math.round(dphelper.epoch() / 1000);
14
14
  };
@@ -19,7 +19,7 @@ dphelper.objSerialize = (value) => {
19
19
  let serializeObject = {};
20
20
  for (const [objectKey, objectValue] of Object.entries(value)) {
21
21
  console.info( `objectKey=${objectKey} value=${objectValue}` );
22
- serializeObject[objectKey] = wng.objSerialize(objectValue);
22
+ serializeObject[objectKey] = dphelper.objSerialize(objectValue);
23
23
  }
24
24
  return serializeObject;
25
25
  }
@@ -38,7 +38,7 @@ dphelper.objDeSerialize = (valueNew) => {
38
38
  let deserializeObject = {};
39
39
  for (const [objectKey, objectValue] of Object.entries(valueNew)) {
40
40
  console.info( `objectKey=${objectKey} value=${objectValue}` );
41
- deserializeObject[objectKey] = wng.objDeSerialize(objectValue);
41
+ deserializeObject[objectKey] = dphelper.objDeSerialize(objectValue);
42
42
  }
43
43
  return deserializeObject;
44
44
  }
@@ -11,19 +11,19 @@
11
11
 
12
12
  dphelper.supportsVml = function () {
13
13
 
14
- if ( typeof supportsVml.supported == "undefined" ) {
14
+ if ( typeof dphelper.supportsVml.supported == "undefined" ) {
15
15
 
16
16
  let a = document.body.appendChild( document.createElement( 'div' ) );
17
17
  a.innerHTML = '<v:shape id="vml_flag1" adj="1" />';
18
18
 
19
19
  let b = a.firstChild;
20
20
  b.style.behavior = "url(#default#VML)";
21
- supportsVml.supported = b ? typeof b.adj == "object" : true;
21
+ dphelper.supportsVml.supported = b ? typeof b.adj == "object" : true;
22
22
  a.parentNode.removeChild( a );
23
23
 
24
24
  }
25
25
 
26
- return supportsVml.supported;
26
+ return dphelper.supportsVml.supported;
27
27
 
28
28
  };
29
29
 
@@ -314,7 +314,7 @@ dphelper.handleSvgToggle = function( evt , container , source1 , source2 ) {
314
314
 
315
315
  if( $( evt.target ).prop( 'checked' ) && $( source1 ).length && $( source2 ).length ) {
316
316
 
317
- wng.storeCookie.set( $( evt.target ).attr( 'id' ), 1, 365 );
317
+ dphelper.storeCookie.set( $( evt.target ).attr( 'id' ), 1, 365 );
318
318
 
319
319
  initConnection( container[0], [ $( source1 )[0], 'right' ], [ $( source2 )[0], 'left' ], function( source1 , source2 ) {
320
320
 
@@ -329,7 +329,7 @@ dphelper.handleSvgToggle = function( evt , container , source1 , source2 ) {
329
329
 
330
330
  dphelper.removeConnection( container );
331
331
  $( '#parts-left-body' ).unbind( 'scroll' );
332
- wng.storeCookie.set( $( evt.target ).attr( 'id' ), 0, 365 );
332
+ dphelper.storeCookie.set( $( evt.target ).attr( 'id' ), 0, 365 );
333
333
 
334
334
  }
335
335