dphelper 0.1.5 → 0.1.6
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 +6 -4
- package/.github/workflows/codeql-analysis.yml +70 -0
- package/init.js +4 -0
- package/package.json +7 -1
- package/scripts/anchorToOnClick.js +2 -2
- package/scripts/arrayDeleteItem.js +1 -1
- package/scripts/arrayItemFinder.js +2 -2
- package/scripts/arrayMerge.js +2 -2
- package/scripts/cookie.js +2 -2
- package/scripts/currency.js +9 -9
- package/scripts/date2Iso.js +9 -9
- package/scripts/date2MMDDYYYY.js +5 -5
- package/scripts/dateConvert.js +9 -9
- package/scripts/dateIso2Epoch.js +6 -6
- package/scripts/dateLocal-ISOTime.js +6 -6
- package/scripts/dateUTC.js +3 -3
- package/scripts/disableSelect.js +25 -25
- package/scripts/disableSpellCheck.js +9 -9
- package/scripts/epoch.js +3 -3
- package/scripts/fullScreen.js +22 -22
- package/scripts/handleEvent.js +43 -43
- package/scripts/indexedDB.js +5 -5
- package/scripts/isPromise.js +3 -3
- package/scripts/jsonCounter.js +10 -10
- package/scripts/loadFile.js +6 -6
- package/scripts/loadJson.js +3 -3
- package/scripts/loadJsonExternal.js +19 -19
- package/scripts/nl2br.js +3 -3
- package/scripts/noCache.js +3 -3
- package/scripts/object2array.js +7 -7
- package/scripts/onBeforeUnLoad.js +76 -76
- package/scripts/parseBool.js +4 -4
- package/scripts/parseDate.js +8 -8
- package/scripts/pathHash.js +9 -9
- package/scripts/pathQuery.js +13 -13
- package/scripts/pathRail.js +15 -15
- package/scripts/printInfo.js +5 -5
- package/scripts/purge.js +20 -20
- package/scripts/pushState.js +3 -3
- package/scripts/randomNum.js +3 -3
- package/scripts/randomNumTmr.js +3 -3
- package/scripts/scrollCustom.js +22 -22
- package/scripts/scrollIndicator.js +43 -43
- package/scripts/scrollMemory.js +5 -5
- package/scripts/scrollSmooth.js +59 -59
- package/scripts/scrollToElement.js +10 -10
- package/scripts/serializeForm.js +74 -74
- package/scripts/serializeObj.js +31 -31
- package/scripts/sleep.js +3 -3
- package/scripts/stopConsole.js +36 -36
- package/scripts/storage.js +16 -16
- package/scripts/svgSupport.js +157 -157
- package/scripts/textChanger.js +11 -11
- package/scripts/triggerClick.js +5 -5
- package/scripts/uuid.js +3 -3
- package/scripts/window.js +22 -22
package/.editorconfig
CHANGED
|
@@ -2,11 +2,13 @@ root = true
|
|
|
2
2
|
|
|
3
3
|
[*]
|
|
4
4
|
charset = utf-8
|
|
5
|
-
|
|
6
5
|
tab_width = 2
|
|
7
6
|
indent_size = 2
|
|
8
7
|
indent_style = space
|
|
8
|
+
end_of_line = lf
|
|
9
|
+
insert_final_newline = true
|
|
10
|
+
trim_trailing_whitespace = true
|
|
11
|
+
|
|
12
|
+
[*.md]
|
|
13
|
+
trim_trailing_whitespace = false
|
|
9
14
|
|
|
10
|
-
end_of_line = crlf
|
|
11
|
-
#trim_trailing_whitespace = true
|
|
12
|
-
#insert_final_newline = true
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
# For most projects, this workflow file will not need changing; you simply need
|
|
2
|
+
# to commit it to your repository.
|
|
3
|
+
#
|
|
4
|
+
# You may wish to alter this file to override the set of languages analyzed,
|
|
5
|
+
# or to provide custom queries or build logic.
|
|
6
|
+
#
|
|
7
|
+
# ******** NOTE ********
|
|
8
|
+
# We have attempted to detect the languages in your repository. Please check
|
|
9
|
+
# the `language` matrix defined below to confirm you have the correct set of
|
|
10
|
+
# supported CodeQL languages.
|
|
11
|
+
#
|
|
12
|
+
name: "CodeQL"
|
|
13
|
+
|
|
14
|
+
on:
|
|
15
|
+
push:
|
|
16
|
+
branches: [ main ]
|
|
17
|
+
pull_request:
|
|
18
|
+
# The branches below must be a subset of the branches above
|
|
19
|
+
branches: [ main ]
|
|
20
|
+
schedule:
|
|
21
|
+
- cron: '41 18 * * 4'
|
|
22
|
+
|
|
23
|
+
jobs:
|
|
24
|
+
analyze:
|
|
25
|
+
name: Analyze
|
|
26
|
+
runs-on: ubuntu-latest
|
|
27
|
+
permissions:
|
|
28
|
+
actions: read
|
|
29
|
+
contents: read
|
|
30
|
+
security-events: write
|
|
31
|
+
|
|
32
|
+
strategy:
|
|
33
|
+
fail-fast: false
|
|
34
|
+
matrix:
|
|
35
|
+
language: [ 'javascript' ]
|
|
36
|
+
# CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python', 'ruby' ]
|
|
37
|
+
# Learn more about CodeQL language support at https://git.io/codeql-language-support
|
|
38
|
+
|
|
39
|
+
steps:
|
|
40
|
+
- name: Checkout repository
|
|
41
|
+
uses: actions/checkout@v2
|
|
42
|
+
|
|
43
|
+
# Initializes the CodeQL tools for scanning.
|
|
44
|
+
- name: Initialize CodeQL
|
|
45
|
+
uses: github/codeql-action/init@v1
|
|
46
|
+
with:
|
|
47
|
+
languages: ${{ matrix.language }}
|
|
48
|
+
# If you wish to specify custom queries, you can do so here or in a config file.
|
|
49
|
+
# By default, queries listed here will override any specified in a config file.
|
|
50
|
+
# Prefix the list here with "+" to use these queries and those in the config file.
|
|
51
|
+
# queries: ./path/to/local/query, your-org/your-repo/queries@main
|
|
52
|
+
|
|
53
|
+
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
|
|
54
|
+
# If this step fails, then you should remove it and run the build manually (see below)
|
|
55
|
+
- name: Autobuild
|
|
56
|
+
uses: github/codeql-action/autobuild@v1
|
|
57
|
+
|
|
58
|
+
# ℹ️ Command-line programs to run using the OS shell.
|
|
59
|
+
# 📚 https://git.io/JvXDl
|
|
60
|
+
|
|
61
|
+
# ✏️ If the Autobuild fails above, remove it and uncomment the following three lines
|
|
62
|
+
# and modify them (or add more) to build your code if your project
|
|
63
|
+
# uses a compiled language
|
|
64
|
+
|
|
65
|
+
#- run: |
|
|
66
|
+
# make bootstrap
|
|
67
|
+
# make release
|
|
68
|
+
|
|
69
|
+
- name: Perform CodeQL Analysis
|
|
70
|
+
uses: github/codeql-action/analyze@v1
|
package/init.js
CHANGED
package/package.json
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dphelper",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.6",
|
|
4
4
|
"description": "Many utils for your projects",
|
|
5
5
|
"main": "index.js",
|
|
6
|
+
"publishConfig":"",
|
|
6
7
|
"scripts": {
|
|
7
8
|
"test": "echo \"Error: no test specified\" && exit 1"
|
|
8
9
|
},
|
|
@@ -24,6 +25,11 @@
|
|
|
24
25
|
"url": "https://github.com/passariello/dpHelper",
|
|
25
26
|
"help": "https://github.com/passariello/dpHelper#readme"
|
|
26
27
|
},
|
|
28
|
+
"eslintConfig": {
|
|
29
|
+
"globals": {
|
|
30
|
+
"window": true
|
|
31
|
+
}
|
|
32
|
+
},
|
|
27
33
|
"bugs": {
|
|
28
34
|
"url": "https://github.com/passariello/dpHelper/issues"
|
|
29
35
|
},
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
|
|
10
10
|
/***********************************************************************/
|
|
11
11
|
|
|
12
|
-
dphelper.anchorToOnClick = function(){
|
|
12
|
+
window.dphelper.anchorToOnClick = function(){
|
|
13
13
|
// const $ = require("jquery");
|
|
14
14
|
|
|
15
15
|
$('a').each( function( index ) {
|
|
@@ -27,7 +27,7 @@ dphelper.anchorToOnClick = function(){
|
|
|
27
27
|
.removeAttr( 'href' )
|
|
28
28
|
.on( 'click', function(){
|
|
29
29
|
window.location.href = href;
|
|
30
|
-
history.pushState('', '', href);
|
|
30
|
+
window.history.pushState('', '', href);
|
|
31
31
|
});
|
|
32
32
|
}
|
|
33
33
|
|
|
@@ -9,12 +9,12 @@
|
|
|
9
9
|
|
|
10
10
|
/***********************************************************************/
|
|
11
11
|
|
|
12
|
-
dphelper.arrayItemFinder = (id, array) => {
|
|
12
|
+
window.dphelper.arrayItemFinder = (id, array) => {
|
|
13
13
|
for (let node of array) {
|
|
14
14
|
if (node.id === id) return node;
|
|
15
15
|
|
|
16
16
|
if (node.children) {
|
|
17
|
-
let finalNode = dphelper.arrayFindItem(id, node.children);
|
|
17
|
+
let finalNode = window.dphelper.arrayFindItem(id, node.children);
|
|
18
18
|
if (finalNode) return finalNode;
|
|
19
19
|
}
|
|
20
20
|
}
|
package/scripts/arrayMerge.js
CHANGED
|
@@ -9,10 +9,10 @@
|
|
|
9
9
|
|
|
10
10
|
/***********************************************************************/
|
|
11
11
|
|
|
12
|
-
dphelper.arrayMerge = (target, source) => {
|
|
12
|
+
window.dphelper.arrayMerge = (target, source) => {
|
|
13
13
|
|
|
14
14
|
for (const key of Object.keys(source)) {
|
|
15
|
-
if (source[key] instanceof Object && target[key]) Object.assign(source[key], dphelper.mergeArrays(target[key], source[key]));
|
|
15
|
+
if (source[key] instanceof Object && target[key]) Object.assign(source[key], window.dphelper.mergeArrays(target[key], source[key]));
|
|
16
16
|
}
|
|
17
17
|
|
|
18
18
|
Object.assign(target || {}, source);
|
package/scripts/cookie.js
CHANGED
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
CookieSecure = "Secure";
|
|
18
18
|
}
|
|
19
19
|
|
|
20
|
-
dphelper.cookie = {
|
|
20
|
+
window.dphelper.cookie = {
|
|
21
21
|
|
|
22
22
|
// CREATE THE COOKIE
|
|
23
23
|
|
|
@@ -68,4 +68,4 @@
|
|
|
68
68
|
};
|
|
69
69
|
|
|
70
70
|
// START COOKIE DB
|
|
71
|
-
dphelper.cookie.set( "dpHelper", 'active' );
|
|
71
|
+
window.dphelper.cookie.set( "dpHelper", 'active' );
|
package/scripts/currency.js
CHANGED
|
@@ -9,13 +9,13 @@
|
|
|
9
9
|
|
|
10
10
|
/***********************************************************************/
|
|
11
11
|
|
|
12
|
-
dphelper.currency = ( val, int = 'en-US', cur = 'USD' ) => {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
12
|
+
window.dphelper.currency = ( val, int = 'en-US', cur = 'USD' ) => {
|
|
13
|
+
if( !val || isNaN( val ) ) val = 0;
|
|
14
|
+
var formatter = new Intl.NumberFormat( int , {
|
|
15
|
+
style: 'currency',
|
|
16
|
+
currency: cur,
|
|
17
|
+
});
|
|
18
18
|
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
};
|
|
19
|
+
// return ( val ).toFixed(2).replace(/\d(?=(\d{3})+\.)/g, '$&,')
|
|
20
|
+
return formatter.format( val );
|
|
21
|
+
};
|
package/scripts/date2Iso.js
CHANGED
|
@@ -9,12 +9,12 @@
|
|
|
9
9
|
|
|
10
10
|
/***********************************************************************/
|
|
11
11
|
|
|
12
|
-
dphelper.date2Iso = (value , int = 'en' ) => {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
};
|
|
12
|
+
window.dphelper.date2Iso = (value , int = 'en' ) => {
|
|
13
|
+
if (!value) value = '';
|
|
14
|
+
let date = new Date(value);
|
|
15
|
+
if (date == 'Invalid Date') return null; //date = new Date()
|
|
16
|
+
const dateTimeFormat = new Intl.DateTimeFormat( int , {
|
|
17
|
+
year: 'numeric', month: 'long', day: 'numeric',
|
|
18
|
+
});
|
|
19
|
+
return dateTimeFormat.format(date);
|
|
20
|
+
};
|
package/scripts/date2MMDDYYYY.js
CHANGED
|
@@ -9,8 +9,8 @@
|
|
|
9
9
|
|
|
10
10
|
/***********************************************************************/
|
|
11
11
|
|
|
12
|
-
dphelper.date2MMDDYYYY = (value) => {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
};
|
|
12
|
+
window.dphelper.date2MMDDYYYY = (value) => {
|
|
13
|
+
if (!value) value = '';
|
|
14
|
+
let date = new Date(value);
|
|
15
|
+
return ('0' + (date.getMonth() + 1)).slice(-2) + "" + ('0' + date.getDate()).slice(-2) + "" + date.getFullYear();
|
|
16
|
+
};
|
package/scripts/dateConvert.js
CHANGED
|
@@ -9,12 +9,12 @@
|
|
|
9
9
|
|
|
10
10
|
/***********************************************************************/
|
|
11
11
|
|
|
12
|
-
dphelper.dateConvert = (value , format ) => {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
};
|
|
12
|
+
window.dphelper.dateConvert = (value , format ) => {
|
|
13
|
+
if( !format) format = ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"];
|
|
14
|
+
if (!value) return null;
|
|
15
|
+
let monthNames = format;
|
|
16
|
+
let month = value.substring(0, 2).replace('0', '');
|
|
17
|
+
let day = value.substring(2, 4);
|
|
18
|
+
let year = value.substring(value.length - 4);
|
|
19
|
+
return day + ' ' + monthNames[Number(month) - 1] + ' ' + year;
|
|
20
|
+
};
|
package/scripts/dateIso2Epoch.js
CHANGED
|
@@ -9,9 +9,9 @@
|
|
|
9
9
|
|
|
10
10
|
/***********************************************************************/
|
|
11
11
|
|
|
12
|
-
dphelper.dateIso2Epoch = (value) => {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
};
|
|
12
|
+
window.dphelper.dateIso2Epoch = (value) => {
|
|
13
|
+
if (!value) value = '';
|
|
14
|
+
let date = new Date(value);
|
|
15
|
+
let milliseconds = date.getTime();
|
|
16
|
+
return milliseconds;
|
|
17
|
+
};
|
|
@@ -9,9 +9,9 @@
|
|
|
9
9
|
|
|
10
10
|
/***********************************************************************/
|
|
11
11
|
|
|
12
|
-
dphelper.localISOTime = (value) => {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
};
|
|
12
|
+
window.dphelper.localISOTime = (value) => {
|
|
13
|
+
if (!value) value = '';
|
|
14
|
+
let tzoffset = (new Date(value)).getTimezoneOffset() * 60000;
|
|
15
|
+
let localISOTime = (new Date(Date.now() - tzoffset)).toISOString().slice(0, -1);
|
|
16
|
+
return localISOTime;
|
|
17
|
+
};
|
package/scripts/dateUTC.js
CHANGED
package/scripts/disableSelect.js
CHANGED
|
@@ -9,35 +9,35 @@
|
|
|
9
9
|
|
|
10
10
|
/***********************************************************************/
|
|
11
11
|
|
|
12
|
-
dphelper.disableSelect = function( e ){
|
|
13
|
-
|
|
14
|
-
const disabling = ( e ) => {
|
|
12
|
+
window.dphelper.disableSelect = function( e ){
|
|
15
13
|
|
|
16
|
-
const
|
|
14
|
+
const disabling = ( e ) => {
|
|
15
|
+
|
|
16
|
+
const $ = require("jquery");
|
|
17
17
|
|
|
18
|
-
|
|
18
|
+
$( 'body' ).each( function(){
|
|
19
19
|
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
20
|
+
$( this )
|
|
21
|
+
.prop( "unselectable" , "on" )
|
|
22
|
+
.css( "MozUserSelect" , "none" )
|
|
23
|
+
.css( "WebKitUserSelect" , "none" )
|
|
24
|
+
.on( "select" , function(){ return false; })
|
|
25
|
+
.on( "selectstart" , function(){ return false; });
|
|
26
26
|
|
|
27
|
-
|
|
28
|
-
|
|
27
|
+
//this.onselectstart = function() { return false }
|
|
28
|
+
//this.oncontextmenu = function() { return false }
|
|
29
29
|
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
30
|
+
$( 'img, a, input, button' ).on( 'dragstart' , function( e ) {
|
|
31
|
+
e.preventDefault();
|
|
32
|
+
return false;
|
|
33
|
+
});
|
|
34
34
|
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
35
|
+
});
|
|
36
|
+
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
document.body.addEventListener('mousedown',function( e ){ disabling( e ); }, false );
|
|
40
|
+
document.body.onmousedown = function( e ){ disabling( e ); };
|
|
41
|
+
console.debug("%cSelection Disabled:%c true", "color:gray", "");
|
|
42
42
|
|
|
43
|
-
};
|
|
43
|
+
};
|
|
@@ -9,13 +9,13 @@
|
|
|
9
9
|
|
|
10
10
|
/***********************************************************************/
|
|
11
11
|
|
|
12
|
-
dphelper.disableSpellCheck = ( tmr = 5000 ) => {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
12
|
+
window.dphelper.disableSpellCheck = ( tmr = 5000 ) => {
|
|
13
|
+
setInterval( () => {
|
|
14
|
+
let inputs = document.querySelectorAll("input[type=text], textarea");
|
|
15
|
+
for(let i = 0; i < inputs.length; i++){
|
|
16
|
+
if( !inputs[i].getAttribute("spellcheck") ){
|
|
17
|
+
inputs[i].setAttribute("spellcheck", "false");
|
|
18
|
+
}
|
|
18
19
|
}
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
};
|
|
20
|
+
}, tmr );
|
|
21
|
+
};
|
package/scripts/epoch.js
CHANGED
package/scripts/fullScreen.js
CHANGED
|
@@ -9,32 +9,32 @@
|
|
|
9
9
|
|
|
10
10
|
/***********************************************************************/
|
|
11
11
|
|
|
12
|
-
dphelper.fullScreenToggle = function( el ) {
|
|
12
|
+
window.dphelper.fullScreenToggle = function( el ) {
|
|
13
13
|
|
|
14
|
-
|
|
15
|
-
|
|
14
|
+
let requestFullScreen = el.requestFullscreen || el.mozRequestFullScreen || el.webkitRequestFullScreen || el.msRequestFullscreen;
|
|
15
|
+
let cancelFullScreen = el.exitFullscreen || el.mozCancelFullScreen || el.webkitExitFullscreen || el.msExitFullscreen;
|
|
16
16
|
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
17
|
+
if( !doc.fullscreenElement && !el.mozFullScreenElement && !el.webkitFullscreenElement && !el.msFullscreenElement ) {
|
|
18
|
+
requestFullScreen.call( el );
|
|
19
|
+
}else{
|
|
20
|
+
cancelFullScreen.call( el );
|
|
21
|
+
}
|
|
22
22
|
|
|
23
|
-
|
|
24
|
-
};
|
|
23
|
+
// window.dphelper.fullScreenToggle( document.body )
|
|
24
|
+
};
|
|
25
25
|
|
|
26
26
|
/*****************************************************************************************/
|
|
27
27
|
|
|
28
|
-
dphelper.fullScreen = function( el ){
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
28
|
+
window.dphelper.fullScreen = function( el ){
|
|
29
|
+
|
|
30
|
+
if ( el.requestFullScreen ) {
|
|
31
|
+
el.requestFullScreen();
|
|
32
|
+
} else if ( el.mozRequestFullScreen ) {
|
|
33
|
+
el.mozRequestFullScreen();
|
|
34
|
+
} else if ( el.webkitRequestFullScreen ) {
|
|
35
|
+
el.webkitRequestFullScreen();
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
// window.dphelper.fullScreen( document.body )
|
|
39
39
|
|
|
40
|
-
};
|
|
40
|
+
};
|
package/scripts/handleEvent.js
CHANGED
|
@@ -9,51 +9,51 @@
|
|
|
9
9
|
|
|
10
10
|
/***********************************************************************/
|
|
11
11
|
|
|
12
|
-
dphelper.handleEvent = ( e, trigger ) => {
|
|
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
|
-
|
|
12
|
+
window.dphelper.handleEvent = ( e, trigger ) => {
|
|
13
|
+
const code = e.which ? e.which : e.keyCode;
|
|
14
|
+
|
|
15
|
+
if( !trigger ) trigger = {
|
|
16
|
+
// EXAMPLES:
|
|
17
|
+
"data" : [
|
|
18
|
+
{
|
|
19
|
+
"key" : "83",
|
|
20
|
+
"ctrl" : true,
|
|
21
|
+
"active" : true,
|
|
22
|
+
"description" : "CTRL+S",
|
|
23
|
+
//"element" : "#formSave",
|
|
24
|
+
"function" : ""
|
|
25
|
+
},
|
|
26
|
+
{
|
|
27
|
+
"key" : "27",
|
|
28
|
+
"ctrl" : false,
|
|
29
|
+
"active" : true,
|
|
30
|
+
"description" : "ESC",
|
|
31
|
+
"element" : "",
|
|
32
|
+
"function" : ""
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
"key" : "80",
|
|
36
|
+
"ctrl" : true,
|
|
37
|
+
"active" : true,
|
|
38
|
+
"description" : "CTRL+P",
|
|
39
|
+
"element" : "",
|
|
40
|
+
//"function" : "function(){ Print }"
|
|
41
|
+
}
|
|
42
|
+
]
|
|
43
|
+
};
|
|
44
44
|
|
|
45
|
-
|
|
45
|
+
trigger.map( list => {
|
|
46
46
|
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
47
|
+
// IF CTRL COMMAND
|
|
48
|
+
if ( e.ctrlKey || e.metaKey && list.ctrl === true ) {
|
|
49
|
+
if( code === parseInt(list.key) && list.active === true ){
|
|
50
|
+
if( list.element > '' ) simulateClick( list.element );
|
|
51
|
+
if( list.function > '' ) list.function;
|
|
52
|
+
e.preventDefault();
|
|
53
|
+
return;
|
|
54
|
+
}
|
|
54
55
|
}
|
|
55
|
-
}
|
|
56
56
|
|
|
57
|
-
|
|
57
|
+
});
|
|
58
58
|
|
|
59
|
-
};
|
|
59
|
+
};
|
package/scripts/indexedDB.js
CHANGED
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
|
|
10
10
|
/***********************************************************************/
|
|
11
11
|
|
|
12
|
-
dphelper.indexedDB = {
|
|
12
|
+
window.dphelper.indexedDB = {
|
|
13
13
|
|
|
14
14
|
open: ( storeName ) => {
|
|
15
15
|
|
|
@@ -165,16 +165,16 @@
|
|
|
165
165
|
// CHECK IF INDEXEDDB EXIST
|
|
166
166
|
// ***************************************************************************************************/
|
|
167
167
|
|
|
168
|
-
dphelper.dbExist = () => {
|
|
168
|
+
window.dphelper.dbExist = () => {
|
|
169
169
|
var result = indexedDB.databases();
|
|
170
170
|
return result.length;
|
|
171
171
|
};
|
|
172
172
|
|
|
173
173
|
// START DEFAULT DB
|
|
174
|
-
dphelper.indexedDB.open( "dpHelper" );
|
|
174
|
+
window.dphelper.indexedDB.open( "dpHelper" );
|
|
175
175
|
/*
|
|
176
|
-
dphelper.indexedDB.store( "dpHelper" );
|
|
177
|
-
dphelper.indexedDB.insert( "dpHelper" , 'active' , 'test[0]' , [] );
|
|
176
|
+
window.dphelper.indexedDB.store( "dpHelper" );
|
|
177
|
+
window.dphelper.indexedDB.insert( "dpHelper" , 'active' , 'test[0]' , [] );
|
|
178
178
|
*/
|
|
179
179
|
|
|
180
180
|
|
package/scripts/isPromise.js
CHANGED
|
@@ -9,6 +9,6 @@
|
|
|
9
9
|
|
|
10
10
|
/***********************************************************************/
|
|
11
11
|
|
|
12
|
-
dphelper.isPromise = (p) => {
|
|
13
|
-
|
|
14
|
-
};
|
|
12
|
+
window.dphelper.isPromise = (p) => {
|
|
13
|
+
return p && Object.prototype.toString.call(p) === "[object Promise]";
|
|
14
|
+
};
|
package/scripts/jsonCounter.js
CHANGED
|
@@ -9,13 +9,13 @@
|
|
|
9
9
|
|
|
10
10
|
/***********************************************************************/
|
|
11
11
|
|
|
12
|
-
dphelper.jsonCounter = (json, key, val) => {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
};
|
|
12
|
+
window.dphelper.jsonCounter = (json, key, val) => {
|
|
13
|
+
if (!json) return null;
|
|
14
|
+
let keyCount;
|
|
15
|
+
if (key && val) {
|
|
16
|
+
keyCount = Object.keys(jsonObject).length;
|
|
17
|
+
} else {
|
|
18
|
+
keyCount = json.items.filter(value => value.key === val).lengt;
|
|
19
|
+
}
|
|
20
|
+
return keyCount;
|
|
21
|
+
};
|