dphelper 0.2.28 → 0.2.32
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/data/.OLD/~camelCase.js +41 -0
- package/{scripts/date2Iso.js → data/.OLD/~date2Iso.js} +31 -20
- package/{scripts/date2MMDDYYYY.js → data/.OLD/~date2MMDDYYYY.js} +27 -16
- package/{scripts/dateConvert.js → data/.OLD/~dateConvert.js} +31 -20
- package/{scripts/dateIso2Epoch.js → data/.OLD/~dateIso2Epoch.js} +28 -17
- package/{scripts/dateLocal-ISOTime.js → data/.OLD/~dateLocal-ISOTime.js} +28 -17
- package/data/.OLD/~dateUTC.js +25 -0
- package/{scripts/disableSpellCheck.js → data/.OLD/~disableSpellCheck.js} +32 -21
- package/data/.OLD/~loadJson.js +27 -0
- package/{scripts/loadJsonExternal.js → data/.OLD/~loadJsonExternal.js} +44 -32
- package/data/.OLD/~nl2br.js +26 -0
- package/{scripts/object2array.js → data/.OLD/~object2array.js} +15 -3
- package/data/.OLD/~parseDate.js +30 -0
- package/data/.OLD/~pathHash.js +27 -0
- package/data/.OLD/~pathQuery.js +28 -0
- package/data/.OLD/~pathRail.js +27 -0
- package/data/.OLD/~randomNumTmr.js +26 -0
- package/{scripts/scrollIndicator.js → data/.OLD/~scrollIndicator.js} +0 -0
- package/{scripts/scrollMemory.js → data/.OLD/~scrollMemory.js} +0 -0
- package/{scripts/scrollSmooth.js → data/.OLD/~scrollSmooth.js} +0 -0
- package/{scripts/scrollToElement.js → data/.OLD/~scrollToElement.js} +0 -0
- package/{scripts/svgSupport.js → data/.OLD/~svgSupport.js} +0 -0
- package/data/list.json +19 -26
- package/init.js +19 -5
- package/package.json +7 -9
- package/scripts/anchorToOnClick.js +15 -3
- package/scripts/array.js +29 -3
- package/scripts/console.js +86 -0
- package/scripts/cookie.js +97 -71
- package/scripts/currency.js +31 -11
- package/scripts/date.js +101 -0
- package/scripts/disable.js +88 -0
- package/scripts/event.js +39 -0
- package/scripts/font.js +52 -0
- package/scripts/form.js +113 -0
- package/scripts/indexedDB.js +47 -10
- package/scripts/isPromise.js +26 -14
- package/scripts/json.js +42 -0
- package/scripts/load.js +70 -0
- package/scripts/noCache.js +26 -14
- package/scripts/number.js +42 -0
- package/scripts/obj.js +81 -0
- package/scripts/onBeforeUnLoad.js +120 -108
- package/scripts/parseBool.js +27 -15
- package/scripts/path.js +94 -0
- package/scripts/printInfo.js +28 -16
- package/scripts/purge.js +53 -41
- package/scripts/pushState.js +33 -14
- package/scripts/screen.js +64 -0
- package/scripts/scrollbar.js +226 -0
- package/scripts/{handleEvent.js → shortcut.js} +70 -59
- package/scripts/storage.js +29 -3
- package/scripts/svg.js +372 -0
- package/scripts/text.js +78 -0
- package/scripts/time.js +41 -0
- package/scripts/timer.js +35 -0
- package/scripts/trigger.js +37 -0
- package/scripts/uuid.js +33 -14
- package/scripts/window.js +50 -38
- package/#cmd.exe.lnk +0 -0
- package/.github/workflows/codeql-analysis.yml +0 -70
- package/README.md.bak +0 -70
- package/scripts/.OLD/arrayDeleteItem.js +0 -35
- package/scripts/.OLD/arrayItemFinder.js +0 -22
- package/scripts/.OLD/arrayMerge.js +0 -20
- package/scripts/.OLD/arrayUnique.js +0 -15
- package/scripts/.OLD/loadAsset.js +0 -26
- package/scripts/addListenerMulti.js +0 -10
- package/scripts/camelCase.js +0 -29
- package/scripts/dateUTC.js +0 -14
- package/scripts/disableSelect.js +0 -46
- package/scripts/epoch.js +0 -14
- package/scripts/fontFit.js +0 -24
- package/scripts/fullScreen.js +0 -40
- package/scripts/jsonCounter.js +0 -21
- package/scripts/loadFile.js +0 -17
- package/scripts/loadJson.js +0 -15
- package/scripts/nl2br.js +0 -14
- package/scripts/parseDate.js +0 -19
- package/scripts/pathHash.js +0 -20
- package/scripts/pathQuery.js +0 -24
- package/scripts/pathRail.js +0 -26
- package/scripts/randomNum.js +0 -14
- package/scripts/randomNumTmr.js +0 -14
- package/scripts/scrollCustom.js +0 -41
- package/scripts/serializeForm.js +0 -94
- package/scripts/serializeObj.js +0 -47
- package/scripts/sleep.js +0 -14
- package/scripts/stopConsole.js +0 -49
- package/scripts/textChanger.js +0 -24
- package/scripts/triggerClick.js +0 -16
package/scripts/obj.js
ADDED
|
@@ -0,0 +1,81 @@
|
|
|
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" : "Handle Forms",
|
|
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
|
+
window.dphelper._list.scripts.push( description );
|
|
32
|
+
|
|
33
|
+
/***********************************************************************/
|
|
34
|
+
|
|
35
|
+
window.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] = window.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] = window.dphelper.objDeSerialize(objectValue);
|
|
73
|
+
}
|
|
74
|
+
return deserializeObject;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
return value;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
};
|
|
81
|
+
|
|
@@ -1,108 +1,120 @@
|
|
|
1
|
-
/*!
|
|
2
|
-
* dpHelper <https://github.com/passariello/dpHelper>
|
|
3
|
-
*
|
|
4
|
-
*
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
/****************************************************************************** */
|
|
50
|
-
|
|
51
|
-
let
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
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" : "Function Message Before UnLoad",
|
|
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
|
+
window.dphelper._list.scripts.push( description );
|
|
21
|
+
|
|
22
|
+
/***********************************************************************/
|
|
23
|
+
|
|
24
|
+
window.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
CHANGED
|
@@ -1,15 +1,27 @@
|
|
|
1
|
-
/*!
|
|
2
|
-
* dpHelper <https://github.com/passariello/dpHelper>
|
|
3
|
-
*
|
|
4
|
-
*
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
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
|
+
window.dphelper._list.scripts.push( description );
|
|
21
|
+
|
|
22
|
+
/***********************************************************************/
|
|
23
|
+
|
|
24
|
+
window.dphelper.parseBool = ( val ) => {
|
|
25
|
+
if ( !val || val.length == null ) return true;
|
|
26
|
+
return val == '1' ? true : false;
|
|
27
|
+
};
|
package/scripts/path.js
ADDED
|
@@ -0,0 +1,94 @@
|
|
|
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" : "Array From Rail, Hash Or Query",
|
|
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
|
+
window.dphelper._list.scripts.push( description );
|
|
32
|
+
|
|
33
|
+
/***********************************************************************/
|
|
34
|
+
|
|
35
|
+
// ALIAS
|
|
36
|
+
window.dphelper.pathHash = () => {
|
|
37
|
+
console.debug( 'dpHelper: Please use "dphelper.path.hash()"' );
|
|
38
|
+
return window.dphelper.path.hash();
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
window.dphelper.pathQuery = () => {
|
|
42
|
+
console.debug( 'dpHelper: Please use "dphelper.path.query()"' );
|
|
43
|
+
return window.dphelper.path.query();
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
window.dphelper.pathRail = () => {
|
|
47
|
+
console.debug( 'dpHelper: Please use "dphelper.path.rail()"' );
|
|
48
|
+
return window.dphelper.path.rail();
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
/***********************************************************************/
|
|
52
|
+
|
|
53
|
+
window.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/printInfo.js
CHANGED
|
@@ -1,16 +1,28 @@
|
|
|
1
|
-
/*!
|
|
2
|
-
* dpHelper <https://github.com/passariello/dpHelper>
|
|
3
|
-
*
|
|
4
|
-
*
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
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" : "Print Console Info About dpHelper",
|
|
11
|
+
"description" : "test",
|
|
12
|
+
"version" : "0.0.1",
|
|
13
|
+
"command" : "printInfo",
|
|
14
|
+
"subCommand" : [],
|
|
15
|
+
"example" : "",
|
|
16
|
+
"author" : "Dario Passariello",
|
|
17
|
+
"active" : true
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
window.dphelper._list.scripts.push( description );
|
|
21
|
+
|
|
22
|
+
/***********************************************************************/
|
|
23
|
+
|
|
24
|
+
window.dphelper.printInfo = () => {
|
|
25
|
+
console.groupCollapsed('%cApi:%c', "color:orange", "");
|
|
26
|
+
console.debug(dphelper.api);
|
|
27
|
+
console.groupEnd();
|
|
28
|
+
};
|
package/scripts/purge.js
CHANGED
|
@@ -1,41 +1,53 @@
|
|
|
1
|
-
/*!
|
|
2
|
-
* dpHelper <https://github.com/passariello/dpHelper>
|
|
3
|
-
*
|
|
4
|
-
*
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
a = d.
|
|
30
|
-
|
|
31
|
-
if (a) {
|
|
32
|
-
l = a.length;
|
|
33
|
-
for( i = 0; i < l; i += 1 ) {
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
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
|
+
window.dphelper._list.scripts.push( description );
|
|
21
|
+
|
|
22
|
+
/***********************************************************************/
|
|
23
|
+
|
|
24
|
+
window.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/pushState.js
CHANGED
|
@@ -1,14 +1,33 @@
|
|
|
1
|
-
/*!
|
|
2
|
-
* dpHelper <https://github.com/passariello/dpHelper>
|
|
3
|
-
*
|
|
4
|
-
*
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
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" : "Push In To State Of Browser (Ajax)",
|
|
11
|
+
"description" : "test",
|
|
12
|
+
"version" : "0.0.1",
|
|
13
|
+
"command" : "push",
|
|
14
|
+
"subCommand" : [
|
|
15
|
+
{
|
|
16
|
+
"name":"state",
|
|
17
|
+
"description":"test"
|
|
18
|
+
}
|
|
19
|
+
],
|
|
20
|
+
"example" : "",
|
|
21
|
+
"author" : "Dario Passariello",
|
|
22
|
+
"active" : true
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
window.dphelper._list.scripts.push( description );
|
|
26
|
+
|
|
27
|
+
/***********************************************************************/
|
|
28
|
+
|
|
29
|
+
window.dphelper.push = {
|
|
30
|
+
state: (state, title, url) => {
|
|
31
|
+
return history.pushState( state, title, url );
|
|
32
|
+
}
|
|
33
|
+
};
|