dphelper 0.2.89 → 0.2.93
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/{LICENSE.txt → LICENSE.md} +0 -0
- package/README.md +6 -0
- package/index.js +2 -12
- package/package.json +130 -136
- package/.editorconfig +0 -13
- package/.env +0 -3
- package/.eslintignore +0 -13
- package/.eslintrc.json +0 -87
- package/.eslintrc.legacy.json +0 -91
- package/.gitattributes +0 -2
- package/.github/FUNDING.yml +0 -12
- package/.github/dependabot.yml +0 -12
- package/.hintrc +0 -11
- package/.jsbeautifyrc +0 -25
- package/.jshintrc +0 -16
- package/.prettierignore +0 -2
- package/.prettierrc.json +0 -8
- package/.stylelintignore +0 -0
- package/.stylelintrc.json +0 -468
- package/.vscode/launch.json +0 -34
- package/.vscode/settings.json +0 -58
- package/3party/shortcut.js +0 -224
- package/CHANGELOG.txt +0 -4
- package/SECURITY.md +0 -3
- package/__mocks__/fileMock.js +0 -3
- package/__mocks__/styleMock.js +0 -3
- package/babel.config.js +0 -30
- package/backup.bat +0 -43
- package/coverage/coverage-final.json +0 -1
- package/coverage/lcov-report/base.css +0 -224
- package/coverage/lcov-report/block-navigation.js +0 -87
- package/coverage/lcov-report/favicon.png +0 -0
- package/coverage/lcov-report/index.html +0 -101
- package/coverage/lcov-report/prettify.css +0 -1
- package/coverage/lcov-report/prettify.js +0 -2
- package/coverage/lcov-report/sort-arrow-sprite.png +0 -0
- package/coverage/lcov-report/sorter.js +0 -196
- package/coverage/lcov.info +0 -0
- package/data/list.json +0 -19
- package/dist/LICENSE.txt +0 -209
- package/dist/README.md +0 -79
- package/elements/button/component.js +0 -0
- package/elements/code/component.js +0 -0
- package/elements/costants.tsx +0 -13
- package/elements/fieldset/component.js +0 -0
- package/elements/input/checkbox/component.js +0 -0
- package/elements/input/date/component.js +0 -27
- 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 +0 -33
- package/elements/x-foo/namespace.d.ts +0 -7
- package/init.js +0 -87
- package/jest.config.js +0 -81
- package/node/createTag.js +0 -7
- package/node/gitDeploy.js +0 -7
- package/node/goLive.js +0 -7
- package/public/assets/images/banner.png +0 -0
- package/public/assets/logos/logo.svg +0 -64
- package/public/documents/iDB/list.html +0 -11
- package/public/documents/iDB/toState.html +0 -11
- package/scripts/.OLD/import.js +0 -48
- package/scripts/.OLD/onBeforeUnLoad.js +0 -120
- package/scripts/.OLD/purge.js +0 -53
- package/scripts/.OLD/string.js +0 -27
- package/scripts/anchor.js +0 -73
- package/scripts/array.js +0 -203
- package/scripts/avoid.js +0 -48
- package/scripts/browser.js +0 -100
- package/scripts/color.js +0 -121
- package/scripts/console.js +0 -97
- package/scripts/console.mapped.js +0 -160
- package/scripts/coods.js +0 -57
- package/scripts/cookie.js +0 -105
- package/scripts/date.js +0 -179
- package/scripts/disable.js +0 -91
- package/scripts/errors.js +0 -3
- package/scripts/event.js +0 -57
- package/scripts/font.js +0 -60
- package/scripts/form.js +0 -211
- package/scripts/format.js +0 -71
- package/scripts/function.js +0 -55
- package/scripts/iDB.js +0 -688
- package/scripts/json.js +0 -84
- package/scripts/load.js +0 -112
- package/scripts/math.js +0 -100
- package/scripts/obj.js +0 -118
- package/scripts/path.js +0 -101
- package/scripts/promise.js +0 -56
- package/scripts/screen.js +0 -82
- package/scripts/scrollbar.js +0 -293
- package/scripts/shortcut.js +0 -83
- package/scripts/socket.js +0 -184
- package/scripts/state.js +0 -87
- package/scripts/storage.js +0 -93
- package/scripts/store.js +0 -115
- package/scripts/svg.js +0 -380
- package/scripts/text.js +0 -116
- package/scripts/time.js +0 -43
- package/scripts/timer.js +0 -54
- package/scripts/tool.js +0 -73
- package/scripts/trigger.js +0 -57
- package/scripts/type.js +0 -76
- package/scripts/ui.js +0 -41
- package/scripts/window.js +0 -244
- package/styles/console.less +0 -95
- package/tests/setupJest.tsx +0 -4
- package/typings/.OLD/cordova.d.ts +0 -12
- package/typings/.OLD/layerpro.d.ts +0 -20
- package/typings/.OLD/menupro.d.ts +0 -20
- package/typings/dphelper.d.ts +0 -26
- package/typings/image.d.ts +0 -5
- package/typings/styles.d.ts +0 -23
- package/webpack.config.js +0 -249
|
@@ -1,160 +0,0 @@
|
|
|
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
|
-
dphelper.console.debug = function( parentDom ){
|
|
11
|
-
|
|
12
|
-
//parent must be content
|
|
13
|
-
if( !parentDom ) throw Error( "Parent dom element required!" );
|
|
14
|
-
|
|
15
|
-
//Private fields
|
|
16
|
-
var _keysMapped = false;
|
|
17
|
-
var _oldLog = console.log;
|
|
18
|
-
var _oldInfo = console.info;
|
|
19
|
-
var _oldWarn = console.warn;
|
|
20
|
-
var _oldErr = console.error;
|
|
21
|
-
|
|
22
|
-
var _appendToDomElement = function( type ){
|
|
23
|
-
var args = Array.prototype.slice.call( arguments[ 1 ] ).join( " " );
|
|
24
|
-
if( type === TYPE.WARN ) args = "<font color=\"#FF6600\">* WARN: " + args;
|
|
25
|
-
else if( type === TYPE.ERR ) args = "<font color=\"#FF0000\">* ERR: " + args;
|
|
26
|
-
else args = "* " + args;
|
|
27
|
-
|
|
28
|
-
this.domElement.innerHTML += args + "<br/>";
|
|
29
|
-
if( this.autoScroll && this.visible ) this.domElement.scrollTop = this.domElement.scrollHeight;
|
|
30
|
-
};
|
|
31
|
-
|
|
32
|
-
var TYPE = {
|
|
33
|
-
LOG: 0,
|
|
34
|
-
INFO: 1,
|
|
35
|
-
WARN: 2,
|
|
36
|
-
ERR: 3
|
|
37
|
-
};
|
|
38
|
-
|
|
39
|
-
this.autoScroll = true;
|
|
40
|
-
|
|
41
|
-
//Disable all logging features, both this console and globally.
|
|
42
|
-
this.disableConsoleLogging = false;
|
|
43
|
-
|
|
44
|
-
//Create the element
|
|
45
|
-
var domElement = document.createElement( 'div' );
|
|
46
|
-
domElement.id = 'debugConsole';
|
|
47
|
-
|
|
48
|
-
parentDom.appendChild( domElement );
|
|
49
|
-
this.domElement = domElement;
|
|
50
|
-
|
|
51
|
-
this.initKeyMappings = function(){
|
|
52
|
-
|
|
53
|
-
if( _keysMapped ){
|
|
54
|
-
console.warn( 'DebugConsole: keys already mapped!' );
|
|
55
|
-
return;
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
dphelper.state( "toggle_console", ( function(){ this.visible = !this.visible; } ).bind( this ) );
|
|
59
|
-
_keysMapped = true;
|
|
60
|
-
};
|
|
61
|
-
|
|
62
|
-
// overrideConsole the standard console, by monkey-patching it.
|
|
63
|
-
this.overrideConsole = function(){
|
|
64
|
-
//console.log('123');
|
|
65
|
-
|
|
66
|
-
console.log = ( function(){
|
|
67
|
-
if( this.disableConsoleLogging ) return;
|
|
68
|
-
|
|
69
|
-
_appendToDomElement.call( this, TYPE.LOG, arguments );
|
|
70
|
-
_oldLog.apply( console, arguments );
|
|
71
|
-
} ).bind( this );
|
|
72
|
-
|
|
73
|
-
console.info = ( function(){
|
|
74
|
-
if( dphelper.state.disableConsoleLogging ) return;
|
|
75
|
-
|
|
76
|
-
_appendToDomElement.call( this, TYPE.INFO, arguments );
|
|
77
|
-
_oldInfo.apply( console, arguments );
|
|
78
|
-
} ).bind( this );
|
|
79
|
-
|
|
80
|
-
console.warn = ( function(){
|
|
81
|
-
if( dphelper.state.disableConsoleLogging ) return;
|
|
82
|
-
|
|
83
|
-
_appendToDomElement.call( this, TYPE.WARN, arguments );
|
|
84
|
-
_oldWarn.apply( console, arguments );
|
|
85
|
-
} ).bind( this );
|
|
86
|
-
|
|
87
|
-
console.error = ( function(){
|
|
88
|
-
if( dphelper.state.disableConsoleLogging ) return;
|
|
89
|
-
|
|
90
|
-
_appendToDomElement.call( this, TYPE.ERR, arguments );
|
|
91
|
-
_oldErr.apply( console, arguments );
|
|
92
|
-
} ).bind( this );
|
|
93
|
-
|
|
94
|
-
//onError handler
|
|
95
|
-
window.onerror = function( errorMsg, url, lineNumber ){
|
|
96
|
-
var msg = [
|
|
97
|
-
errorMsg,
|
|
98
|
-
" in <a href='",
|
|
99
|
-
url,
|
|
100
|
-
"' target='_blank'>",
|
|
101
|
-
url.split( '/' ).pop(),
|
|
102
|
-
"</a>:",
|
|
103
|
-
lineNumber
|
|
104
|
-
];
|
|
105
|
-
|
|
106
|
-
console.error( msg.join( '' ) );
|
|
107
|
-
return false;
|
|
108
|
-
};
|
|
109
|
-
};
|
|
110
|
-
|
|
111
|
-
this.overrideConsole();
|
|
112
|
-
|
|
113
|
-
// Clear the log history
|
|
114
|
-
this.clear = function(){
|
|
115
|
-
this.domElement.innerHTML = '';
|
|
116
|
-
};
|
|
117
|
-
|
|
118
|
-
// Public properties
|
|
119
|
-
Object.defineProperties(
|
|
120
|
-
this, {
|
|
121
|
-
"visible": {
|
|
122
|
-
"get": function() { return this.domElement.style.display === ''; },
|
|
123
|
-
"set": function( value )
|
|
124
|
-
{
|
|
125
|
-
if( value ){
|
|
126
|
-
this.domElement.style.display = '';
|
|
127
|
-
if( this.autoScroll ) this.domElement.scrollTop = this.domElement.scrollHeight;
|
|
128
|
-
} else this.domElement.style.display = 'none';
|
|
129
|
-
},
|
|
130
|
-
configurable: true
|
|
131
|
-
},
|
|
132
|
-
// "top": {
|
|
133
|
-
// "get": function() { return this.domElement.style.top; },
|
|
134
|
-
// "set": function( value ) { this.domElement.style.top = value; }
|
|
135
|
-
// },
|
|
136
|
-
// "left": {
|
|
137
|
-
// "get": function() { return this.domElement.style.left; },
|
|
138
|
-
// "set": function( value ) { this.domElement.style.left = value; }
|
|
139
|
-
// },
|
|
140
|
-
// "bottom": {
|
|
141
|
-
// "get": function() { return this.domElement.style.bottom; },
|
|
142
|
-
// "set": function( value ) { this.domElement.style.bottom = value; }
|
|
143
|
-
// },
|
|
144
|
-
// "right": {
|
|
145
|
-
// "get": function() { return this.domElement.style.right; },
|
|
146
|
-
// "set": function( value ) { this.domElement.style.right = value; }
|
|
147
|
-
// },
|
|
148
|
-
// "width": {
|
|
149
|
-
// "get": function() { return this.domElement.style.width; },
|
|
150
|
-
// "set": function( value ) { this.domElement.style.width = value; }
|
|
151
|
-
// },
|
|
152
|
-
// "height": {
|
|
153
|
-
// "get": function() { return this.domElement.style.height; },
|
|
154
|
-
// "set": function( value ) { this.domElement.style.height = value; }
|
|
155
|
-
// }
|
|
156
|
-
|
|
157
|
-
}
|
|
158
|
-
);
|
|
159
|
-
|
|
160
|
-
};
|
package/scripts/coods.js
DELETED
|
@@ -1,57 +0,0 @@
|
|
|
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" : "Coords",
|
|
12
|
-
"description" : "",
|
|
13
|
-
"version" : "0.0.1",
|
|
14
|
-
"command" : "coords",
|
|
15
|
-
"subCommand" : [
|
|
16
|
-
{
|
|
17
|
-
"name":"degreesToRadians",
|
|
18
|
-
"description":"test",
|
|
19
|
-
},{
|
|
20
|
-
"name":"latToMeters",
|
|
21
|
-
"description":"test",
|
|
22
|
-
}
|
|
23
|
-
],
|
|
24
|
-
"example" : "",
|
|
25
|
-
"author" : "Dario Passariello",
|
|
26
|
-
"active" : true
|
|
27
|
-
};
|
|
28
|
-
|
|
29
|
-
dphelper._list.scripts.push( description );
|
|
30
|
-
|
|
31
|
-
/***********************************************************************/
|
|
32
|
-
//
|
|
33
|
-
|
|
34
|
-
let R = 6378.1;
|
|
35
|
-
dphelper.coords = {
|
|
36
|
-
|
|
37
|
-
degreesToRadians: ( degrees ) => {
|
|
38
|
-
var pi = Math.PI;
|
|
39
|
-
return degrees * (pi/180);
|
|
40
|
-
},
|
|
41
|
-
|
|
42
|
-
latToMeters: ( latitude , longitude ) => {
|
|
43
|
-
return R * Math.cos(latitude) * Math.cos(longitude);
|
|
44
|
-
},
|
|
45
|
-
|
|
46
|
-
lngToMeters: ( latitude , longitude ) => {
|
|
47
|
-
return R * Math.cos(latitude) * Math.sin(longitude);
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
};
|
|
51
|
-
|
|
52
|
-
Object.defineProperty( dphelper, 'coords', {
|
|
53
|
-
writable: false,
|
|
54
|
-
configurable: false
|
|
55
|
-
});
|
|
56
|
-
|
|
57
|
-
//console.log( Object.getOwnPropertyDescriptor( dphelper, 'socket' ) )
|
package/scripts/cookie.js
DELETED
|
@@ -1,105 +0,0 @@
|
|
|
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" : "Cookie",
|
|
12
|
-
"description" : "",
|
|
13
|
-
"version" : "0.0.1",
|
|
14
|
-
"command" : "cookie",
|
|
15
|
-
"subCommand" : [
|
|
16
|
-
{
|
|
17
|
-
"name":"set",
|
|
18
|
-
"description":"test"
|
|
19
|
-
},{
|
|
20
|
-
"name":"get",
|
|
21
|
-
"description":"test"
|
|
22
|
-
},{
|
|
23
|
-
"name":"delete",
|
|
24
|
-
"description":"test"
|
|
25
|
-
},{
|
|
26
|
-
"name":"clearAll",
|
|
27
|
-
"description":"test"
|
|
28
|
-
}
|
|
29
|
-
],
|
|
30
|
-
"example" : "",
|
|
31
|
-
"author" : "Dario Passariello",
|
|
32
|
-
"active" : true
|
|
33
|
-
};
|
|
34
|
-
|
|
35
|
-
dphelper._list.scripts.push( description );
|
|
36
|
-
|
|
37
|
-
/***********************************************************************/
|
|
38
|
-
|
|
39
|
-
var CookieType = "Lax";
|
|
40
|
-
var CookieSecure = "false";
|
|
41
|
-
var CookieSameSite = "false";
|
|
42
|
-
|
|
43
|
-
if (location.protocol === 'https:') {
|
|
44
|
-
CookieSecure = "Secure";
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
dphelper.cookie = {
|
|
48
|
-
|
|
49
|
-
// CREATE THE COOKIE
|
|
50
|
-
|
|
51
|
-
set: ( cname , value , time , path = '/' ) => {
|
|
52
|
-
var d = new Date();
|
|
53
|
-
d.setTime( d.getTime() + 3600 * 1000 * 24 * 365 );
|
|
54
|
-
|
|
55
|
-
if( !time ) time = d.toGMTString();
|
|
56
|
-
if( cname ){
|
|
57
|
-
document.cookie = cname + '=' + value + ';expires=' + time + ';path=' + path + ';SameSite=' + CookieSameSite + ';requireSSL='+ CookieSecure +';' + CookieSecure;
|
|
58
|
-
}
|
|
59
|
-
},
|
|
60
|
-
|
|
61
|
-
// GET THE COOKIE
|
|
62
|
-
|
|
63
|
-
get: ( cname ) => {
|
|
64
|
-
var asCookies = document.cookie.split( "; " );
|
|
65
|
-
|
|
66
|
-
for ( var i = 0; i < asCookies.length; i++ ){
|
|
67
|
-
var asCookie = asCookies[ i ].split( "=" );
|
|
68
|
-
if ( cname === asCookie[0] ) return ( unescape( asCookie[1] ) );
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
return null;
|
|
72
|
-
},
|
|
73
|
-
|
|
74
|
-
// DELETE THE COOKIE
|
|
75
|
-
|
|
76
|
-
delete: ( cname ) => {
|
|
77
|
-
document.cookie = cname + '=;expires=Thu, 01 Jan 1970 00:00:01 GMT;path=/;SameSite=' + CookieSameSite + ';requireSSL='+ CookieSecure +';' + CookieSecure;
|
|
78
|
-
},
|
|
79
|
-
|
|
80
|
-
// CLEAR ALL COOKIE
|
|
81
|
-
|
|
82
|
-
clearAll: () => {
|
|
83
|
-
var cookies = document.cookie.split(";");
|
|
84
|
-
|
|
85
|
-
for ( var i = 0; i < cookies.length; i++ ) {
|
|
86
|
-
|
|
87
|
-
var cookie = cookies[i];
|
|
88
|
-
var eqPos = cookie.indexOf("=");
|
|
89
|
-
var cname = eqPos > -1 ? cookie.slice( 0 , eqPos ) : cookie;
|
|
90
|
-
stpro.cookie.delete( cname );
|
|
91
|
-
|
|
92
|
-
}
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
};
|
|
96
|
-
|
|
97
|
-
// START COOKIE DB
|
|
98
|
-
// dphelper.cookie.set( "dpHelper", 'active' );
|
|
99
|
-
|
|
100
|
-
Object.defineProperty( dphelper, 'cookie', {
|
|
101
|
-
writable: false,
|
|
102
|
-
configurable: false
|
|
103
|
-
});
|
|
104
|
-
|
|
105
|
-
//console.log( Object.getOwnPropertyDescriptor( dphelper, 'socket' ) )
|
package/scripts/date.js
DELETED
|
@@ -1,179 +0,0 @@
|
|
|
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" : "Date",
|
|
12
|
-
"description" : "",
|
|
13
|
-
"version" : "0.0.1",
|
|
14
|
-
"command" : "date",
|
|
15
|
-
"subCommand" : [
|
|
16
|
-
{
|
|
17
|
-
"name":"toIso",
|
|
18
|
-
"description":"test"
|
|
19
|
-
},{
|
|
20
|
-
"name":"toMMDDYYYY",
|
|
21
|
-
"description":"test"
|
|
22
|
-
},{
|
|
23
|
-
"name":"convert",
|
|
24
|
-
"description":"test"
|
|
25
|
-
},{
|
|
26
|
-
"name":"iso2Epoch",
|
|
27
|
-
"description":"test"
|
|
28
|
-
},{
|
|
29
|
-
"name":"localIsoTime",
|
|
30
|
-
"description":"test"
|
|
31
|
-
},{
|
|
32
|
-
"name":"utc",
|
|
33
|
-
"description":"test"
|
|
34
|
-
},{
|
|
35
|
-
"name":"parse",
|
|
36
|
-
"description":"test"
|
|
37
|
-
},{
|
|
38
|
-
"name":"year",
|
|
39
|
-
"description":"actual year"
|
|
40
|
-
},{
|
|
41
|
-
"name":"addDays",
|
|
42
|
-
"description":"actual year"
|
|
43
|
-
},{
|
|
44
|
-
"name":"dateTimeToString",
|
|
45
|
-
"description":"actual year"
|
|
46
|
-
},{
|
|
47
|
-
"name":"datePickerFormat",
|
|
48
|
-
"description":"actual year"
|
|
49
|
-
},{
|
|
50
|
-
"name":"isoToHuman",
|
|
51
|
-
"description":"actual year"
|
|
52
|
-
},
|
|
53
|
-
],
|
|
54
|
-
"example" : "",
|
|
55
|
-
"author" : "Dario Passariello",
|
|
56
|
-
"active" : true
|
|
57
|
-
};
|
|
58
|
-
|
|
59
|
-
dphelper._list.scripts.push( description );
|
|
60
|
-
|
|
61
|
-
/***********************************************************************/
|
|
62
|
-
|
|
63
|
-
dphelper.date = {
|
|
64
|
-
|
|
65
|
-
toIso: (value , int = 'en' ) => {
|
|
66
|
-
if (!value) value = '';
|
|
67
|
-
let date = new Date(value);
|
|
68
|
-
if (date == 'Invalid Date') return null; //date = new Date()
|
|
69
|
-
const dateTimeFormat = new Intl.DateTimeFormat( int , {
|
|
70
|
-
year: 'numeric', month: 'long', day: 'numeric',
|
|
71
|
-
});
|
|
72
|
-
return dateTimeFormat.format(date);
|
|
73
|
-
},
|
|
74
|
-
|
|
75
|
-
toMMDDYYYY: (value) => {
|
|
76
|
-
if (!value) value = '';
|
|
77
|
-
let date = new Date(value);
|
|
78
|
-
return ('0' + (date.getMonth() + 1)).slice(-2) + "" + ('0' + date.getDate()).slice(-2) + "" + date.getFullYear();
|
|
79
|
-
},
|
|
80
|
-
|
|
81
|
-
convert: (value , format ) => {
|
|
82
|
-
if (!value) return null;
|
|
83
|
-
if( !format) format = ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"];
|
|
84
|
-
let month = value.substring(0, 2).replace('0', '');
|
|
85
|
-
let day = value.substring(2, 4);
|
|
86
|
-
let year = value.substring(value.length - 4);
|
|
87
|
-
return day + ' ' + format[Number(month) - 1] + ' ' + year;
|
|
88
|
-
},
|
|
89
|
-
|
|
90
|
-
iso2Epoch: (value) => {
|
|
91
|
-
if (!value) value = '';
|
|
92
|
-
let date = new Date(value);
|
|
93
|
-
let milliseconds = date.getTime();
|
|
94
|
-
return milliseconds;
|
|
95
|
-
},
|
|
96
|
-
|
|
97
|
-
localIsoTime: (value) => {
|
|
98
|
-
if (!value) value = '';
|
|
99
|
-
let tzoffset = (new Date(value)).getTimezoneOffset() * 60000;
|
|
100
|
-
let localISOTime = (new Date(Date.now() - tzoffset)).toISOString().slice(0, -1);
|
|
101
|
-
return localISOTime;
|
|
102
|
-
},
|
|
103
|
-
|
|
104
|
-
utc: () => {
|
|
105
|
-
return moment().toISOString();
|
|
106
|
-
},
|
|
107
|
-
|
|
108
|
-
parse: ( value , separator = '/' ) => {
|
|
109
|
-
if (!value) return null;
|
|
110
|
-
let month = value.substring(0, 2);
|
|
111
|
-
let day = value.substring(2, 4);
|
|
112
|
-
let year = value.substring(4, 8);
|
|
113
|
-
return month + separator + day + separator + year;
|
|
114
|
-
},
|
|
115
|
-
|
|
116
|
-
year: () => {
|
|
117
|
-
return /\d{4}/.exec(Date())[0];
|
|
118
|
-
},
|
|
119
|
-
|
|
120
|
-
addDays: (date, days) => {
|
|
121
|
-
const copy = new Date(Number(date))
|
|
122
|
-
copy.setDate(date.getDate() + days)
|
|
123
|
-
return copy
|
|
124
|
-
},
|
|
125
|
-
|
|
126
|
-
dateTimeToString: ( dateObject ) => {
|
|
127
|
-
try {
|
|
128
|
-
return `${dateObject.getFullYear()}${
|
|
129
|
-
dateObject.getMonth().toString().length > 1
|
|
130
|
-
? dateObject.getMonth() + 1
|
|
131
|
-
: `0${dateObject.getMonth() + 1}`
|
|
132
|
-
}${
|
|
133
|
-
dateObject.getDate().toString().length > 1 ? dateObject.getDate() : `0${dateObject.getDate()}`
|
|
134
|
-
}_${dateObject.getHours()}${dateObject.getMinutes()}${dateObject.getSeconds()}`
|
|
135
|
-
} catch (err) {
|
|
136
|
-
// todo: log errors
|
|
137
|
-
return dateObject
|
|
138
|
-
}
|
|
139
|
-
},
|
|
140
|
-
|
|
141
|
-
datePickerFormat: ( dateObject ) => {
|
|
142
|
-
try {
|
|
143
|
-
return `${dateObject.getFullYear()}-${
|
|
144
|
-
dateObject.getMonth().toString().length > 1
|
|
145
|
-
? dateObject.getMonth() + 1
|
|
146
|
-
: `0${dateObject.getMonth() + 1}`
|
|
147
|
-
}-${
|
|
148
|
-
dateObject.getDate().toString().length > 1 ? dateObject.getDate() : `0${dateObject.getDate()}`
|
|
149
|
-
}`
|
|
150
|
-
} catch (err) {
|
|
151
|
-
// todo: log errors
|
|
152
|
-
return dateObject
|
|
153
|
-
}
|
|
154
|
-
},
|
|
155
|
-
|
|
156
|
-
isoToHuman: ( value , symbol="@" ) => {
|
|
157
|
-
if(!value) return null;
|
|
158
|
-
var format = ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"];
|
|
159
|
-
var date = new Date( value );
|
|
160
|
-
var year = date.getFullYear();
|
|
161
|
-
var month = (date.getMonth()+1).toString();
|
|
162
|
-
var dt = date.getDate().toString();
|
|
163
|
-
var t = value.split("T")[1].split(":").slice(0, 2).join(':');
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
if (dt.length < 2 ) dt = '0' + dt;
|
|
167
|
-
if (month.length < 2) month = '0' + month;
|
|
168
|
-
|
|
169
|
-
return (dt +' ' + format[ Number(month)-1 ] + ' ' + year + " " + symbol + " " + t );
|
|
170
|
-
}
|
|
171
|
-
|
|
172
|
-
};
|
|
173
|
-
|
|
174
|
-
Object.defineProperty( dphelper, 'date', {
|
|
175
|
-
writable: false,
|
|
176
|
-
configurable: false
|
|
177
|
-
});
|
|
178
|
-
|
|
179
|
-
//console.log( Object.getOwnPropertyDescriptor( dphelper, 'socket' ) )
|
package/scripts/disable.js
DELETED
|
@@ -1,91 +0,0 @@
|
|
|
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" : "Disable",
|
|
12
|
-
"description" : "",
|
|
13
|
-
"version" : "0.0.1",
|
|
14
|
-
"command" : "disable",
|
|
15
|
-
"subCommand" : [
|
|
16
|
-
{
|
|
17
|
-
"name":"select",
|
|
18
|
-
"description":"test"
|
|
19
|
-
},{
|
|
20
|
-
"name":"spellCheck",
|
|
21
|
-
"description":"test"
|
|
22
|
-
}
|
|
23
|
-
],
|
|
24
|
-
"example" : "",
|
|
25
|
-
"author" : "Dario Passariello",
|
|
26
|
-
"active" : true
|
|
27
|
-
};
|
|
28
|
-
|
|
29
|
-
dphelper._list.scripts.push( description );
|
|
30
|
-
|
|
31
|
-
/***********************************************************************/
|
|
32
|
-
|
|
33
|
-
// // ALIAS
|
|
34
|
-
// dphelper.disableSelect = ( el = 'body' ) => {
|
|
35
|
-
// console.debug( "Please, use 'dphelper.disable.select' instead dphelper.disableSelect" );
|
|
36
|
-
// dphelper.disable.select( el = 'body' );
|
|
37
|
-
// };
|
|
38
|
-
|
|
39
|
-
/***********************************************************************/
|
|
40
|
-
|
|
41
|
-
dphelper.disable = {
|
|
42
|
-
|
|
43
|
-
select: function( el = 'body' ){
|
|
44
|
-
|
|
45
|
-
const disabling = ( el , e ) => {
|
|
46
|
-
|
|
47
|
-
var target = $( e.target );
|
|
48
|
-
|
|
49
|
-
if( target.is( "input, button, select, textarea, .selectable *") ){
|
|
50
|
-
//console.log( 'ok' )
|
|
51
|
-
}else{
|
|
52
|
-
$('*').trigger('blur')
|
|
53
|
-
e.preventDefault();
|
|
54
|
-
return false
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
$( 'img, a, input, button' )
|
|
58
|
-
.on( 'dragstart' , function( e ) {
|
|
59
|
-
e.preventDefault();
|
|
60
|
-
return false;
|
|
61
|
-
});
|
|
62
|
-
|
|
63
|
-
};
|
|
64
|
-
|
|
65
|
-
$( el ).on( "mousedown", function( e ){ disabling( el , e ); });
|
|
66
|
-
|
|
67
|
-
console.debug( '%cSelection Disabled: %c' + true,"color:orange","" );
|
|
68
|
-
|
|
69
|
-
},
|
|
70
|
-
|
|
71
|
-
spellCheck: ( tmr = 5000 ) => {
|
|
72
|
-
|
|
73
|
-
setInterval( () => {
|
|
74
|
-
let inputs = document.querySelectorAll("input[type=text], textarea, code");
|
|
75
|
-
for(let i = 0; i < inputs.length; i++){
|
|
76
|
-
if( !inputs[i].getAttribute("spellcheck") ){
|
|
77
|
-
inputs[i].setAttribute("spellcheck", "false");
|
|
78
|
-
}
|
|
79
|
-
}
|
|
80
|
-
}, tmr );
|
|
81
|
-
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
};
|
|
85
|
-
|
|
86
|
-
Object.defineProperty( dphelper, 'disable', {
|
|
87
|
-
writable: false,
|
|
88
|
-
configurable: false
|
|
89
|
-
});
|
|
90
|
-
|
|
91
|
-
//console.log( Object.getOwnPropertyDescriptor( dphelper, 'socket' ) )
|
package/scripts/errors.js
DELETED
package/scripts/event.js
DELETED
|
@@ -1,57 +0,0 @@
|
|
|
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" : "Event",
|
|
12
|
-
"description" : "",
|
|
13
|
-
"version" : "0.0.1",
|
|
14
|
-
"command" : "event",
|
|
15
|
-
"subCommand" : [
|
|
16
|
-
{
|
|
17
|
-
"name":"multi",
|
|
18
|
-
"description":"test",
|
|
19
|
-
}
|
|
20
|
-
],
|
|
21
|
-
"example" : "",
|
|
22
|
-
"author" : "Dario Passariello",
|
|
23
|
-
"active" : true
|
|
24
|
-
};
|
|
25
|
-
|
|
26
|
-
dphelper._list.scripts.push( description );
|
|
27
|
-
|
|
28
|
-
/***********************************************************************/
|
|
29
|
-
|
|
30
|
-
dphelper.event ={
|
|
31
|
-
|
|
32
|
-
multi: ( element, eventNames, listener ) => {
|
|
33
|
-
var events = eventNames.split(' ');
|
|
34
|
-
for (var i=0, iLen = events.length; i < iLen; ++i ) {
|
|
35
|
-
element.addEventListener( events[i], listener, false );
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
},
|
|
39
|
-
|
|
40
|
-
dispatch: ( name , value ) => {
|
|
41
|
-
document.dispatchEvent( new CustomEvent( name,value ) )
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
};
|
|
45
|
-
|
|
46
|
-
Object.defineProperty( dphelper, 'event', {
|
|
47
|
-
writable: false,
|
|
48
|
-
configurable: false
|
|
49
|
-
});
|
|
50
|
-
|
|
51
|
-
Object.defineProperty( dphelper.event, 'dispatch', {
|
|
52
|
-
isTrusted: true,
|
|
53
|
-
writable: false,
|
|
54
|
-
configurable: false
|
|
55
|
-
});
|
|
56
|
-
|
|
57
|
-
//console.log( Object.getOwnPropertyDescriptor( dphelper, 'socket' ) )
|