dphelper 0.2.23 → 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.
- package/{cmd.exe.lnk → #cmd.exe.lnk} +0 -0
- package/.jshintrc +13 -13
- package/data/list.json +26 -0
- package/init.js +8 -1
- package/package.json +13 -15
- package/scripts/addListenerMulti.js +10 -0
- package/scripts/anchorToOnClick.js +11 -12
- package/scripts/disableSelect.js +9 -6
- package/scripts/fontFit.js +24 -0
- package/scripts/storage.js +3 -0
|
File without changes
|
package/.jshintrc
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
{
|
|
2
|
-
"esversion":
|
|
3
|
-
"asi": false,
|
|
4
|
-
"esnext": false,
|
|
5
|
-
"moz": true,
|
|
6
|
-
"boss": true,
|
|
7
|
-
"node": true,
|
|
8
|
-
"validthis": true,
|
|
9
|
-
"globals": {
|
|
10
|
-
"EventEmitter": true,
|
|
11
|
-
"Promise": true
|
|
12
|
-
}
|
|
13
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"esversion": 11,
|
|
3
|
+
"asi": false,
|
|
4
|
+
"esnext": false,
|
|
5
|
+
"moz": true,
|
|
6
|
+
"boss": true,
|
|
7
|
+
"node": true,
|
|
8
|
+
"validthis": true,
|
|
9
|
+
"globals": {
|
|
10
|
+
"EventEmitter": true,
|
|
11
|
+
"Promise": true
|
|
12
|
+
}
|
|
13
|
+
}
|
package/data/list.json
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
{
|
|
2
|
+
"info" : {
|
|
3
|
+
"title" : "List",
|
|
4
|
+
"description" : "Complete list of tools"
|
|
5
|
+
},
|
|
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
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
|
|
8
8
|
/***********************************************************************/
|
|
9
9
|
|
|
10
|
-
(() => {
|
|
10
|
+
( () => {
|
|
11
11
|
|
|
12
12
|
if (typeof window === 'undefined') {
|
|
13
13
|
global.window = {};
|
|
@@ -18,6 +18,9 @@
|
|
|
18
18
|
// CREATE ROOT STORE
|
|
19
19
|
const dphelper = window.dphelper = {};
|
|
20
20
|
|
|
21
|
+
window.dphelper.list = require('./data/list.json');
|
|
22
|
+
window.dphelper.list.version = pjson.version;
|
|
23
|
+
|
|
21
24
|
// FIRST MESSAGE
|
|
22
25
|
console.groupCollapsed( `%c${pjson.name} v${pjson.version}%c`,"color:orange","" );
|
|
23
26
|
console.debug( `%c${pjson.name} v${pjson.version}%c by Dario Passariello started`,"color:orange","" );
|
|
@@ -34,6 +37,9 @@
|
|
|
34
37
|
|
|
35
38
|
const $ = require("jquery");
|
|
36
39
|
|
|
40
|
+
// SYSTEM
|
|
41
|
+
require('./scripts/addListenerMulti.js');
|
|
42
|
+
|
|
37
43
|
// 3party
|
|
38
44
|
require('./3party/shortcut.js');
|
|
39
45
|
|
|
@@ -92,6 +98,7 @@
|
|
|
92
98
|
require('./scripts/scrollCustom.js');
|
|
93
99
|
|
|
94
100
|
// OTHER
|
|
101
|
+
require('./scripts/fontFit.js');
|
|
95
102
|
require('./scripts/uuid.js');
|
|
96
103
|
require('./scripts/noCache.js');
|
|
97
104
|
require('./scripts/parseBool.js');
|
package/package.json
CHANGED
|
@@ -1,16 +1,14 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dphelper",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.27",
|
|
4
4
|
"description": "Many utils for your projects",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"publishConfig": {},
|
|
7
|
-
|
|
8
7
|
"scripts": {
|
|
9
8
|
"test1": "echo \"Error: no test specified\" && exit 1",
|
|
10
9
|
"test": "jest --silent --detectOpenHandles",
|
|
11
10
|
"test-coverage": "jest --coverage --silent"
|
|
12
11
|
},
|
|
13
|
-
|
|
14
12
|
"targets": {
|
|
15
13
|
"main": {
|
|
16
14
|
"includeNodeModules": {
|
|
@@ -21,29 +19,33 @@
|
|
|
21
19
|
}
|
|
22
20
|
},
|
|
23
21
|
"deprecated": false,
|
|
24
|
-
|
|
25
22
|
"engines": {
|
|
26
23
|
"node": ">=0.10.0"
|
|
27
24
|
},
|
|
28
|
-
|
|
29
25
|
"repository": {
|
|
30
26
|
"type": "git",
|
|
31
27
|
"url": "https://github.com/passariello/dpHelper",
|
|
32
28
|
"help": "https://github.com/passariello/dpHelper#readme"
|
|
33
29
|
},
|
|
34
|
-
|
|
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¤cy_code=CAD"
|
|
34
|
+
},
|
|
35
|
+
{
|
|
36
|
+
"type" : "patreon",
|
|
37
|
+
"url" : "https://www.patreon.com/passariello"
|
|
38
|
+
}
|
|
39
|
+
],
|
|
35
40
|
"eslintConfig": {
|
|
36
41
|
"globals": {
|
|
37
42
|
"window": true
|
|
38
43
|
}
|
|
39
44
|
},
|
|
40
|
-
|
|
41
45
|
"bugs": {
|
|
42
46
|
"url": "https://github.com/passariello/dpHelper/issues"
|
|
43
47
|
},
|
|
44
|
-
|
|
45
48
|
"homepage": "https://github.com/passariello/dpHelper",
|
|
46
|
-
|
|
47
49
|
"keywords": [
|
|
48
50
|
"utils",
|
|
49
51
|
"tools",
|
|
@@ -56,21 +58,18 @@
|
|
|
56
58
|
"powerful",
|
|
57
59
|
"passariello"
|
|
58
60
|
],
|
|
59
|
-
|
|
60
61
|
"author": {
|
|
61
62
|
"name": "Dario Passariello",
|
|
62
63
|
"website": "https://dario.passariello.ca",
|
|
63
64
|
"email": "dariopassariello@gmail.com"
|
|
64
65
|
},
|
|
65
|
-
|
|
66
66
|
"license": "Apache-2.0",
|
|
67
|
-
|
|
68
67
|
"dependencies": {
|
|
69
68
|
"jquery": "^3.6.0",
|
|
70
69
|
"jshint": "^2.13.1",
|
|
71
|
-
"require": "^0.4.4"
|
|
70
|
+
"require": "^0.4.4",
|
|
71
|
+
"uglify-js": "^3.14.5"
|
|
72
72
|
},
|
|
73
|
-
|
|
74
73
|
"contributors": [
|
|
75
74
|
{
|
|
76
75
|
"name": "Dario Passariello",
|
|
@@ -81,5 +80,4 @@
|
|
|
81
80
|
"email": "valeriacalascaglitta@gmail.com"
|
|
82
81
|
}
|
|
83
82
|
]
|
|
84
|
-
|
|
85
83
|
}
|
|
@@ -10,26 +10,25 @@
|
|
|
10
10
|
/***********************************************************************/
|
|
11
11
|
|
|
12
12
|
window.dphelper.anchorToOnClick = function( container ){
|
|
13
|
-
// const $ = require("jquery");
|
|
14
13
|
|
|
15
14
|
$( container + ' a' ).each( function( index ) {
|
|
16
15
|
|
|
17
|
-
|
|
18
|
-
|
|
16
|
+
let elem = $( this );
|
|
17
|
+
let href = elem.attr( 'href' );
|
|
19
18
|
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
19
|
+
if( href ){
|
|
20
|
+
elem
|
|
21
|
+
.on( 'mouseup', function(){
|
|
22
|
+
Loader( 'body' , null );
|
|
23
|
+
})
|
|
24
|
+
.css('cursor','pointer')
|
|
25
|
+
.addClass( dphelper.pathRail()[3].replace(/\//g, '') )
|
|
26
|
+
.removeAttr( 'href' )
|
|
28
27
|
.on( 'click', function(){
|
|
29
28
|
window.location.href = href;
|
|
30
29
|
window.history.pushState('', '', href);
|
|
31
30
|
});
|
|
32
|
-
|
|
31
|
+
}
|
|
33
32
|
|
|
34
33
|
});
|
|
35
34
|
|
package/scripts/disableSelect.js
CHANGED
|
@@ -9,13 +9,16 @@
|
|
|
9
9
|
|
|
10
10
|
/***********************************************************************/
|
|
11
11
|
|
|
12
|
-
window.dphelper.disableSelect = function(
|
|
12
|
+
window.dphelper.disableSelect = function( el = 'body' ){
|
|
13
|
+
|
|
14
|
+
var $ = require( "jquery" );
|
|
15
|
+
var e = e || event;
|
|
13
16
|
|
|
14
|
-
const disabling = (
|
|
17
|
+
const disabling = ( el ) => {
|
|
15
18
|
|
|
16
|
-
const $ = require("jquery");
|
|
19
|
+
const $ = require( "jquery" );
|
|
17
20
|
|
|
18
|
-
$(
|
|
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.
|
|
40
|
-
document.
|
|
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
|
+
|
package/scripts/storage.js
CHANGED
|
@@ -15,14 +15,17 @@ window.dphelper.storage = {
|
|
|
15
15
|
if(!name) return;
|
|
16
16
|
return window.localStorage.getItem( name );
|
|
17
17
|
},
|
|
18
|
+
|
|
18
19
|
set: function( name, value ) {
|
|
19
20
|
if(!name || !value) return;
|
|
20
21
|
window.localStorage.setItem( name, JSON.stringify(value) );
|
|
21
22
|
},
|
|
23
|
+
|
|
22
24
|
delete: function( name ) {
|
|
23
25
|
if(!name) return;
|
|
24
26
|
window.localStorage.removeItem( name );
|
|
25
27
|
},
|
|
28
|
+
|
|
26
29
|
clearAll: function() {
|
|
27
30
|
window.localStorage.clear();
|
|
28
31
|
}
|