dphelper 0.2.26 → 0.2.27

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.
File without changes
package/data/list.json CHANGED
@@ -1,18 +1,26 @@
1
- [
2
- {
3
- "name" : "Anchors to onClick",
4
- "description" : "Transform all anchor inside specific elements in to onClick (DOM)\r\n<br/>\r\n<br/>\r\n\r\nUsage: <br/>\r\n<br/>\r\n\r\n<code>\r\ndphelper.anchorToOnClick( \"your element(s)\" )\r\n</code>\r\n\r\n<br/>\r\n<br/>\r\nAutomatically all anchors became onClick. Use it at end off page or defer or after DOMs loaded \r\n\r\n",
5
- "version" : "0.0.1",
6
- "command" : "<command>\r\ndphelper.anchorToOnClick\r\n</command>",
7
- "author" : "Dario Passariello",
8
- "active" : true
1
+ {
2
+ "info" : {
3
+ "title" : "List",
4
+ "description" : "Complete list of tools"
9
5
  },
10
- {
11
- "name" : "Arrays Tools",
12
- "description" : "Transform all anchor inside specific elements in to onClick (DOM)\r\n<br/>\r\n<br/>\r\n\r\nUsage: <br/>\r\n<br/>\r\n\r\n<code>\r\ndphelper.array.set( \"your element(s)\" )\r\n</code>\r\n\r\n<br/>\r\n<br/>\r\nAutomatically all anchors became onClick. Use it at end off page or defer or after DOMs loaded \r\n\r\n",
13
- "version" : "0.0.1",
14
- "command" : "<command>\r\ndphelper.array \r\n</command>",
15
- "author" : "Dario Passariello",
16
- "active" : true
17
- }
18
- ]
6
+ "scripts" : [
7
+ {
8
+ "name" : "Anchors to onClick",
9
+ "description" : "Transform all anchor inside specific elements in to onClick (DOM)\r\n<br/>\r\n<br/>\r\n\r\nUsage: <br/>\r\n<br/>\r\n\r\n<code>\r\ndphelper.anchorToOnClick( \"your element(s)\" )\r\n</code>\r\n\r\n<br/>\r\n<br/>\r\nAutomatically all anchors became onClick. Use it at end off page or defer or after DOMs loaded \r\n\r\n",
10
+ "version" : "0.0.1",
11
+ "command" : "anchorToOnClick",
12
+ "example" : "dphelper.anchorToOnClick(\"nav\") --> now all nav anchor are onClick ( href is removed )",
13
+ "author" : "Dario Passariello",
14
+ "active" : true
15
+ },
16
+ {
17
+ "name" : "Arrays Tools",
18
+ "description" : "Useful way to andle array without efforts\r\n<br/>\r\n\r\n\r\n",
19
+ "version" : "0.0.1",
20
+ "command" : "array",
21
+ "example" : "// FIND\r\ndphelper.array.find( 12345 , YourArray ) --> search your data\r\n\r\n// UNIQUE\r\ndphelper.array.unique( YourArray ) --> remove duplicates\r\n\r\n// DELETE\r\ndphelper.array.delete( 12345 , YourArray ) --> remove a sub-data using id\r\n\r\n// MERGE\r\ndphelper.array.merge( YourArray1 , YourArray2 ) --> result is YourArray3 ",
22
+ "author" : "Dario Passariello",
23
+ "active" : true
24
+ }
25
+ ]
26
+ }
package/init.js CHANGED
@@ -19,6 +19,7 @@
19
19
  const dphelper = window.dphelper = {};
20
20
 
21
21
  window.dphelper.list = require('./data/list.json');
22
+ window.dphelper.list.version = pjson.version;
22
23
 
23
24
  // FIRST MESSAGE
24
25
  console.groupCollapsed( `%c${pjson.name} v${pjson.version}%c`,"color:orange","" );
@@ -36,6 +37,9 @@
36
37
 
37
38
  const $ = require("jquery");
38
39
 
40
+ // SYSTEM
41
+ require('./scripts/addListenerMulti.js');
42
+
39
43
  // 3party
40
44
  require('./3party/shortcut.js');
41
45
 
@@ -94,6 +98,7 @@
94
98
  require('./scripts/scrollCustom.js');
95
99
 
96
100
  // OTHER
101
+ require('./scripts/fontFit.js');
97
102
  require('./scripts/uuid.js');
98
103
  require('./scripts/noCache.js');
99
104
  require('./scripts/parseBool.js');
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dphelper",
3
- "version": "0.2.26",
3
+ "version": "0.2.27",
4
4
  "description": "Many utils for your projects",
5
5
  "main": "index.js",
6
6
  "publishConfig": {},
@@ -27,6 +27,16 @@
27
27
  "url": "https://github.com/passariello/dpHelper",
28
28
  "help": "https://github.com/passariello/dpHelper#readme"
29
29
  },
