dphelper 0.2.57 → 0.2.59
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/index.js +2 -10
- package/index.js.LICENSE.txt +24 -0
- package/package.json +1 -1
- package/.editorconfig +0 -15
- package/.env +0 -3
- package/.eslintignore +0 -8
- package/.eslintrc.json +0 -36
- package/.gitattributes +0 -2
- package/.hintrc +0 -11
- package/.jsbeautifyrc +0 -25
- package/.jshintrc +0 -14
- package/.prettierignore +0 -2
- package/.prettierrc +0 -7
- package/.vscode/settings.json +0 -54
- package/3party/shortcut.js +0 -224
- package/backup.bat +0 -43
- package/data/list.json +0 -19
- package/dist/LICENSE +0 -201
- package/dist/README.md +0 -176
- package/index.d.ts +0 -14
- package/init.js +0 -48
- package/jest.config.js +0 -18
- package/public/assets/images/banner.png +0 -0
- package/public/assets/logos/logo.svg +0 -64
- package/scripts/anchorToOnClick.js +0 -47
- package/scripts/array.js +0 -142
- package/scripts/browser.js +0 -65
- package/scripts/console.js +0 -86
- package/scripts/coodinates.js +0 -41
- package/scripts/cookie.js +0 -97
- package/scripts/currency.js +0 -41
- package/scripts/date.js +0 -101
- package/scripts/disable.js +0 -90
- package/scripts/event.js +0 -39
- package/scripts/font.js +0 -52
- package/scripts/form.js +0 -113
- package/scripts/function.js +0 -47
- package/scripts/indexedDB.js +0 -222
- package/scripts/json.js +0 -42
- package/scripts/load.js +0 -85
- package/scripts/noCache.js +0 -26
- package/scripts/number.js +0 -66
- package/scripts/obj.js +0 -81
- package/scripts/onBeforeUnLoad.js +0 -120
- package/scripts/parseBool.js +0 -27
- package/scripts/path.js +0 -94
- package/scripts/promise.js +0 -35
- package/scripts/purge.js +0 -53
- package/scripts/screen.js +0 -64
- package/scripts/scrollbar.js +0 -245
- package/scripts/shortcut.js +0 -70
- package/scripts/storage.js +0 -62
- package/scripts/svg.js +0 -372
- package/scripts/text.js +0 -78
- package/scripts/time.js +0 -41
- package/scripts/timer.js +0 -35
- package/scripts/trigger.js +0 -46
- package/scripts/type.js +0 -56
- package/scripts/uuid.js +0 -33
- package/scripts/window.js +0 -50
- package/tests/ld-json-funtions.test.ts +0 -21
- package/tests/ld-json.test.ts +0 -46
- package/webpack.config.js +0 -240
package/scripts/json.js
DELETED
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
/*!
|
|
2
|
-
* dpHelper <https://github.com/passariello/dpHelper>
|
|
3
|
-
* Copyright (c) 2021, Dario Passariello.
|
|
4
|
-
* Licensed under the Apache-2.0 License.
|
|
5
|
-
*/
|
|
6
|
-
|
|
7
|
-
/***********************************************************************/
|
|
8
|
-
|
|
9
|
-
var description = {
|
|
10
|
-
"name" : "Json",
|
|
11
|
-
"description" : "test",
|
|
12
|
-
"version" : "0.0.1",
|
|
13
|
-
"command" : "json",
|
|
14
|
-
"subCommand" : [
|
|
15
|
-
{
|
|
16
|
-
"name":"counter",
|
|
17
|
-
"description" : "test",
|
|
18
|
-
}
|
|
19
|
-
],
|
|
20
|
-
"example" : "",
|
|
21
|
-
"author" : "Dario Passariello",
|
|
22
|
-
"active" : true
|
|
23
|
-
};
|
|
24
|
-
|
|
25
|
-
dphelper._list.scripts.push( description );
|
|
26
|
-
|
|
27
|
-
/***********************************************************************/
|
|
28
|
-
|
|
29
|
-
dphelper.json = {
|
|
30
|
-
|
|
31
|
-
counter: (json, key, val) => {
|
|
32
|
-
if (!json) return null;
|
|
33
|
-
let keyCount;
|
|
34
|
-
if (key && val) {
|
|
35
|
-
keyCount = Object.keys(jsonObject).length;
|
|
36
|
-
} else {
|
|
37
|
-
keyCount = json.items.filter(value => value.key === val).lengt;
|
|
38
|
-
}
|
|
39
|
-
return keyCount;
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
};
|
package/scripts/load.js
DELETED
|
@@ -1,85 +0,0 @@
|
|
|
1
|
-
/*!
|
|
2
|
-
* dpHelper <https://github.com/passariello/dpHelper>
|
|
3
|
-
* Copyright (c) 2021, Dario Passariello.
|
|
4
|
-
* Licensed under the Apache-2.0 License.
|
|
5
|
-
*/
|
|
6
|
-
|
|
7
|
-
/***********************************************************************/
|
|
8
|
-
|
|
9
|
-
var description = {
|
|
10
|
-
"name" : "Load Files",
|
|
11
|
-
"description" : "test",
|
|
12
|
-
"version" : "0.0.1",
|
|
13
|
-
"command" : "load",
|
|
14
|
-
"subCommand" : [
|
|
15
|
-
{
|
|
16
|
-
"name":"file",
|
|
17
|
-
"description":"test"
|
|
18
|
-
},{
|
|
19
|
-
"name":"json",
|
|
20
|
-
"description":"test"
|
|
21
|
-
},{
|
|
22
|
-
"name":"jsonRemote",
|
|
23
|
-
"description":"test"
|
|
24
|
-
}
|
|
25
|
-
],
|
|
26
|
-
"example" : "",
|
|
27
|
-
"author" : "Dario Passariello",
|
|
28
|
-
"active" : true
|
|
29
|
-
};
|
|
30
|
-
|
|
31
|
-
dphelper._list.scripts.push( description );
|
|
32
|
-
|
|
33
|
-
/***********************************************************************/
|
|
34
|
-
|
|
35
|
-
dphelper.load = {
|
|
36
|
-
|
|
37
|
-
/*
|
|
38
|
-
Example:
|
|
39
|
-
var cntx = require.context( __dirname + '/scripts/', false , /\.js$/ );
|
|
40
|
-
dphelper.load.import( cntx );
|
|
41
|
-
*/
|
|
42
|
-
/*
|
|
43
|
-
import: ( dir , type = false , extension = /\.js$/ ) => {
|
|
44
|
-
let r = require.context( dir , type , extension );
|
|
45
|
-
r.keys().forEach(
|
|
46
|
-
( key ) => (
|
|
47
|
-
cache[ key ] = r( key )
|
|
48
|
-
)
|
|
49
|
-
);
|
|
50
|
-
},
|
|
51
|
-
*/
|
|
52
|
-
file: (element, path) => {
|
|
53
|
-
fetch(path).then(async function (response) {
|
|
54
|
-
const text = await response.text();
|
|
55
|
-
document.querySelector( element ).innerHTML = dphelper.nl2br( String(text) );
|
|
56
|
-
});
|
|
57
|
-
},
|
|
58
|
-
|
|
59
|
-
json: function( file ){
|
|
60
|
-
if ( file.match(/.(json)$/i ) ) return require( '' + file + '' );
|
|
61
|
-
},
|
|
62
|
-
|
|
63
|
-
jsonRemote: ( path, method='GET', type='application/json' ) => {
|
|
64
|
-
|
|
65
|
-
fetch( path ,{
|
|
66
|
-
method: method,
|
|
67
|
-
headers : {
|
|
68
|
-
'Content-Type': type
|
|
69
|
-
}
|
|
70
|
-
})
|
|
71
|
-
.then(
|
|
72
|
-
function(response) {
|
|
73
|
-
//return response.json();
|
|
74
|
-
return response;
|
|
75
|
-
}
|
|
76
|
-
)
|
|
77
|
-
.then(
|
|
78
|
-
function( myFile ) {
|
|
79
|
-
return myFile;
|
|
80
|
-
}
|
|
81
|
-
);
|
|
82
|
-
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
};
|
package/scripts/noCache.js
DELETED
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
/*!
|
|
2
|
-
* dpHelper <https://github.com/passariello/dpHelper>
|
|
3
|
-
* Copyright (c) 2021, Dario Passariello.
|
|
4
|
-
* Licensed under the Apache-2.0 License.
|
|
5
|
-
*/
|
|
6
|
-
|
|
7
|
-
/***********************************************************************/
|
|
8
|
-
|
|
9
|
-
var description = {
|
|
10
|
-
"name" : "Avoid Caching",
|
|
11
|
-
"description" : "test",
|
|
12
|
-
"version" : "0.0.1",
|
|
13
|
-
"command" : "noCache",
|
|
14
|
-
"subCommand" : [],
|
|
15
|
-
"example" : "",
|
|
16
|
-
"author" : "Dario Passariello",
|
|
17
|
-
"active" : true
|
|
18
|
-
};
|
|
19
|
-
|
|
20
|
-
dphelper._list.scripts.push( description );
|
|
21
|
-
|
|
22
|
-
/***********************************************************************/
|
|
23
|
-
|
|
24
|
-
dphelper.noCache = (uri) => {
|
|
25
|
-
return uri.concat( /\?/.test(uri) ? '&' : '?', 't=', dphelper.rnd() );
|
|
26
|
-
};
|
package/scripts/number.js
DELETED
|
@@ -1,66 +0,0 @@
|
|
|
1
|
-
/*!
|
|
2
|
-
* dpHelper <https://github.com/passariello/dpHelper>
|
|
3
|
-
* Copyright (c) 2021, Dario Passariello.
|
|
4
|
-
* Licensed under the Apache-2.0 License.
|
|
5
|
-
*/
|
|
6
|
-
|
|
7
|
-
/***********************************************************************/
|
|
8
|
-
|
|
9
|
-
var description = {
|
|
10
|
-
"name" : "Numbers",
|
|
11
|
-
"description" : "test",
|
|
12
|
-
"version" : "0.0.1",
|
|
13
|
-
"command" : "number",
|
|
14
|
-
"subCommand" : [
|
|
15
|
-
{
|
|
16
|
-
"name":"rnd",
|
|
17
|
-
"description":"test",
|
|
18
|
-
},{
|
|
19
|
-
"name":"tmr",
|
|
20
|
-
"description":"test",
|
|
21
|
-
}
|
|
22
|
-
],
|
|
23
|
-
"example" : "",
|
|
24
|
-
"author" : "Dario Passariello",
|
|
25
|
-
"active" : true
|
|
26
|
-
};
|
|
27
|
-
|
|
28
|
-
dphelper._list.scripts.push( description );
|
|
29
|
-
|
|
30
|
-
/***********************************************************************/
|
|
31
|
-
|
|
32
|
-
dphelper.number = {
|
|
33
|
-
|
|
34
|
-
rnd: () => {
|
|
35
|
-
return Math.floor( 100000 + Math.random() * dphelper.number.tmr() );
|
|
36
|
-
},
|
|
37
|
-
|
|
38
|
-
tmr: () => {
|
|
39
|
-
return Math.round( dphelper.time.epoch() / 1000 );
|
|
40
|
-
},
|
|
41
|
-
|
|
42
|
-
add: ( a , b ) => {
|
|
43
|
-
return a + b;
|
|
44
|
-
},
|
|
45
|
-
|
|
46
|
-
sub: ( a , b ) => {
|
|
47
|
-
return a - b;
|
|
48
|
-
},
|
|
49
|
-
|
|
50
|
-
multi: ( a , b ) => {
|
|
51
|
-
return a * b;
|
|
52
|
-
},
|
|
53
|
-
|
|
54
|
-
div: ( a , b ) => {
|
|
55
|
-
return a - b;
|
|
56
|
-
},
|
|
57
|
-
|
|
58
|
-
rem: ( a , b ) => {
|
|
59
|
-
return a % b;
|
|
60
|
-
},
|
|
61
|
-
|
|
62
|
-
exp: ( a , b ) => {
|
|
63
|
-
return a ** b;
|
|
64
|
-
},
|
|
65
|
-
|
|
66
|
-
};
|
package/scripts/obj.js
DELETED
|
@@ -1,81 +0,0 @@
|
|
|
1
|
-
/*!
|
|
2
|
-
* dpHelper <https://github.com/passariello/dpHelper>
|
|
3
|
-
* Copyright (c) 2021, Dario Passariello.
|
|
4
|
-
* Licensed under the Apache-2.0 License.
|
|
5
|
-
*/
|
|
6
|
-
|
|
7
|
-
/***********************************************************************/
|
|
8
|
-
|
|
9
|
-
var description = {
|
|
10
|
-
"name" : "Objects",
|
|
11
|
-
"description" : "test",
|
|
12
|
-
"version" : "0.0.1",
|
|
13
|
-
"command" : "form",
|
|
14
|
-
"subCommand" : [
|
|
15
|
-
{
|
|
16
|
-
"name":"toArray",
|
|
17
|
-
"description":"test"
|
|
18
|
-
},{
|
|
19
|
-
"name":"serialize",
|
|
20
|
-
"description":"test"
|
|
21
|
-
},{
|
|
22
|
-
"name":"deSerialize",
|
|
23
|
-
"description":"test"
|
|
24
|
-
}
|
|
25
|
-
],
|
|
26
|
-
"example" : "",
|
|
27
|
-
"author" : "Dario Passariello",
|
|
28
|
-
"active" : true
|
|
29
|
-
};
|
|
30
|
-
|
|
31
|
-
dphelper._list.scripts.push( description );
|
|
32
|
-
|
|
33
|
-
/***********************************************************************/
|
|
34
|
-
|
|
35
|
-
dphelper.obj = {
|
|
36
|
-
|
|
37
|
-
toArray: ( object ) => {
|
|
38
|
-
return Object
|
|
39
|
-
.entries( object )
|
|
40
|
-
.map( ( [ key, value ] ) => Object.assign( { key } , value && typeof value === 'object' ? { forms: ObjToArray( value ) } : { value, forms: [] } ) );
|
|
41
|
-
},
|
|
42
|
-
|
|
43
|
-
serialize: ( value ) => {
|
|
44
|
-
|
|
45
|
-
if (typeof value === 'function') {
|
|
46
|
-
return value.toString();
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
if (typeof value === 'object') {
|
|
50
|
-
let serializeObject = {};
|
|
51
|
-
for (const [objectKey, objectValue] of Object.entries(value)) {
|
|
52
|
-
console.info( `objectKey=${objectKey} value=${objectValue}` );
|
|
53
|
-
serializeObject[objectKey] = dphelper.objSerialize(objectValue);
|
|
54
|
-
}
|
|
55
|
-
return serializeObject;
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
return value;
|
|
59
|
-
|
|
60
|
-
},
|
|
61
|
-
|
|
62
|
-
deSerialize: ( valueNew ) => {
|
|
63
|
-
|
|
64
|
-
if (valueNew.toLowerCase().startsWith( 'function(' ) ) {
|
|
65
|
-
return Function('"use strict";return ' + valueNew);
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
if (typeof valueNew === 'object') {
|
|
69
|
-
let deserializeObject = {};
|
|
70
|
-
for (const [objectKey, objectValue] of Object.entries(valueNew)) {
|
|
71
|
-
console.info( `objectKey=${objectKey} value=${objectValue}` );
|
|
72
|
-
deserializeObject[objectKey] = dphelper.objDeSerialize(objectValue);
|
|
73
|
-
}
|
|
74
|
-
return deserializeObject;
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
return value;
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
};
|
|
81
|
-
|
|
@@ -1,120 +0,0 @@
|
|
|
1
|
-
/*!
|
|
2
|
-
* dpHelper <https://github.com/passariello/dpHelper>
|
|
3
|
-
* Copyright (c) 2021, Dario Passariello.
|
|
4
|
-
* Licensed under the Apache-2.0 License.
|
|
5
|
-
*/
|
|
6
|
-
|
|
7
|
-
/***********************************************************************/
|
|
8
|
-
|
|
9
|
-
var description = {
|
|
10
|
-
"name" : "BeforeUnLoad",
|
|
11
|
-
"description" : "test",
|
|
12
|
-
"version" : "0.0.1",
|
|
13
|
-
"command" : "onBeforeUnLoad",
|
|
14
|
-
"subCommand" : [],
|
|
15
|
-
"example" : "",
|
|
16
|
-
"author" : "Dario Passariello",
|
|
17
|
-
"active" : true
|
|
18
|
-
};
|
|
19
|
-
|
|
20
|
-
dphelper._list.scripts.push( description );
|
|
21
|
-
|
|
22
|
-
/***********************************************************************/
|
|
23
|
-
|
|
24
|
-
dphelper.onBeforeUnLoad = () => {
|
|
25
|
-
|
|
26
|
-
let is_dirty = false;
|
|
27
|
-
let answer = null;
|
|
28
|
-
let mex = "You have made some changes which you might want to save.";
|
|
29
|
-
let loadOnce = false;
|
|
30
|
-
let save_button = document.querySelector("#save_button");
|
|
31
|
-
|
|
32
|
-
const beforeUnloadListener = ( event ) => {
|
|
33
|
-
event.preventDefault();
|
|
34
|
-
return mex;
|
|
35
|
-
};
|
|
36
|
-
|
|
37
|
-
const nameInput = document.querySelector("#name");
|
|
38
|
-
|
|
39
|
-
if( nameInput ){
|
|
40
|
-
nameInput.addEventListener( "input" , (event) => {
|
|
41
|
-
if (event.target.value !== "") {
|
|
42
|
-
addEventListener("beforeunload", beforeUnloadListener, { capture: true });
|
|
43
|
-
} else {
|
|
44
|
-
removeEventListener("beforeunload", beforeUnloadListener, { capture: true });
|
|
45
|
-
}
|
|
46
|
-
});
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
/****************************************************************************** */
|
|
50
|
-
|
|
51
|
-
let handleEvent = function( event ){
|
|
52
|
-
|
|
53
|
-
if( event.target.type === 'textarea' || event.target.type === 'input' ){
|
|
54
|
-
if( is_dirty === false ){
|
|
55
|
-
return is_dirty = true;
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
};
|
|
60
|
-
|
|
61
|
-
/****************************************************************************** */
|
|
62
|
-
|
|
63
|
-
let TEST = function (){
|
|
64
|
-
// CHANGE ON KEY
|
|
65
|
-
document.body.addEventListener( "keyup" , handleEvent );
|
|
66
|
-
}();
|
|
67
|
-
|
|
68
|
-
/****************************************************************************** */
|
|
69
|
-
|
|
70
|
-
// CHANGE ON ASIDE CLICK
|
|
71
|
-
if( loadOnce === false ){
|
|
72
|
-
document.body.addEventListener( "click" , function( event ){
|
|
73
|
-
|
|
74
|
-
if( event.target.tagName === 'IMG'){
|
|
75
|
-
|
|
76
|
-
if( is_dirty === true ) {
|
|
77
|
-
|
|
78
|
-
// if the user navigates away from this page via an anchor link,
|
|
79
|
-
// popup a new boxy confirmation.
|
|
80
|
-
answer = confirm( mex );
|
|
81
|
-
if ( answer === true ) {
|
|
82
|
-
return is_dirty = false;
|
|
83
|
-
}else{
|
|
84
|
-
event.preventDefault();
|
|
85
|
-
}
|
|
86
|
-
}
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
});
|
|
90
|
-
loadOnce = true;
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
/****************************************************************************** */
|
|
94
|
-
|
|
95
|
-
addEventListener('popstate', function(event) {
|
|
96
|
-
|
|
97
|
-
if( is_dirty === true ){
|
|
98
|
-
answer = confirm( mex );
|
|
99
|
-
if ( answer === true ) {
|
|
100
|
-
return is_dirty = false;
|
|
101
|
-
} else {
|
|
102
|
-
event.stopImmediatePropagation();
|
|
103
|
-
event.preventDefault();
|
|
104
|
-
return mex;
|
|
105
|
-
}
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
});
|
|
109
|
-
|
|
110
|
-
/****************************************************************************** */
|
|
111
|
-
|
|
112
|
-
window.onbeforeunload = function( event ) {
|
|
113
|
-
if( ( is_dirty === true ) && ( answer === null ) ){
|
|
114
|
-
event.preventDefault();
|
|
115
|
-
return event.returnValue = mex;
|
|
116
|
-
//return mex
|
|
117
|
-
}
|
|
118
|
-
};
|
|
119
|
-
|
|
120
|
-
};
|
package/scripts/parseBool.js
DELETED
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
/*!
|
|
2
|
-
* dpHelper <https://github.com/passariello/dpHelper>
|
|
3
|
-
* Copyright (c) 2021, Dario Passariello.
|
|
4
|
-
* Licensed under the Apache-2.0 License.
|
|
5
|
-
*/
|
|
6
|
-
|
|
7
|
-
/***********************************************************************/
|
|
8
|
-
|
|
9
|
-
var description = {
|
|
10
|
-
"name" : "String To Boolean",
|
|
11
|
-
"description" : "test",
|
|
12
|
-
"version" : "0.0.1",
|
|
13
|
-
"command" : "parseBool",
|
|
14
|
-
"subCommand" : [],
|
|
15
|
-
"example" : "",
|
|
16
|
-
"author" : "Dario Passariello",
|
|
17
|
-
"active" : true
|
|
18
|
-
};
|
|
19
|
-
|
|
20
|
-
dphelper._list.scripts.push( description );
|
|
21
|
-
|
|
22
|
-
/***********************************************************************/
|
|
23
|
-
|
|
24
|
-
dphelper.parseBool = ( val ) => {
|
|
25
|
-
if ( !val || val.length == null ) return true;
|
|
26
|
-
return val == '1' ? true : false;
|
|
27
|
-
};
|
package/scripts/path.js
DELETED
|
@@ -1,94 +0,0 @@
|
|
|
1
|
-
/*!
|
|
2
|
-
* dpHelper <https://github.com/passariello/dpHelper>
|
|
3
|
-
* Copyright (c) 2021, Dario Passariello.
|
|
4
|
-
* Licensed under the Apache-2.0 License.
|
|
5
|
-
*/
|
|
6
|
-
|
|
7
|
-
/***********************************************************************/
|
|
8
|
-
|
|
9
|
-
var description = {
|
|
10
|
-
"name" : "Path To Array",
|
|
11
|
-
"description" : "test",
|
|
12
|
-
"version" : "0.0.1",
|
|
13
|
-
"command" : "path",
|
|
14
|
-
"subCommand" : [
|
|
15
|
-
{
|
|
16
|
-
"name":"rail",
|
|
17
|
-
"description":"test"
|
|
18
|
-
},{
|
|
19
|
-
"name":"hash",
|
|
20
|
-
"description":"test"
|
|
21
|
-
},{
|
|
22
|
-
"name":"query",
|
|
23
|
-
"description":"test"
|
|
24
|
-
}
|
|
25
|
-
],
|
|
26
|
-
"example" : "",
|
|
27
|
-
"author" : "Dario Passariello",
|
|
28
|
-
"active" : true
|
|
29
|
-
};
|
|
30
|
-
|
|
31
|
-
dphelper._list.scripts.push( description );
|
|
32
|
-
|
|
33
|
-
/***********************************************************************/
|
|
34
|
-
|
|
35
|
-
// // ALIAS
|
|
36
|
-
// dphelper.pathHash = () => {
|
|
37
|
-
// console.debug( 'dpHelper: Please use "dphelper.path.hash()"' );
|
|
38
|
-
// return dphelper.path.hash();
|
|
39
|
-
// };
|
|
40
|
-
|
|
41
|
-
// dphelper.pathQuery = () => {
|
|
42
|
-
// console.debug( 'dpHelper: Please use "dphelper.path.query()"' );
|
|
43
|
-
// return dphelper.path.query();
|
|
44
|
-
// };
|
|
45
|
-
|
|
46
|
-
// dphelper.pathRail = () => {
|
|
47
|
-
// console.debug( 'dpHelper: Please use "dphelper.path.rail()"' );
|
|
48
|
-
// return dphelper.path.rail();
|
|
49
|
-
// };
|
|
50
|
-
|
|
51
|
-
/***********************************************************************/
|
|
52
|
-
|
|
53
|
-
dphelper.path = {
|
|
54
|
-
|
|
55
|
-
rail: () => {
|
|
56
|
-
const array = location.href
|
|
57
|
-
.split("?")[0]
|
|
58
|
-
.replace(location.protocol, '')
|
|
59
|
-
.replace(location.host, '')
|
|
60
|
-
.replace(location.hash, '')
|
|
61
|
-
.split('/');
|
|
62
|
-
if ( array.length > 0 ) {
|
|
63
|
-
const arrayFinal = array.filter(item => item);
|
|
64
|
-
return arrayFinal;
|
|
65
|
-
} else {
|
|
66
|
-
return;
|
|
67
|
-
}
|
|
68
|
-
},
|
|
69
|
-
|
|
70
|
-
hash: () => {
|
|
71
|
-
const array = location.hash.replace('#', '').split('/');
|
|
72
|
-
if (array.length) {
|
|
73
|
-
return array.filter(item => item);
|
|
74
|
-
} else {
|
|
75
|
-
return ["empty"];
|
|
76
|
-
}
|
|
77
|
-
},
|
|
78
|
-
|
|
79
|
-
query: () => {
|
|
80
|
-
let x, y, array = [], search = location.search;
|
|
81
|
-
if (search) {
|
|
82
|
-
search.replace("?", '').split('&')
|
|
83
|
-
.map(x => {
|
|
84
|
-
y = x.split('=');
|
|
85
|
-
array[y[0]] = y[1];
|
|
86
|
-
});
|
|
87
|
-
return array;
|
|
88
|
-
} else {
|
|
89
|
-
return ["empty"];
|
|
90
|
-
}
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
};
|
|
94
|
-
|
package/scripts/promise.js
DELETED
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
/*!
|
|
2
|
-
* dpHelper <https://github.com/passariello/dpHelper>
|
|
3
|
-
* Copyright (c) 2021, Dario Passariello.
|
|
4
|
-
* Licensed under the Apache-2.0 License.
|
|
5
|
-
*/
|
|
6
|
-
|
|
7
|
-
/***********************************************************************/
|
|
8
|
-
|
|
9
|
-
var description = {
|
|
10
|
-
"name" : "Promises",
|
|
11
|
-
"description" : "test",
|
|
12
|
-
"version" : "0.0.1",
|
|
13
|
-
"command" : "promise",
|
|
14
|
-
"subCommand" : [
|
|
15
|
-
{
|
|
16
|
-
name:"check",
|
|
17
|
-
description:"test"
|
|
18
|
-
}
|
|
19
|
-
],
|
|
20
|
-
"example" : "",
|
|
21
|
-
"author" : "Dario Passariello",
|
|
22
|
-
"active" : true
|
|
23
|
-
};
|
|
24
|
-
|
|
25
|
-
dphelper._list.scripts.push( description );
|
|
26
|
-
|
|
27
|
-
/***********************************************************************/
|
|
28
|
-
|
|
29
|
-
dphelper.promise = {
|
|
30
|
-
|
|
31
|
-
check: (p) => {
|
|
32
|
-
return p && Object.prototype.toString.call(p) === "[object Promise]";
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
};
|
package/scripts/purge.js
DELETED
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
/*!
|
|
2
|
-
* dpHelper <https://github.com/passariello/dpHelper>
|
|
3
|
-
* Copyright (c) 2021, Dario Passariello.
|
|
4
|
-
* Licensed under the Apache-2.0 License.
|
|
5
|
-
*/
|
|
6
|
-
|
|
7
|
-
/***********************************************************************/
|
|
8
|
-
|
|
9
|
-
var description = {
|
|
10
|
-
"name" : "Purge From Memory",
|
|
11
|
-
"description" : "test",
|
|
12
|
-
"version" : "0.0.1",
|
|
13
|
-
"command" : "purge",
|
|
14
|
-
"subCommand" : [],
|
|
15
|
-
"example" : "",
|
|
16
|
-
"author" : "Dario Passariello",
|
|
17
|
-
"active" : true
|
|
18
|
-
};
|
|
19
|
-
|
|
20
|
-
dphelper._list.scripts.push( description );
|
|
21
|
-
|
|
22
|
-
/***********************************************************************/
|
|
23
|
-
|
|
24
|
-
dphelper.purge = ( d = body, time = 10000 ) => {
|
|
25
|
-
|
|
26
|
-
setTimeout(() => {
|
|
27
|
-
if( d === undefined ) return null;
|
|
28
|
-
|
|
29
|
-
let a = d.attributes, i, l, n;
|
|
30
|
-
|
|
31
|
-
if (a) {
|
|
32
|
-
l = a.length;
|
|
33
|
-
for( i = 0; i < l; i += 1 ) {
|
|
34
|
-
n = a[i].name;
|
|
35
|
-
if( typeof d[n] === 'function' ) { d[n] = null; }
|
|
36
|
-
if( typeof d[n] === 'undefined' ) { d[n] = null; }
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
a = d.childNodes;
|
|
42
|
-
|
|
43
|
-
if (a) {
|
|
44
|
-
l = a.length;
|
|
45
|
-
for( i = 0; i < l; i += 1 ) {
|
|
46
|
-
Purge( d.childNodes[i] );
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
}, time );
|
|
50
|
-
|
|
51
|
-
};
|
|
52
|
-
|
|
53
|
-
// purge()
|
package/scripts/screen.js
DELETED
|
@@ -1,64 +0,0 @@
|
|
|
1
|
-
/*!
|
|
2
|
-
* dpHelper <https://github.com/passariello/dpHelper>
|
|
3
|
-
* Copyright (c) 2021, Dario Passariello.
|
|
4
|
-
* Licensed under the Apache-2.0 License.
|
|
5
|
-
*/
|
|
6
|
-
|
|
7
|
-
/***********************************************************************/
|
|
8
|
-
|
|
9
|
-
var description = {
|
|
10
|
-
"name" : "Screen Options",
|
|
11
|
-
"description" : "test",
|
|
12
|
-
"version" : "0.0.1",
|
|
13
|
-
"command" : "screen",
|
|
14
|
-
"subCommand" : [
|
|
15
|
-
{
|
|
16
|
-
"name":"fullScreen",
|
|
17
|
-
"description":"test"
|
|
18
|
-
},{
|
|
19
|
-
"name":"toggle",
|
|
20
|
-
"description":"test"
|
|
21
|
-
}
|
|
22
|
-
],
|
|
23
|
-
"example" : "",
|
|
24
|
-
"author" : "Dario Passariello",
|
|
25
|
-
"active" : true
|
|
26
|
-
};
|
|
27
|
-
|
|
28
|
-
dphelper._list.scripts.push( description );
|
|
29
|
-
|
|
30
|
-
/***********************************************************************/
|
|
31
|
-
|
|
32
|
-
dphelper.screen = {
|
|
33
|
-
|
|
34
|
-
fullScreen: function( el ){
|
|
35
|
-
|
|
36
|
-
if ( el.requestFullScreen ) {
|
|
37
|
-
el.requestFullScreen();
|
|
38
|
-
} else if ( el.mozRequestFullScreen ) {
|
|
39
|
-
el.mozRequestFullScreen();
|
|
40
|
-
} else if ( el.webkitRequestFullScreen ) {
|
|
41
|
-
el.webkitRequestFullScreen();
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
},
|
|
45
|
-
|
|
46
|
-
toggle: function( el ) {
|
|
47
|
-
|
|
48
|
-
let requestFullScreen = el.requestFullscreen || el.mozRequestFullScreen || el.webkitRequestFullScreen || el.msRequestFullscreen;
|
|
49
|
-
let cancelFullScreen = el.exitFullscreen || el.mozCancelFullScreen || el.webkitExitFullscreen || el.msExitFullscreen;
|
|
50
|
-
|
|
51
|
-
if( !doc.fullscreenElement && !el.mozFullScreenElement && !el.webkitFullscreenElement && !el.msFullscreenElement ) {
|
|
52
|
-
requestFullScreen.call( el );
|
|
53
|
-
}else{
|
|
54
|
-
cancelFullScreen.call( el );
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
};
|
|
60
|
-
|
|
61
|
-
// dphelper.fullScreen.go( document.body )
|
|
62
|
-
// dphelper.fullScreen.toggle( document.body )
|
|
63
|
-
|
|
64
|
-
|