dphelper 0.2.88 → 0.2.89
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/.editorconfig +13 -0
- package/.env +3 -0
- package/.eslintignore +13 -0
- package/.eslintrc.json +87 -0
- package/.eslintrc.legacy.json +91 -0
- package/.gitattributes +2 -0
- package/.hintrc +11 -0
- package/.jsbeautifyrc +25 -0
- package/.jshintrc +16 -0
- package/.prettierignore +2 -0
- package/.prettierrc.json +8 -0
- package/.stylelintignore +0 -0
- package/.stylelintrc.json +468 -0
- package/.vscode/launch.json +34 -0
- package/.vscode/settings.json +58 -0
- package/3party/shortcut.js +224 -0
- package/__mocks__/fileMock.js +3 -0
- package/__mocks__/styleMock.js +3 -0
- package/babel.config.js +30 -0
- package/backup.bat +43 -0
- package/coverage/coverage-final.json +1 -0
- package/coverage/lcov-report/base.css +224 -0
- package/coverage/lcov-report/block-navigation.js +87 -0
- package/coverage/lcov-report/favicon.png +0 -0
- package/coverage/lcov-report/index.html +101 -0
- package/coverage/lcov-report/prettify.css +1 -0
- package/coverage/lcov-report/prettify.js +2 -0
- package/coverage/lcov-report/sort-arrow-sprite.png +0 -0
- package/coverage/lcov-report/sorter.js +196 -0
- package/coverage/lcov.info +0 -0
- package/data/list.json +19 -0
- package/dist/LICENSE.txt +209 -0
- package/dist/README.md +79 -0
- package/elements/button/component.js +0 -0
- package/elements/code/component.js +0 -0
- package/elements/costants.tsx +13 -0
- package/elements/fieldset/component.js +0 -0
- package/elements/input/checkbox/component.js +0 -0
- package/elements/input/date/component.js +27 -0
- package/elements/input/number/component.js +0 -0
- package/elements/input/radio/component.js +0 -0
- package/elements/input/search/component.js +0 -0
- package/elements/input/select/component.js +0 -0
- package/elements/input/slider/component.js +0 -0
- package/elements/input/switch/component.js +0 -0
- package/elements/tab/component.js +0 -0
- package/elements/table/component.js +0 -0
- package/elements/tags.less +0 -0
- package/elements/textarea/component.js +0 -0
- package/elements/x-foo/define.js +33 -0
- package/elements/x-foo/namespace.d.ts +7 -0
- package/index.js +12 -2
- package/init.js +87 -0
- package/jest.config.js +81 -0
- package/node/createTag.js +7 -0
- package/node/gitDeploy.js +7 -0
- package/node/goLive.js +7 -0
- package/package.json +7 -7
- package/{assets → public/assets}/images/banner.png +0 -0
- package/{assets → public/assets}/logos/logo.svg +0 -0
- package/{documents → public/documents}/iDB/list.html +0 -0
- package/{documents → public/documents}/iDB/toState.html +0 -0
- package/scripts/.OLD/import.js +48 -0
- package/scripts/.OLD/onBeforeUnLoad.js +120 -0
- package/scripts/.OLD/purge.js +53 -0
- package/scripts/.OLD/string.js +27 -0
- package/scripts/anchor.js +73 -0
- package/scripts/array.js +203 -0
- package/scripts/avoid.js +48 -0
- package/scripts/browser.js +100 -0
- package/scripts/color.js +121 -0
- package/scripts/console.js +97 -0
- package/scripts/console.mapped.js +160 -0
- package/scripts/coods.js +57 -0
- package/scripts/cookie.js +105 -0
- package/scripts/date.js +179 -0
- package/scripts/disable.js +91 -0
- package/scripts/errors.js +3 -0
- package/scripts/event.js +57 -0
- package/scripts/font.js +60 -0
- package/scripts/form.js +211 -0
- package/scripts/format.js +71 -0
- package/scripts/function.js +55 -0
- package/scripts/iDB.js +688 -0
- package/scripts/json.js +84 -0
- package/scripts/load.js +112 -0
- package/scripts/math.js +100 -0
- package/scripts/obj.js +118 -0
- package/scripts/path.js +101 -0
- package/scripts/promise.js +56 -0
- package/scripts/screen.js +82 -0
- package/scripts/scrollbar.js +293 -0
- package/scripts/shortcut.js +83 -0
- package/scripts/socket.js +184 -0
- package/scripts/state.js +87 -0
- package/scripts/storage.js +93 -0
- package/scripts/store.js +115 -0
- package/scripts/svg.js +380 -0
- package/scripts/text.js +116 -0
- package/scripts/time.js +43 -0
- package/scripts/timer.js +54 -0
- package/scripts/tool.js +73 -0
- package/scripts/trigger.js +57 -0
- package/scripts/type.js +76 -0
- package/scripts/ui.js +41 -0
- package/scripts/window.js +244 -0
- package/styles/console.less +95 -0
- package/tests/setupJest.tsx +4 -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/typings/dphelper.d.ts +26 -0
- package/typings/image.d.ts +5 -0
- package/typings/styles.d.ts +23 -0
- package/webpack.config.js +249 -0
- package/index.js.LICENSE.txt +0 -31
package/init.js
ADDED
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
|
|
2
|
+
( () => {
|
|
3
|
+
|
|
4
|
+
///////////////////////////////////////////////////////////////////////////////
|
|
5
|
+
// CUSTOM ELEMENTS
|
|
6
|
+
|
|
7
|
+
require("./elements/x-foo/define.js");
|
|
8
|
+
|
|
9
|
+
///////////////////////////////////////////////////////////////////////////////
|
|
10
|
+
// DPH DECLARATIONS
|
|
11
|
+
|
|
12
|
+
require( __dirname + '/typings/dphelper.d.ts' );
|
|
13
|
+
|
|
14
|
+
///////////////////////////////////////////////////////////////////////////////
|
|
15
|
+
// CONFIG
|
|
16
|
+
|
|
17
|
+
const pjson = require('./package.json');
|
|
18
|
+
var e = e || event;
|
|
19
|
+
|
|
20
|
+
///////////////////////////////////////////////////////////////////////////////
|
|
21
|
+
// CREATE FULL LIST FOR DPHELPER MANAGER
|
|
22
|
+
|
|
23
|
+
dphelper._list = require('./data/list.json');
|
|
24
|
+
dphelper._list.scripts = [];
|
|
25
|
+
dphelper._list.version = pjson.version;
|
|
26
|
+
|
|
27
|
+
///////////////////////////////////////////////////////////////////////////////
|
|
28
|
+
// CACHE
|
|
29
|
+
const cache = {};
|
|
30
|
+
|
|
31
|
+
///////////////////////////////////////////////////////////////////////////////
|
|
32
|
+
// API
|
|
33
|
+
|
|
34
|
+
dphelper.api = {};
|
|
35
|
+
|
|
36
|
+
///////////////////////////////////////////////////////////////////////////////
|
|
37
|
+
// INSTALL ON BODY
|
|
38
|
+
|
|
39
|
+
const $$ = document.querySelector('html')
|
|
40
|
+
|
|
41
|
+
if( !$( $$ ) ){
|
|
42
|
+
|
|
43
|
+
console.error('You need the primary node tag on your app')
|
|
44
|
+
|
|
45
|
+
}else{
|
|
46
|
+
|
|
47
|
+
$$.dphelper = {
|
|
48
|
+
test: ()=> console.log('test')
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
// setTimeout( async ()=> {
|
|
52
|
+
// console.log( $( $$ ) )
|
|
53
|
+
// $$.dphelper.test()
|
|
54
|
+
// },2000)
|
|
55
|
+
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
///////////////////////////////////////////////////////////////////////////////
|
|
59
|
+
// LOAD ALL SCRIPT AUTOMATICALLY
|
|
60
|
+
|
|
61
|
+
const importAll = ( cntx ) => {
|
|
62
|
+
cntx.keys().forEach(
|
|
63
|
+
( key ) => (
|
|
64
|
+
cache[ key ] = cntx( key )
|
|
65
|
+
)
|
|
66
|
+
);
|
|
67
|
+
};
|
|
68
|
+
var cntx = require.context( __dirname + '/scripts/', false , /\.js$/ );
|
|
69
|
+
importAll( cntx );
|
|
70
|
+
|
|
71
|
+
///////////////////////////////////////////////////////////////////////////////
|
|
72
|
+
// FIRST MESSAGE
|
|
73
|
+
|
|
74
|
+
console.groupCollapsed( `%c${pjson.name} v${pjson.version}%c`,"color:orange","" );
|
|
75
|
+
console.debug( `%c${pjson.name} v${pjson.version}%c by Dario Passariello started`,"color:orange","" );
|
|
76
|
+
console.debug( `%cType ${pjson.name} in this console to see it`, "color:gray","" );
|
|
77
|
+
console.debug( "%cFor help visit: " + pjson.repository.help, "color:gray","" );
|
|
78
|
+
console.debug( 'name: %c' + pjson.name,"color:orange","" );
|
|
79
|
+
console.debug( 'version: %c' + pjson.version,"color:orange","" );
|
|
80
|
+
console.debug( 'description: %c' + pjson.description,"color:orange","" );
|
|
81
|
+
console.debug( 'license: %c' + pjson.license,"color:orange","" );
|
|
82
|
+
console.debug( 'repository: %c' + pjson.repository.url,"color:orange","" );
|
|
83
|
+
console.debug( 'author: %c' + pjson.author.name,"color:orange","" );
|
|
84
|
+
console.debug( 'email: %c' + pjson.author.email,"color:orange","" );
|
|
85
|
+
console.groupEnd();
|
|
86
|
+
|
|
87
|
+
})();
|
package/jest.config.js
ADDED
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
module.exports = {
|
|
2
|
+
|
|
3
|
+
verbose: true,
|
|
4
|
+
|
|
5
|
+
testEnvironmentOptions: { url: "http://localhost/" },
|
|
6
|
+
|
|
7
|
+
automock: false,
|
|
8
|
+
|
|
9
|
+
collectCoverage: true,
|
|
10
|
+
|
|
11
|
+
"transform": {
|
|
12
|
+
"\\.tsx$": "<rootDir>/node_modules/babel-jest"
|
|
13
|
+
},
|
|
14
|
+
|
|
15
|
+
setupFilesAfterEnv: [
|
|
16
|
+
"./tests/setupJest.tsx"
|
|
17
|
+
],
|
|
18
|
+
|
|
19
|
+
moduleNameMapper: {
|
|
20
|
+
"\\.(jpg|jpeg|png|gif|eot|otf|webp|ttf|woff|woff2|mp4|webm|wav|mp3|m4a|aac|oga|html)$": "<rootDir>/__mocks__/fileMock.js",
|
|
21
|
+
"\\.(css|scss|svg)$": "identity-obj-proxy"
|
|
22
|
+
},
|
|
23
|
+
|
|
24
|
+
moduleFileExtensions: [
|
|
25
|
+
"js",
|
|
26
|
+
"jsx",
|
|
27
|
+
"ts",
|
|
28
|
+
"tsx"
|
|
29
|
+
],
|
|
30
|
+
|
|
31
|
+
transformIgnorePatterns: [
|
|
32
|
+
"/node_modules/",
|
|
33
|
+
"/node_modules/(?!(nrg-common)/)"
|
|
34
|
+
],
|
|
35
|
+
|
|
36
|
+
coveragePathIgnorePatterns: [
|
|
37
|
+
"/node_modules/",
|
|
38
|
+
"/node_modules/(?!(nrg-common)/)"
|
|
39
|
+
],
|
|
40
|
+
|
|
41
|
+
modulePathIgnorePatterns: [
|
|
42
|
+
"/node_modules/",
|
|
43
|
+
"/node_modules/(?!(nrg-common)/)"
|
|
44
|
+
],
|
|
45
|
+
|
|
46
|
+
unmockedModulePathPatterns: [
|
|
47
|
+
"./node_modules/react/",
|
|
48
|
+
"./node_modules/react-dom/"
|
|
49
|
+
],
|
|
50
|
+
|
|
51
|
+
coverageReporters: [
|
|
52
|
+
"json",
|
|
53
|
+
"lcov",
|
|
54
|
+
"text"
|
|
55
|
+
],
|
|
56
|
+
|
|
57
|
+
snapshotSerializers: [
|
|
58
|
+
"enzyme-to-json/serializer"
|
|
59
|
+
],
|
|
60
|
+
|
|
61
|
+
// transformIgnorePatterns: [
|
|
62
|
+
// "node_modules/enzyme"
|
|
63
|
+
// ],
|
|
64
|
+
|
|
65
|
+
testPathIgnorePatterns: [
|
|
66
|
+
"/node_modules/",
|
|
67
|
+
],
|
|
68
|
+
|
|
69
|
+
unmockedModulePathPatterns: [
|
|
70
|
+
"react",
|
|
71
|
+
"react-dom",
|
|
72
|
+
"react-native",
|
|
73
|
+
"react-addons-test-utils",
|
|
74
|
+
"promise",
|
|
75
|
+
"source-map",
|
|
76
|
+
"enzyme"
|
|
77
|
+
]
|
|
78
|
+
|
|
79
|
+
};
|
|
80
|
+
|
|
81
|
+
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
const moment = require('moment');
|
|
2
|
+
const execSync = require('child_process').execSync;
|
|
3
|
+
const dateTime = moment().format('YYYYMMDDHHmmss');
|
|
4
|
+
const pjson = require('../package.json');
|
|
5
|
+
|
|
6
|
+
//https://stackoverflow.com/questions/55021363/how-to-pass-current-datetime-in-npm-script-for-git-commit-message-in-windows-and
|
|
7
|
+
execSync(`git tag \"v${pjson.version}\" -am \"Modify content\" && git push --tags`, { stdio: [0, 1, 2]} );
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
const moment = require('moment');
|
|
2
|
+
const execSync = require('child_process').execSync;
|
|
3
|
+
const dateTime = moment().format('YYYYMMDDHHmmss');
|
|
4
|
+
const pjson = require('../package.json');
|
|
5
|
+
|
|
6
|
+
//https://stackoverflow.com/questions/55021363/how-to-pass-current-datetime-in-npm-script-for-git-commit-message-in-windows-and
|
|
7
|
+
execSync(`cd .. && git add . && git commit -m \"ver. ${pjson.version} / ${dateTime}\" && git pull && git push --all`, { stdio: [0, 1, 2]} );
|
package/node/goLive.js
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
const moment = require('moment');
|
|
2
|
+
const execSync = require('child_process').execSync;
|
|
3
|
+
const dateTime = moment().format('YYYYMMDDHHmmss');
|
|
4
|
+
const pjson = require('../package.json');
|
|
5
|
+
|
|
6
|
+
//https://stackoverflow.com/questions/55021363/how-to-pass-current-datetime-in-npm-script-for-git-commit-message-in-windows-and
|
|
7
|
+
execSync(`cli-confirm \"Do you want go live?\" && npm version patch --force && cd.. && webpack --progress --color --mode production --config webpack.config.js && cd dist && npm publish`, { stdio: [0, 1, 2]} );
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dphelper",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.89",
|
|
4
4
|
"description": "Developer Tools",
|
|
5
5
|
"deprecated": false,
|
|
6
6
|
"appCode": "dphelper",
|
|
@@ -92,7 +92,7 @@
|
|
|
92
92
|
"eslint": "8.16.0",
|
|
93
93
|
"file-loader": "6.2.0",
|
|
94
94
|
"jest": "27.5.1",
|
|
95
|
-
"less-loader": "
|
|
95
|
+
"less-loader": "11.0.0",
|
|
96
96
|
"sass-loader": "13.0.0",
|
|
97
97
|
"style-loader": "3.3.1",
|
|
98
98
|
"webpack-cli": "4.9.2"
|
|
@@ -101,7 +101,7 @@
|
|
|
101
101
|
"@babel/plugin-proposal-class-properties": "7.17.12",
|
|
102
102
|
"@babel/preset-env": "7.18.0",
|
|
103
103
|
"@babel/preset-react": "7.17.12",
|
|
104
|
-
"@babel/preset-typescript": "7.
|
|
104
|
+
"@babel/preset-typescript": "7.18.6",
|
|
105
105
|
"@testing-library/jest-dom": "^5.16.2",
|
|
106
106
|
"@testing-library/user-event": "^14.0.0",
|
|
107
107
|
"@types/enzyme-adapter-react-16": "1.0.6",
|
|
@@ -110,7 +110,7 @@
|
|
|
110
110
|
"classnames": "2.3.1",
|
|
111
111
|
"cli-confirm": "1.0.1",
|
|
112
112
|
"compression-webpack-plugin": "10.0.0",
|
|
113
|
-
"concurrently": "7.2.
|
|
113
|
+
"concurrently": "7.2.2",
|
|
114
114
|
"copy-webpack-plugin": "11.0.0",
|
|
115
115
|
"css": "3.0.0",
|
|
116
116
|
"dotenv": "16.0.1",
|
|
@@ -123,13 +123,13 @@
|
|
|
123
123
|
"jsdom-worker": "0.2.1",
|
|
124
124
|
"jshint": "^2.13.4",
|
|
125
125
|
"less": "4.1.2",
|
|
126
|
-
"moment": "2.29.
|
|
126
|
+
"moment": "2.29.4",
|
|
127
127
|
"path": "0.12.7",
|
|
128
128
|
"progress-bar-webpack-plugin": "2.1.0",
|
|
129
129
|
"react": "18.1.0",
|
|
130
|
-
"react-dom": "18.
|
|
130
|
+
"react-dom": "18.1.0",
|
|
131
131
|
"require": "2.4.20",
|
|
132
|
-
"sass": "1.
|
|
132
|
+
"sass": "1.53.0",
|
|
133
133
|
"socket.io-client": "4.5.1",
|
|
134
134
|
"ts-jest": "27.1.4",
|
|
135
135
|
"tslint": "6.1.3",
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
@@ -0,0 +1,48 @@
|
|
|
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" : "Import",
|
|
11
|
+
"description" : "Import files by type from folder",
|
|
12
|
+
"version" : "0.0.1",
|
|
13
|
+
"command" : "cormat",
|
|
14
|
+
// "subCommand" : [
|
|
15
|
+
// {
|
|
16
|
+
// "name":"all",
|
|
17
|
+
// "description":"Import all file by type from folder"
|
|
18
|
+
// }
|
|
19
|
+
// ],
|
|
20
|
+
"example" : "dphelper.import.all( __dirname + '/scripts/', false , /\.js$/ )",
|
|
21
|
+
"author" : "Dario Passariello",
|
|
22
|
+
"active" : true
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
dphelper._list.scripts.push( description );
|
|
26
|
+
|
|
27
|
+
/***********************************************************************/
|
|
28
|
+
|
|
29
|
+
dphelper.import = {
|
|
30
|
+
|
|
31
|
+
// all: ( path ='' , mode = false , extension ='/\.js$/' ) => {
|
|
32
|
+
|
|
33
|
+
// // example: dphelper.import.all( __dirname + '/scripts/', false , /\.js$/ )
|
|
34
|
+
|
|
35
|
+
// const importAll = ( cntx ) => {
|
|
36
|
+
// cntx.keys().forEach(
|
|
37
|
+
// ( key ) => (
|
|
38
|
+
// cache[ key ] = cntx( key )
|
|
39
|
+
// )
|
|
40
|
+
// );
|
|
41
|
+
// };
|
|
42
|
+
|
|
43
|
+
// var cntx = require.context( path , mode , extension );
|
|
44
|
+
// importAll( cntx );
|
|
45
|
+
|
|
46
|
+
// }
|
|
47
|
+
|
|
48
|
+
}
|
|
@@ -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,73 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
dpHelper
|
|
3
|
+
Copyright (c) 2021 Dario Passariello <dariopassariello@gmail.com>
|
|
4
|
+
Licensed under the Apache-2.0, see
|
|
5
|
+
https://dario.passariello.ca
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
/***********************************************************************/
|
|
9
|
+
|
|
10
|
+
var description = {
|
|
11
|
+
"name" : "Anchor",
|
|
12
|
+
"type" : "function",
|
|
13
|
+
"version" : "0.0.1",
|
|
14
|
+
"command" : "anchor",
|
|
15
|
+
"example" : "",
|
|
16
|
+
"author" : "Dario Passariello",
|
|
17
|
+
"creationDate" : "20110101",
|
|
18
|
+
"lastMod" : "20110101",
|
|
19
|
+
"active" : true,
|
|
20
|
+
"description" : `
|
|
21
|
+
This tools allows you to convert all links in an element to 'onclick'.
|
|
22
|
+
It allows you to avoid the message with the path relative to the requested address
|
|
23
|
+
and it is very useful when you work with SPA but you want to keep even older browsers.`,
|
|
24
|
+
"subCommand" : [
|
|
25
|
+
{
|
|
26
|
+
"name":"toOnClick",
|
|
27
|
+
"version" : "0.0.1",
|
|
28
|
+
"example" : "dphelper.anchor.toOnClick('nav') or ('.foo') or ('#foo')",
|
|
29
|
+
"type" : "function",
|
|
30
|
+
"active": true,
|
|
31
|
+
"description":"test",
|
|
32
|
+
"subCommand" : []
|
|
33
|
+
}
|
|
34
|
+
],
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
dphelper._list.scripts.push( description );
|
|
38
|
+
|
|
39
|
+
/***********************************************************************/
|
|
40
|
+
|
|
41
|
+
dphelper.anchor ={
|
|
42
|
+
|
|
43
|
+
toOnClick: ( el ) => {
|
|
44
|
+
|
|
45
|
+
$( el + ' a' ).each( function( index ) {
|
|
46
|
+
let elem = $( this );
|
|
47
|
+
let href = elem.attr( 'href' );
|
|
48
|
+
|
|
49
|
+
if( href ){
|
|
50
|
+
elem
|
|
51
|
+
.on( 'mouseup', function(){
|
|
52
|
+
Loader( 'body' , null );
|
|
53
|
+
})
|
|
54
|
+
.css('cursor','pointer')
|
|
55
|
+
.addClass( dphelper.pathRail()[3].replace(/\//g, '') )
|
|
56
|
+
.removeAttr( 'href' )
|
|
57
|
+
.on( 'click', function(){
|
|
58
|
+
dphelper.browser.href( href );
|
|
59
|
+
dphelper.browser.push( '', '', href );
|
|
60
|
+
});
|
|
61
|
+
}
|
|
62
|
+
});
|
|
63
|
+
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
};
|
|
67
|
+
|
|
68
|
+
Object.defineProperty( dphelper, 'anchor', {
|
|
69
|
+
writable: false,
|
|
70
|
+
configurable: false
|
|
71
|
+
});
|
|
72
|
+
|
|
73
|
+
//console.log( Object.getOwnPropertyDescriptor( dphelper, 'socket' ) )
|