30
+ "funding": [
31
+ {
32
+ "type" : "individual",
33
+ "url" : "https://www.paypal.com/donate/?business=HC7LJ2ZXRRNDL&no_recurring=0&item_name=I+am+a+software+developer.+Just+a+donation+can+help+me+to+have+more+time+to+dedicate+on+this+project&currency_code=CAD"
34
+ },
35
+ {
36
+ "type" : "patreon",
37
+ "url" : "https://www.patreon.com/passariello"
38
+ }
39
+ ],
30
40
  "eslintConfig": {
31
41
  "globals": {
32
42
  "window": true
@@ -0,0 +1,10 @@
1
+
2
+ window.dphelper.addListenerMulti = ( element, eventNames, listener ) => {
3
+
4
+ var events = eventNames.split(' ');
5
+
6
+ for (var i=0, iLen=events.length; i < iLen; ++i ) {
7
+ element.addEventListener( events[i], listener, false );
8
+ }
9
+
10
+ };
@@ -9,13 +9,16 @@
9
9
 
10
10
  /***********************************************************************/
11
11
 
12
- window.dphelper.disableSelect = function( e ){
12
+ window.dphelper.disableSelect = function( el = 'body' ){
13
+
14
+ var $ = require( "jquery" );
15
+ var e = e || event;
13
16
 
14
- const disabling = ( e ) => {
17
+ const disabling = ( el ) => {
15
18
 
16
- const $ = require("jquery");
19
+ const $ = require( "jquery" );
17
20
 
18
- $( 'body' ).each( function(){
21
+ $( el ).each( function( e ){
19
22
 
20
23
  $( this )
21
24
  .prop( "unselectable" , "on" )
@@ -36,8 +39,8 @@
36
39
 
37
40
  };
38
41
 
39
- document.body.addEventListener('mousedown',function( e ){ disabling( e ); }, false );
40
- document.body.onmousedown = function( e ){ disabling( e ); };
42
+ document.querySelector( el ).addEventListener( 'mousedown' , function( e ){ disabling( el ); }, false );
43
+ document.querySelector( el ).onmousedown = function( e ){ disabling( el ); };
41
44
  console.debug("%cSelection Disabled:%c true", "color:gray", "");
42
45
 
43
46
  };
@@ -0,0 +1,24 @@
1
+
2
+
3
+ function fontFitStart(){
4
+
5
+ var divs = document.querySelectorAll( name );
6
+ if( divs.length <= 0 ) return;
7
+
8
+ for(var i = 0; i < divs.length; i++) {
9
+ var fontSize = divs[i].offsetWidth * 0.05;
10
+ divs[i].style.fontSize = fontSize+'px';
11
+ }
12
+ }
13
+
14
+ window.dphelper.fontFit = ( name ) => {
15
+
16
+ if( !name ) return;
17
+ window.dphelper.addListenerMulti( window , 'load resize', () => {
18
+ fontFitStart( name );
19
+ });
20
+
21
+ };
22
+
23
+
24
+