dphelper 0.2.81 → 0.2.84
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/.github/FUNDING.yml +12 -12
- package/.github/dependabot.yml +12 -12
- package/{LICENSE → LICENSE.txt} +9 -1
- package/index.js +1 -1
- package/package.json +6 -6
- package/scripts/.OLD/onBeforeUnLoad.js +120 -0
- package/scripts/.OLD/purge.js +53 -0
- package/scripts/.OLD/string.js +27 -0
- package/typings/.OLD/cordova.d.ts +12 -0
- package/typings/.OLD/layerpro.d.ts +20 -0
- package/typings/.OLD/menupro.d.ts +20 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dphelper",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.84",
|
|
4
4
|
"description": "Developer Tools",
|
|
5
5
|
"deprecated": false,
|
|
6
6
|
"appCode": "dphelper",
|
|
@@ -85,8 +85,9 @@
|
|
|
85
85
|
"url": "https://github.com/passariello/dpHelper/issues"
|
|
86
86
|
},
|
|
87
87
|
"devDependencies": {
|
|
88
|
+
"@babel/plugin-transform-runtime": "7.17.0",
|
|
88
89
|
"css-loader": "6.7.1",
|
|
89
|
-
"eslint": "8.
|
|
90
|
+
"eslint": "8.13.0",
|
|
90
91
|
"file-loader": "6.2.0",
|
|
91
92
|
"jest": "27.5.1",
|
|
92
93
|
"less-loader": "10.2.0",
|
|
@@ -96,7 +97,6 @@
|
|
|
96
97
|
},
|
|
97
98
|
"dependencies": {
|
|
98
99
|
"@babel/plugin-proposal-class-properties": "7.16.7",
|
|
99
|
-
"@babel/plugin-transform-runtime": "7.17.0",
|
|
100
100
|
"@babel/preset-env": "7.16.11",
|
|
101
101
|
"@babel/preset-react": "7.16.7",
|
|
102
102
|
"@babel/preset-typescript": "7.16.7",
|
|
@@ -107,7 +107,7 @@
|
|
|
107
107
|
"classnames": "2.3.1",
|
|
108
108
|
"cli-confirm": "1.0.1",
|
|
109
109
|
"compression-webpack-plugin": "9.2.0",
|
|
110
|
-
"concurrently": "7.
|
|
110
|
+
"concurrently": "7.1.0",
|
|
111
111
|
"copy-webpack-plugin": "10.2.4",
|
|
112
112
|
"css": "3.0.0",
|
|
113
113
|
"dotenv": "16.0.0",
|
|
@@ -117,13 +117,13 @@
|
|
|
117
117
|
"jsdom-worker": "0.2.1",
|
|
118
118
|
"jshint": "^2.13.4",
|
|
119
119
|
"less": "4.1.2",
|
|
120
|
-
"moment": "2.29.
|
|
120
|
+
"moment": "2.29.2",
|
|
121
121
|
"path": "0.12.7",
|
|
122
122
|
"progress-bar-webpack-plugin": "2.1.0",
|
|
123
123
|
"react": "18.0.0",
|
|
124
124
|
"react-dom": "18.0.0",
|
|
125
125
|
"require": "2.4.20",
|
|
126
|
-
"sass": "1.
|
|
126
|
+
"sass": "1.50.0",
|
|
127
127
|
"ts-jest": "27.1.4",
|
|
128
128
|
"tslint": "6.1.3",
|
|
129
129
|
"webpack": "5.71.0"
|
|
@@ -0,0 +1,120 @@
|
|
|
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
|
+
};
|
|
@@ -0,0 +1,53 @@
|
|
|
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()
|
|
@@ -0,0 +1,27 @@
|
|
|
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",
|
|
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 != 0 ? true : false;
|
|
27
|
+
};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/*
|
|
2
|
+
Copyright: © 2022 Dario Passariello <dariopassariello@gmail.com>
|
|
3
|
+
License: CC BY-NC-ND 4.0
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
declare module 'layerpro';
|
|
7
|
+
declare var layerpro: any;
|
|
8
|
+
|
|
9
|
+
declare module 'jquery';
|
|
10
|
+
declare var $: any;
|
|
11
|
+
|
|
12
|
+
////////////////////////////////////////////////////////////////
|
|
13
|
+
|
|
14
|
+
declare global {
|
|
15
|
+
interface Window {
|
|
16
|
+
layerpro:any;
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
window.layerpro = window.layerpro || false;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/*
|
|
2
|
+
Copyright: © 2022 Dario Passariello <dariopassariello@gmail.com>
|
|
3
|
+
License: CC BY-NC-ND 4.0
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
declare module 'menupro';
|
|
7
|
+
declare var menupro: any;
|
|
8
|
+
|
|
9
|
+
declare module 'jquery';
|
|
10
|
+
declare var $: any;
|
|
11
|
+
|
|
12
|
+
////////////////////////////////////////////////////////////////
|
|
13
|
+
|
|
14
|
+
declare global {
|
|
15
|
+
interface Window {
|
|
16
|
+
menupro:any;
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
window.menupro = window.menupro || false;
|