dphelper 0.2.30 → 0.2.34
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/list.json +19 -39
- package/init.js +19 -5
- package/package.json +5 -7
- 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 +90 -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/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/promise.js +35 -0
- 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/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/date2Iso.js +0 -20
- package/scripts/date2MMDDYYYY.js +0 -16
- package/scripts/dateConvert.js +0 -20
- package/scripts/dateIso2Epoch.js +0 -17
- package/scripts/dateLocal-ISOTime.js +0 -17
- package/scripts/dateUTC.js +0 -14
- package/scripts/disableSelect.js +0 -46
- package/scripts/disableSpellCheck.js +0 -21
- package/scripts/epoch.js +0 -14
- package/scripts/fontFit.js +0 -24
- package/scripts/fullScreen.js +0 -40
- package/scripts/isPromise.js +0 -14
- package/scripts/jsonCounter.js +0 -21
- package/scripts/loadFile.js +0 -17
- package/scripts/loadJson.js +0 -15
- package/scripts/loadJsonExternal.js +0 -32
- package/scripts/nl2br.js +0 -14
- package/scripts/object2array.js +0 -16
- package/scripts/parseDate.js +0 -19
- package/scripts/pathHash.js +0 -19
- package/scripts/pathQuery.js +0 -24
- package/scripts/pathRail.js +0 -25
- package/scripts/printInfo.js +0 -16
- package/scripts/randomNum.js +0 -14
- package/scripts/randomNumTmr.js +0 -14
- package/scripts/scrollCustom.js +0 -41
- package/scripts/scrollIndicator.js +0 -67
- package/scripts/scrollMemory.js +0 -26
- package/scripts/scrollSmooth.js +0 -74
- package/scripts/scrollToElement.js +0 -25
- 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/svgSupport.js +0 -346
- package/scripts/textChanger.js +0 -24
- package/scripts/triggerClick.js +0 -16
package/scripts/window.js
CHANGED
|
@@ -1,38 +1,50 @@
|
|
|
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
|
-
|
|
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" : "Window Options",
|
|
11
|
+
"description" : "test",
|
|
12
|
+
"version" : "0.0.1",
|
|
13
|
+
"command" : "window",
|
|
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.window = () => {
|
|
25
|
+
|
|
26
|
+
window.offScreenBuffering = "auto";
|
|
27
|
+
|
|
28
|
+
// HIDE STATUS INFORMATION ON BROWSER BAR
|
|
29
|
+
//***************************************
|
|
30
|
+
|
|
31
|
+
window.status = "";
|
|
32
|
+
window.defaultStatus = "";
|
|
33
|
+
|
|
34
|
+
// WINDOW ANIMATION
|
|
35
|
+
//**********************************
|
|
36
|
+
|
|
37
|
+
( () => {
|
|
38
|
+
return (
|
|
39
|
+
window.requestAnimationFrame ||
|
|
40
|
+
window.webkitRequestAnimationFrame ||
|
|
41
|
+
window.mozRequestAnimationFrame ||
|
|
42
|
+
window.oRequestAnimationFrame ||
|
|
43
|
+
window.msRequestAnimationFrame ||
|
|
44
|
+
function( callback ){
|
|
45
|
+
window.setTimeout( callback, 1000 / 120 );
|
|
46
|
+
}
|
|
47
|
+
);
|
|
48
|
+
})();
|
|
49
|
+
|
|
50
|
+
};
|
package/#cmd.exe.lnk
DELETED
|
Binary file
|
|
@@ -1,70 +0,0 @@
|
|
|
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
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
/*!
|
|
2
|
-
* dpHelper <https://github.com/passariello/dpHelper>
|
|
3
|
-
*
|
|
4
|
-
* arrayDeleteItem
|
|
5
|
-
*
|
|
6
|
-
* Copyright (c) 2021, Dario Passariello.
|
|
7
|
-
* Licensed under the Apache-2.0 License.
|
|
8
|
-
*/
|
|
9
|
-
|
|
10
|
-
/***********************************************************************/
|
|
11
|
-
|
|
12
|
-
window.dphelper.arrayDeleteItem = ( array, id ) =>{
|
|
13
|
-
|
|
14
|
-
array.some(function iter (o,i,a) {
|
|
15
|
-
|
|
16
|
-
if (o.Id === id) {
|
|
17
|
-
a.splice(i, 1);
|
|
18
|
-
return true;
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
var key = Object.keys(o);
|
|
22
|
-
|
|
23
|
-
for (let key of Object.keys(o)) {
|
|
24
|
-
let value = o[key];
|
|
25
|
-
if(value.length && typeof value === 'object') return value && value.map(iter);
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
// OLD SCHOOL WAY
|
|
29
|
-
// for (var p=0; p < key.length; ++p){
|
|
30
|
-
// if( o[key[p]]?.length && typeof o[key[p]] === 'object') return o[key[p]] && o[key[p]].some(iter);
|
|
31
|
-
// }
|
|
32
|
-
|
|
33
|
-
});
|
|
34
|
-
|
|
35
|
-
};
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
/*!
|
|
2
|
-
* dpHelper <https://github.com/passariello/dpHelper>
|
|
3
|
-
*
|
|
4
|
-
* arrayItemFinder
|
|
5
|
-
*
|
|
6
|
-
* Copyright (c) 2021, Dario Passariello.
|
|
7
|
-
* Licensed under the Apache-2.0 License.
|
|
8
|
-
*/
|
|
9
|
-
|
|
10
|
-
/***********************************************************************/
|
|
11
|
-
|
|
12
|
-
window.dphelper.arrayItemFinder = (id, array) => {
|
|
13
|
-
for (let node of array) {
|
|
14
|
-
if (node.id === id) return node;
|
|
15
|
-
|
|
16
|
-
if (node.children) {
|
|
17
|
-
let finalNode = window.dphelper.arrayFindItem(id, node.children);
|
|
18
|
-
if (finalNode) return finalNode;
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
return false;
|
|
22
|
-
};
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
/*!
|
|
2
|
-
* dpHelper <https://github.com/passariello/dpHelper>
|
|
3
|
-
*
|
|
4
|
-
* arrayMerge
|
|
5
|
-
*
|
|
6
|
-
* Copyright (c) 2021, Dario Passariello.
|
|
7
|
-
* Licensed under the Apache-2.0 License.
|
|
8
|
-
*/
|
|
9
|
-
|
|
10
|
-
/***********************************************************************/
|
|
11
|
-
|
|
12
|
-
window.dphelper.arrayMerge = (target, source) => {
|
|
13
|
-
|
|
14
|
-
for (const key of Object.keys(source)) {
|
|
15
|
-
if (source[key] instanceof Object && target[key]) Object.assign(source[key], window.dphelper.mergeArrays(target[key], source[key]));
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
Object.assign(target || {}, source);
|
|
19
|
-
return target;
|
|
20
|
-
};
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
/*!
|
|
2
|
-
* dpHelper <https://github.com/passariello/dpHelper>
|
|
3
|
-
*
|
|
4
|
-
* arrayUnique
|
|
5
|
-
*
|
|
6
|
-
* Copyright (c) 2021, Dario Passariello.
|
|
7
|
-
* Licensed under the Apache-2.0 License.
|
|
8
|
-
*/
|
|
9
|
-
|
|
10
|
-
/***********************************************************************/
|
|
11
|
-
|
|
12
|
-
window.dphelper.arrayUnique = ( array ) => {
|
|
13
|
-
let unique = [...new Set( array )];
|
|
14
|
-
return unique;
|
|
15
|
-
};
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
/*!
|
|
2
|
-
* dpHelper <https://github.com/passariello/dpHelper>
|
|
3
|
-
*
|
|
4
|
-
* loadAsset
|
|
5
|
-
*
|
|
6
|
-
* Copyright (c) 2021, Dario Passariello.
|
|
7
|
-
* Licensed under the Apache-2.0 License.
|
|
8
|
-
*/
|
|
9
|
-
|
|
10
|
-
/***********************************************************************/
|
|
11
|
-
|
|
12
|
-
dphelper.loadAsset = ( folder, img, path = '/assets/images/') => {
|
|
13
|
-
|
|
14
|
-
const check = /\.(ttf|eot|svg|gif|png)(\?v=[0-9]\.[0-9]\.[0-9])?$/;
|
|
15
|
-
|
|
16
|
-
const asset = require.context( path , true, /\.(ttf|eot|svg|gif|png)(\?v=[0-9]\.[0-9]\.[0-9])?$/ );
|
|
17
|
-
let dynamicLoad = null;
|
|
18
|
-
dynamicLoad = asset(`./${img}`);
|
|
19
|
-
|
|
20
|
-
if( dynamicLoad !== null ){
|
|
21
|
-
return dynamicLoad.default;
|
|
22
|
-
}else{
|
|
23
|
-
console.error(e, folder +" "+ img + ' error' );
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
};
|
package/scripts/camelCase.js
DELETED
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
/*!
|
|
2
|
-
* dpHelper <https://github.com/passariello/dpHelper>
|
|
3
|
-
*
|
|
4
|
-
* camelCase / PascalCase
|
|
5
|
-
*
|
|
6
|
-
* Copyright (c) 2021, Dario Passariello.
|
|
7
|
-
* Licensed under the Apache-2.0 License.
|
|
8
|
-
*/
|
|
9
|
-
|
|
10
|
-
/***********************************************************************/
|
|
11
|
-
|
|
12
|
-
window.dphelper.camelCase = {
|
|
13
|
-
|
|
14
|
-
// toSpace
|
|
15
|
-
toSpace: ( string ) => {
|
|
16
|
-
return string
|
|
17
|
-
.replace(/([A-Z])/g, ' $1')
|
|
18
|
-
.replace(/^./, function(str){ return str.toUpperCase(); })
|
|
19
|
-
},
|
|
20
|
-
|
|
21
|
-
// toUnderscore
|
|
22
|
-
toUnderscore: ( string ) => {
|
|
23
|
-
return string
|
|
24
|
-
.replace(/\.?([A-Z])/g, function (x,y){ return "_" + y.toLowerCase()})
|
|
25
|
-
.replace(/^_/, "");
|
|
26
|
-
},
|
|
27
|
-
|
|
28
|
-
};
|
|
29
|
-
|
package/scripts/date2Iso.js
DELETED
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
/*!
|
|
2
|
-
* dpHelper <https://github.com/passariello/dpHelper>
|
|
3
|
-
*
|
|
4
|
-
* date to iso
|
|
5
|
-
*
|
|
6
|
-
* Copyright (c) 2021, Dario Passariello.
|
|
7
|
-
* Licensed under the Apache-2.0 License.
|
|
8
|
-
*/
|
|
9
|
-
|
|
10
|
-
/***********************************************************************/
|
|
11
|
-
|
|
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
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
/*!
|
|
2
|
-
* dpHelper <https://github.com/passariello/dpHelper>
|
|
3
|
-
*
|
|
4
|
-
* date to MMDDYYYY
|
|
5
|
-
*
|
|
6
|
-
* Copyright (c) 2021, Dario Passariello.
|
|
7
|
-
* Licensed under the Apache-2.0 License.
|
|
8
|
-
*/
|
|
9
|
-
|
|
10
|
-
/***********************************************************************/
|
|
11
|
-
|
|
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
DELETED
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
/*!
|
|
2
|
-
* dpHelper <https://github.com/passariello/dpHelper>
|
|
3
|
-
*
|
|
4
|
-
* date convert
|
|
5
|
-
*
|
|
6
|
-
* Copyright (c) 2021, Dario Passariello.
|
|
7
|
-
* Licensed under the Apache-2.0 License.
|
|
8
|
-
*/
|
|
9
|
-
|
|
10
|
-
/***********************************************************************/
|
|
11
|
-
|
|
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
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
/*!
|
|
2
|
-
* dpHelper <https://github.com/passariello/dpHelper>
|
|
3
|
-
*
|
|
4
|
-
* date iso to epoch
|
|
5
|
-
*
|
|
6
|
-
* Copyright (c) 2021, Dario Passariello.
|
|
7
|
-
* Licensed under the Apache-2.0 License.
|
|
8
|
-
*/
|
|
9
|
-
|
|
10
|
-
/***********************************************************************/
|
|
11
|
-
|
|
12
|
-
window.dphelper.dateIso2Epoch = (value) => {
|
|
13
|
-
if (!value) value = '';
|
|
14
|
-
let date = new Date(value);
|
|
15
|
-
let milliseconds = date.getTime();
|
|
16
|
-
return milliseconds;
|
|
17
|
-
};
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
/*!
|
|
2
|
-
* dpHelper <https://github.com/passariello/dpHelper>
|
|
3
|
-
*
|
|
4
|
-
* parse date
|
|
5
|
-
*
|
|
6
|
-
* Copyright (c) 2021, Dario Passariello.
|
|
7
|
-
* Licensed under the Apache-2.0 License.
|
|
8
|
-
*/
|
|
9
|
-
|
|
10
|
-
/***********************************************************************/
|
|
11
|
-
|
|
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
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
/*!
|
|
2
|
-
* dpHelper <https://github.com/passariello/dpHelper>
|
|
3
|
-
*
|
|
4
|
-
* parse date
|
|
5
|
-
*
|
|
6
|
-
* Copyright (c) 2021, Dario Passariello.
|
|
7
|
-
* Licensed under the Apache-2.0 License.
|
|
8
|
-
*/
|
|
9
|
-
|
|
10
|
-
/***********************************************************************/
|
|
11
|
-
|
|
12
|
-
window.dphelper.dateUTC = () => {
|
|
13
|
-
return moment().toISOString();
|
|
14
|
-
};
|
package/scripts/disableSelect.js
DELETED
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
/*!
|
|
2
|
-
* dpHelper <https://github.com/passariello/dpHelper>
|
|
3
|
-
*
|
|
4
|
-
* disableSelect
|
|
5
|
-
*
|
|
6
|
-
* Copyright (c) 2021, Dario Passariello.
|
|
7
|
-
* Licensed under the Apache-2.0 License.
|
|
8
|
-
*/
|
|
9
|
-
|
|
10
|
-
/***********************************************************************/
|
|
11
|
-
|
|
12
|
-
window.dphelper.disableSelect = function( el = 'body' ){
|
|
13
|
-
|
|
14
|
-
var $ = require( "jquery" );
|
|
15
|
-
var e = e || event;
|
|
16
|
-
|
|
17
|
-
const disabling = ( el ) => {
|
|
18
|
-
|
|
19
|
-
const $ = require( "jquery" );
|
|
20
|
-
|
|
21
|
-
$( el ).each( function( e ){
|
|
22
|
-
|
|
23
|
-
$( this )
|
|
24
|
-
.prop( "unselectable" , "on" )
|
|
25
|
-
.css( "MozUserSelect" , "none" )
|
|
26
|
-
.css( "WebKitUserSelect" , "none" )
|
|
27
|
-
.on( "select" , function(){ return false; })
|
|
28
|
-
.on( "selectstart" , function(){ return false; });
|
|
29
|
-
|
|
30
|
-
//this.onselectstart = function() { return false }
|
|
31
|
-
//this.oncontextmenu = function() { return false }
|
|
32
|
-
|
|
33
|
-
$( 'img, a, input, button' ).on( 'dragstart' , function( e ) {
|
|
34
|
-
e.preventDefault();
|
|
35
|
-
return false;
|
|
36
|
-
});
|
|
37
|
-
|
|
38
|
-
});
|
|
39
|
-
|
|
40
|
-
};
|
|
41
|
-
|
|
42
|
-
document.querySelector( el ).addEventListener( 'mousedown' , function( e ){ disabling( el ); }, false );
|
|
43
|
-
document.querySelector( el ).onmousedown = function( e ){ disabling( el ); };
|
|
44
|
-
console.debug("%cSelection Disabled:%c true", "color:gray", "");
|
|
45
|
-
|
|
46
|
-
};
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
/*!
|
|
2
|
-
* dpHelper <https://github.com/passariello/dpHelper>
|
|
3
|
-
*
|
|
4
|
-
* disableSpellCheck
|
|
5
|
-
*
|
|
6
|
-
* Copyright (c) 2021, Dario Passariello.
|
|
7
|
-
* Licensed under the Apache-2.0 License.
|
|
8
|
-
*/
|
|
9
|
-
|
|
10
|
-
/***********************************************************************/
|
|
11
|
-
|
|
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
|
-
}
|
|
19
|
-
}
|
|
20
|
-
}, tmr );
|
|
21
|
-
};
|
package/scripts/epoch.js
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
/*!
|
|
2
|
-
* dpHelper <https://github.com/passariello/dpHelper>
|
|
3
|
-
*
|
|
4
|
-
* epoch
|
|
5
|
-
*
|
|
6
|
-
* Copyright (c) 2021, Dario Passariello.
|
|
7
|
-
* Licensed under the Apache-2.0 License.
|
|
8
|
-
*/
|
|
9
|
-
|
|
10
|
-
/***********************************************************************/
|
|
11
|
-
|
|
12
|
-
window.dphelper.epoch = () => {
|
|
13
|
-
return new Date().getTime();
|
|
14
|
-
};
|
package/scripts/fontFit.js
DELETED
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
function fontFitStart(){
|
|
4
|
-
|
|
5
|
-
var divs = document.querySelectorAll( name );
|
|
6
|
-
if( divs.length <= 0 ) return;
|
|
7
|
-
|
|
8
|
-
for(var i = 0; i < divs.length; i++) {
|
|
9
|
-
var fontSize = divs[i].offsetWidth * 0.05;
|
|
10
|
-
divs[i].style.fontSize = fontSize+'px';
|
|
11
|
-
}
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
window.dphelper.fontFit = ( name ) => {
|
|
15
|
-
|
|
16
|
-
if( !name ) return;
|
|
17
|
-
window.dphelper.addListenerMulti( window , 'load resize', () => {
|
|
18
|
-
fontFitStart( name );
|
|
19
|
-
});
|
|
20
|
-
|
|
21
|
-
};
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
package/scripts/fullScreen.js
DELETED
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
/*!
|
|
2
|
-
* dpHelper <https://github.com/passariello/dpHelper>
|
|
3
|
-
*
|
|
4
|
-
* fullScreenToggle, fullScreen
|
|
5
|
-
*
|
|
6
|
-
* Copyright (c) 2021, Dario Passariello.
|
|
7
|
-
* Licensed under the Apache-2.0 License.
|
|
8
|
-
*/
|
|
9
|
-
|
|
10
|
-
/***********************************************************************/
|
|
11
|
-
|
|
12
|
-
window.dphelper.fullScreenToggle = function( el ) {
|
|
13
|
-
|
|
14
|
-
let requestFullScreen = el.requestFullscreen || el.mozRequestFullScreen || el.webkitRequestFullScreen || el.msRequestFullscreen;
|
|
15
|
-
let cancelFullScreen = el.exitFullscreen || el.mozCancelFullScreen || el.webkitExitFullscreen || el.msExitFullscreen;
|
|
16
|
-
|
|
17
|
-
if( !doc.fullscreenElement && !el.mozFullScreenElement && !el.webkitFullscreenElement && !el.msFullscreenElement ) {
|
|
18
|
-
requestFullScreen.call( el );
|
|
19
|
-
}else{
|
|
20
|
-
cancelFullScreen.call( el );
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
// window.dphelper.fullScreenToggle( document.body )
|
|
24
|
-
};
|
|
25
|
-
|
|
26
|
-
/*****************************************************************************************/
|
|
27
|
-
|
|
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
|
-
|
|
40
|
-
};
|
package/scripts/isPromise.js
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
/*!
|
|
2
|
-
* dpHelper <https://github.com/passariello/dpHelper>
|
|
3
|
-
*
|
|
4
|
-
* isPromise
|
|
5
|
-
*
|
|
6
|
-
* Copyright (c) 2021, Dario Passariello.
|
|
7
|
-
* Licensed under the Apache-2.0 License.
|
|
8
|
-
*/
|
|
9
|
-
|
|
10
|
-
/***********************************************************************/
|
|
11
|
-
|
|
12
|
-
window.dphelper.isPromise = (p) => {
|
|
13
|
-
return p && Object.prototype.toString.call(p) === "[object Promise]";
|
|
14
|
-
};
|
package/scripts/jsonCounter.js
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
/*!
|
|
2
|
-
* dpHelper <https://github.com/passariello/dpHelper>
|
|
3
|
-
*
|
|
4
|
-
* jsonCounter
|
|
5
|
-
*
|
|
6
|
-
* Copyright (c) 2021, Dario Passariello.
|
|
7
|
-
* Licensed under the Apache-2.0 License.
|
|
8
|
-
*/
|
|
9
|
-
|
|
10
|
-
/***********************************************************************/
|
|
11
|
-
|
|
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
|
-
};
|
package/scripts/loadFile.js
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
/*!
|
|
2
|
-
* dpHelper <https://github.com/passariello/dpHelper>
|
|
3
|
-
*
|
|
4
|
-
* loadFile
|
|
5
|
-
*
|
|
6
|
-
* Copyright (c) 2021, Dario Passariello.
|
|
7
|
-
* Licensed under the Apache-2.0 License.
|
|
8
|
-
*/
|
|
9
|
-
|
|
10
|
-
/***********************************************************************/
|
|
11
|
-
|
|
12
|
-
window.dphelper.loadFile = (element, path) => {
|
|
13
|
-
fetch(path).then(async function (response) {
|
|
14
|
-
const text = await response.text();
|
|
15
|
-
document.querySelector( element ).innerHTML = dphelper.nl2br( String(text) );
|
|
16
|
-
});
|
|
17
|
-
};
|
package/scripts/loadJson.js
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
/*!
|
|
2
|
-
* dpHelper <https://github.com/passariello/dpHelper>
|
|
3
|
-
*
|
|
4
|
-
* loadJson
|
|
5
|
-
*
|
|
6
|
-
* Copyright (c) 2021, Dario Passariello.
|
|
7
|
-
* Licensed under the Apache-2.0 License.
|
|
8
|
-
*/
|
|
9
|
-
|
|
10
|
-
/***********************************************************************/
|
|
11
|
-
|
|
12
|
-
window.dphelper.loadJson = function( file ){
|
|
13
|
-
if ( file.match(/.(json)$/i ) ) return require( '' + file + '' );
|
|
14
|
-
};
|
|
15
|
-
|