dphelper 0.0.1 → 0.0.2

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.
Files changed (53) hide show
  1. package/.editorconfig +12 -0
  2. package/3party/shortcut.js +224 -0
  3. package/init.js +71 -4
  4. package/package.json +6 -5
  5. package/scripts/anchorToOnClick.js +36 -0
  6. package/scripts/arrayItemFinder.js +22 -0
  7. package/scripts/arrayMerge.js +20 -0
  8. package/scripts/currency.js +21 -0
  9. package/scripts/date2Iso.js +20 -0
  10. package/scripts/date2MMDDYYYY.js +16 -0
  11. package/scripts/dateConvert.js +20 -0
  12. package/scripts/dateIso2Epoch.js +17 -0
  13. package/scripts/dateLocal-ISOTime.js +17 -0
  14. package/scripts/dateUTC.js +14 -0
  15. package/scripts/disableSelect.js +41 -0
  16. package/scripts/disableSpellCheck.js +21 -0
  17. package/scripts/epoch.js +14 -0
  18. package/scripts/fullScreen.js +40 -0
  19. package/scripts/handleEvent.js +59 -0
  20. package/scripts/isPromise.js +14 -0
  21. package/scripts/jsonCounter.js +21 -0
  22. package/scripts/loadAsset.js +26 -0
  23. package/scripts/loadFile.js +17 -0
  24. package/scripts/loadJson.js +15 -0
  25. package/scripts/loadJsonExternal.js +32 -0
  26. package/scripts/nl2br.js +14 -0
  27. package/scripts/noCache.js +14 -0
  28. package/scripts/object2array.js +18 -0
  29. package/scripts/onBeforeUnLoad.js +108 -0
  30. package/scripts/parseBool.js +15 -0
  31. package/scripts/parseDate.js +19 -0
  32. package/scripts/pathHash.js +20 -0
  33. package/scripts/pathQuery.js +24 -0
  34. package/scripts/pathRail.js +26 -0
  35. package/scripts/printInfo.js +16 -0
  36. package/scripts/purge.js +41 -0
  37. package/scripts/pushState.js +14 -0
  38. package/scripts/randomNum.js +14 -0
  39. package/scripts/randomNumTmr.js +14 -0
  40. package/scripts/scrollCustom.js +41 -0
  41. package/scripts/scrollIndicator.js +67 -0
  42. package/scripts/scrollMemory.js +26 -0
  43. package/scripts/scrollSmooth.js +74 -0
  44. package/scripts/scrollToElement.js +25 -0
  45. package/scripts/serializeForm.js +92 -0
  46. package/scripts/serializeObj.js +47 -0
  47. package/scripts/sleep.js +14 -0
  48. package/scripts/stopConsole.js +49 -0
  49. package/scripts/svgSupport.js +346 -0
  50. package/scripts/textChanger.js +24 -0
  51. package/scripts/triggerClick.js +16 -0
  52. package/scripts/uuid.js +14 -0
  53. package/scripts/window.js +38 -0
package/.editorconfig ADDED
@@ -0,0 +1,12 @@
1
+ root = true
2
+
3
+ [*]
4
+ charset = utf-8
5
+
6
+ tab_width = 2
7
+ indent_size = 2
8
+ indent_style = space
9
+
10
+ end_of_line = crlf
11
+ #trim_trailing_whitespace = true
12
+ #insert_final_newline = true
@@ -0,0 +1,224 @@
1
+ /**
2
+ * http://www.openjs.com/scripts/events/keyboard_shortcuts/
3
+ * Version : 2.01.B
4
+ * By Binny V A
5
+ * License : BSD
6
+ */
7
+
8
+ shortcut = {
9
+ 'all_shortcuts':{},//All the shortcuts are stored in this array
10
+ 'add': function(shortcut_combination,callback,opt) {
11
+ //Provide a set of default options
12
+ let default_options = {
13
+ 'type':'keydown',
14
+ 'propagate':false,
15
+ 'disable_in_input':false,
16
+ 'target':document,
17
+ 'keycode':false
18
+ }
19
+ if(!opt) opt = default_options;
20
+ else {
21
+ for(let dfo in default_options) {
22
+ if(typeof opt[dfo] == 'undefined') opt[dfo] = default_options[dfo];
23
+ }
24
+ }
25
+
26
+ let ele = opt.target;
27
+ if(typeof opt.target == 'string') ele = document.getElementById(opt.target);
28
+ let ths = this;
29
+ shortcut_combination = shortcut_combination.toLowerCase();
30
+
31
+ //The function to be called at keypress
32
+ let func = function( e ) {
33
+ e = e || window.event;
34
+
35
+ if(opt['disable_in_input']) { //Don't enable shortcut keys in Input, Textarea fields
36
+ let element;
37
+ if(e.target) element=e.target;
38
+ else if(e.srcElement) element=e.srcElement;
39
+ if(element.nodeType==3) element=element.parentNode;
40
+
41
+ if(element.tagName == 'INPUT' || element.tagName == 'TEXTAREA') return;
42
+ }
43
+
44
+ //Find Which key is pressed
45
+ if (e.keyCode) code = e.keyCode;
46
+ else if (e.which) code = e.which;
47
+ let character = String.fromCharCode(code).toLowerCase();
48
+
49
+ if(code == 188) character=","; //If the user presses , when the type is onkeydown
50
+ if(code == 190) character="."; //If the user presses , when the type is onkeydown
51
+
52
+ let keys = shortcut_combination.split("+");
53
+ //Key Pressed - counts the number of valid keypresses - if it is same as the number of keys, the shortcut function is invoked
54
+ let kp = 0;
55
+
56
+ //Work around for stupid Shift key bug created by using lowercase - as a result the shift+num combination was broken
57
+ let shift_nums = {
58
+ "`":"~",
59
+ "1":"!",
60
+ "2":"@",
61
+ "3":"#",
62
+ "4":"$",
63
+ "5":"%",
64
+ "6":"^",
65
+ "7":"&",
66
+ "8":"*",
67
+ "9":"(",
68
+ "0":")",
69
+ "-":"_",
70
+ "=":"+",
71
+ ";":":",
72
+ "'":"\"",
73
+ ",":"<",
74
+ ".":">",
75
+ "/":"?",
76
+ "\\":"|"
77
+ }
78
+ //Special Keys - and their codes
79
+ let special_keys = {
80
+ 'esc':27,
81
+ 'escape':27,
82
+ 'tab':9,
83
+ 'space':32,
84
+ 'return':13,
85
+ 'enter':13,
86
+ 'backspace':8,
87
+
88
+ 'scrolllock':145,
89
+ 'scroll_lock':145,
90
+ 'scroll':145,
91
+ 'capslock':20,
92
+ 'caps_lock':20,
93
+ 'caps':20,
94
+ 'numlock':144,
95
+ 'num_lock':144,
96
+ 'num':144,
97
+
98
+ 'pause':19,
99
+ 'break':19,
100
+
101
+ 'insert':45,
102
+ 'home':36,
103
+ 'delete':46,
104
+ 'end':35,
105
+
106
+ 'pageup':33,
107
+ 'page_up':33,
108
+ 'pu':33,
109
+
110
+ 'pagedown':34,
111
+ 'page_down':34,
112
+ 'pd':34,
113
+
114
+ 'left':37,
115
+ 'up':38,
116
+ 'right':39,
117
+ 'down':40,
118
+
119
+ 'f1':112,
120
+ 'f2':113,
121
+ 'f3':114,
122
+ 'f4':115,
123
+ 'f5':116,
124
+ 'f6':117,
125
+ 'f7':118,
126
+ 'f8':119,
127
+ 'f9':120,
128
+ 'f10':121,
129
+ 'f11':122,
130
+ 'f12':123
131
+ }
132
+
133
+ let modifiers = {
134
+ shift: { wanted:false, pressed:false},
135
+ ctrl : { wanted:false, pressed:false},
136
+ alt : { wanted:false, pressed:false},
137
+ meta : { wanted:false, pressed:false} //Meta is Mac specific
138
+ };
139
+
140
+ if(e.ctrlKey) modifiers.ctrl.pressed = true;
141
+ if(e.shiftKey) modifiers.shift.pressed = true;
142
+ if(e.altKey) modifiers.alt.pressed = true;
143
+ if(e.metaKey) modifiers.meta.pressed = true;
144
+
145
+ for(let i=0; k=keys[i],i<keys.length; i++) {
146
+ //Modifiers
147
+ if(k == 'ctrl' || k == 'control') {
148
+ kp++;
149
+ modifiers.ctrl.wanted = true;
150
+
151
+ } else if(k == 'shift') {
152
+ kp++;
153
+ modifiers.shift.wanted = true;
154
+
155
+ } else if(k == 'alt') {
156
+ kp++;
157
+ modifiers.alt.wanted = true;
158
+ } else if(k == 'meta') {
159
+ kp++;
160
+ modifiers.meta.wanted = true;
161
+ } else if(k.length > 1) { //If it is a special key
162
+ if(special_keys[k] == code) kp++;
163
+
164
+ } else if(opt['keycode']) {
165
+ if(opt['keycode'] == code) kp++;
166
+
167
+ } else { //The special keys did not match
168
+ if(character == k) kp++;
169
+ else {
170
+ if(shift_nums[character] && e.shiftKey) { //Stupid Shift key bug created by using lowercase
171
+ character = shift_nums[character];
172
+ if(character == k) kp++;
173
+ }
174
+ }
175
+ }
176
+ }
177
+
178
+ if(kp == keys.length &&
179
+ modifiers.ctrl.pressed == modifiers.ctrl.wanted &&
180
+ modifiers.shift.pressed == modifiers.shift.wanted &&
181
+ modifiers.alt.pressed == modifiers.alt.wanted &&
182
+ modifiers.meta.pressed == modifiers.meta.wanted) {
183
+ callback( e );
184
+
185
+ if(!opt['propagate']) { //Stop the event
186
+ //e.cancelBubble is supported by IE - this will kill the bubbling process.
187
+ e.cancelBubble = true;
188
+ e.returnValue = false;
189
+
190
+ //e.stopPropagation works in Firefox.
191
+ if (e.stopPropagation) {
192
+ e.stopPropagation();
193
+ e.preventDefault();
194
+ }
195
+ return false;
196
+ }
197
+ }
198
+ }
199
+ this.all_shortcuts[shortcut_combination] = {
200
+ 'callback':func,
201
+ 'target':ele,
202
+ 'event': opt['type']
203
+ };
204
+ //Attach the function with the event
205
+ if(ele.addEventListener) ele.addEventListener(opt['type'], func, false);
206
+ else if(ele.attachEvent) ele.attachEvent('on'+opt['type'], func);
207
+ else ele['on'+opt['type']] = func;
208
+ },
209
+
210
+ //Remove the shortcut - just specify the shortcut and I will remove the binding
211
+ 'remove':function(shortcut_combination) {
212
+ shortcut_combination = shortcut_combination.toLowerCase();
213
+ let binding = this.all_shortcuts[shortcut_combination];
214
+ delete(this.all_shortcuts[shortcut_combination])
215
+ if(!binding) return;
216
+ let type = binding['event'];
217
+ let ele = binding['target'];
218
+ let callback = binding['callback'];
219
+
220
+ if(ele.detachEvent) ele.detachEvent('on'+type, callback);
221
+ else if(ele.removeEventListener) ele.removeEventListener(type, callback, false);
222
+ else ele['on'+type] = false;
223
+ }
224
+ }
package/init.js CHANGED
@@ -27,9 +27,76 @@
27
27
  console.debug( 'author: %c' + pjson.author.name,"color:orange","" );
28
28
  console.debug( 'email: %c' + pjson.author.email,"color:orange","" );
29
29
  console.groupEnd();
30
+
31
+ const $ = require("jquery");
32
+
33
+ // 3party
34
+ require('./3party/shortcut.js');
30
35
 
31
- //require('./scripts/cookie.js');
32
- //require('./scripts/storage.js');
33
- //require('./scripts/indexedDB.js');
34
-
36
+ // CURRENCY
37
+ require('./scripts/currency.js');
38
+
39
+ // NUMBERS
40
+ require('./scripts/randomNumberTmr.js');
41
+ require('./scripts/randomNumber.js');
42
+
43
+ // TIME
44
+ require('./scripts/epoch.js');
45
+ require('./scripts/parseDate.js');
46
+ require('./scripts/dateUTC.js');
47
+ require('./scripts/dateIso2Epoch.js');
48
+ require('./scripts/dateConvert.js');
49
+ require('./scripts/date2MMDDYYYY.js');
50
+ require('./scripts/date2Iso.js');
51
+ require('./scripts/dateLocal-ISOTime.js');
52
+
53
+ // PATH
54
+ require('./scripts/pathRails.js');
55
+ require('./scripts/pathQuery.js');
56
+ require('./scripts/pathHash.js');
57
+ require('./scripts/pushState.js');
58
+ require('./scripts/anchorToOnClick.js');
59
+
60
+ // FILE
61
+ require('./scripts/loadFile.js');
62
+ require('./scripts/loadAsset.js');
63
+ require('./scripts/loadJson.js');
64
+ require('./scripts/loadJsonExternal.js');
65
+
66
+ // FORMS
67
+ require('./scripts/serializeForm.js');
68
+
69
+ // ARRAY
70
+ require('./scripts/arrayItemFinder.js');
71
+ require('./scripts/arrayMerge.js');
72
+ require('./scripts/object2array.js');
73
+
74
+ // SCROLL
75
+ require('./scripts/scrollToElement.js');
76
+ require('./scripts/scrollSmooth.js');
77
+ require('./scripts/scrollIndicator.js');
78
+ require('./scripts/scrollMemory.js');
79
+ require('./scripts/scrollCustom.js');
80
+
81
+ // OTHER
82
+ require('./scripts/uuid.js');
83
+ require('./scripts/noCache.js');
84
+ require('./scripts/parseBool.js');
85
+ require('./scripts/isPromise.js');
86
+ require('./scripts/textChanger.js');
87
+ require('./scripts/nl2br.js');
88
+ require('./scripts/sleep.js');
89
+ require('./scripts/printInfo.js');
90
+ require('./scripts/disableSelect.js');
91
+ require('./scripts/fullScreen.js');
92
+ require('./scripts/disableSpellCheck.js');
93
+ require('./scripts/serializeObj.js');
94
+ require('./scripts/triggerClick.js');
95
+ require('./scripts/handleEvent.js');
96
+ require('./scripts/window.js');
97
+ require('./scripts/purge.js');
98
+ require('./scripts/svgSupport.js');
99
+ require('./scripts/stopConsole.js');
100
+ require('./scripts/onBeforeUnLoad.js');
101
+
35
102
  })();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dphelper",
3
- "version": "0.0.1",
3
+ "version": "0.0.2",
4
4
  "description": "Many utils for your projects",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -12,13 +12,13 @@
12
12
  },
13
13
  "repository": {
14
14
  "type": "git",
15
- "url": "https://github.com/passariello/tool-utils",
16
- "help": "https://github.com/passariello/tool-utils#readme"
15
+ "url": "https://github.com/passariello/dpHelper",
16
+ "help": "https://github.com/passariello/dpHelper#readme"
17
17
  },
18
18
  "bugs": {
19
- "url": "https://github.com/passariello/tool-utils/issues"
19
+ "url": "https://github.com/passariello/dpHelper/issues"
20
20
  },
21
- "homepage": "https://github.com/passariello/tool-utils",
21
+ "homepage": "https://github.com/passariello/dpHelper",
22
22
  "keywords": [
23
23
  "utils",
24
24
  "tools",
@@ -38,6 +38,7 @@
38
38
  },
39
39
  "license": "Apache-2.0",
40
40
  "dependencies": {
41
+ "jquery": "^3.6.0",
41
42
  "jshint": "^2.13.1"
42
43
  },
43
44
  "contributors": [
@@ -0,0 +1,36 @@
1
+ /*!
2
+ * dpHelper <https://github.com/passariello/dpHelper>
3
+ *
4
+ * anchorToOnClick
5
+ *
6
+ * Copyright (c) 2021, Dario Passariello.
7
+ * Licensed under the Apache-2.0 License.
8
+ */
9
+
10
+ /***********************************************************************/
11
+
12
+ dphelper.anchorToOnClick = function(){
13
+ // const $ = require("jquery");
14
+
15
+ $('a').each( function( index ) {
16
+
17
+ let elem = $( this );
18
+ let href = elem.attr( 'href' );
19
+
20
+ if( href ){
21
+ elem
22
+ .on( 'mouseup', function(){
23
+ Loader( 'body' , null );
24
+ })
25
+ .css('cursor','pointer')
26
+ .addClass( wng.pathRail()[3].replace(/\//g, '') )
27
+ .removeAttr( 'href' )
28
+ .on( 'click', function(){
29
+ window.location.href = href;
30
+ history.pushState('', '', href);
31
+ });
32
+ }
33
+
34
+ });
35
+
36
+ };
@@ -0,0 +1,22 @@
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
+ 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 = wng.arrayFindItem(id, node.children);
18
+ if (finalNode) return finalNode;
19
+ }
20
+ }
21
+ return false;
22
+ };
@@ -0,0 +1,20 @@
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
+ 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], wng.mergeArrays(target[key], source[key]));
16
+ }
17
+
18
+ Object.assign(target || {}, source);
19
+ return target;
20
+ };
@@ -0,0 +1,21 @@
1
+ /*!
2
+ * dpHelper <https://github.com/passariello/dpHelper>
3
+ *
4
+ * currency
5
+ *
6
+ * Copyright (c) 2021, Dario Passariello.
7
+ * Licensed under the Apache-2.0 License.
8
+ */
9
+
10
+ /***********************************************************************/
11
+
12
+ 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
+
19
+ // return ( val ).toFixed(2).replace(/\d(?=(\d{3})+\.)/g, '$&,')
20
+ return formatter.format( val );
21
+ };
@@ -0,0 +1,20 @@
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
+ 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
+ };
@@ -0,0 +1,16 @@
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
+ 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
+ };
@@ -0,0 +1,20 @@
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
+ 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
+ };
@@ -0,0 +1,17 @@
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
+ dphelper.dateIso2Epoch = (value) => {
13
+ if (!value) value = '';
14
+ let date = new Date(value);
15
+ let milliseconds = date.getTime();
16
+ return milliseconds;
17
+ };
@@ -0,0 +1,17 @@
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
+ 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
+ };
@@ -0,0 +1,14 @@
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
+ dphelper.dateUTC = () => {
13
+ return moment().toISOString();
14
+ };
@@ -0,0 +1,41 @@
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
+ dphelper.disableSelect = function( e ){
13
+
14
+ const $ = require("jquery");
15
+
16
+ $( 'body' ).each( function(){
17
+
18
+ $( this )
19
+ .prop( "unselectable" , "on" )
20
+ .css( "MozUserSelect" , "none" )
21
+ .css( "WebKitUserSelect" , "none" )
22
+ .on( "select" , function(){ return false; })
23
+ .on( "selectstart" , function(){ return false; });
24
+
25
+ //this.onselectstart = function() { return false }
26
+ //this.oncontextmenu = function() { return false }
27
+
28
+ $( 'img, a, input, button' ).on( 'dragstart' , function( e ) {
29
+ e.preventDefault();
30
+ return false;
31
+ });
32
+
33
+ });
34
+
35
+ };
36
+
37
+ if( wng.selectionDisabled === true ){
38
+ document.body.addEventListener('mousedown',function( e ){ DisableSelect(); }, false );
39
+ document.body.onmousedown = function( e ){ DisableSelect( e ); };
40
+ console.debug("%cSelection Disabled:%c " + wng.selectionDisabled, "color:gray", "");
41
+ }
@@ -0,0 +1,21 @@
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
+ 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
+ };
@@ -0,0 +1,14 @@
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
+ dphelper.epoch = () => {
13
+ return new Date().getTime();
14
+ };
@@ -0,0 +1,40 @@
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
+ 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
+ // dphelper.fullScreenToggle( document.body )
24
+ };
25
+
26
+ /*****************************************************************************************/
27
+
28
+ 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
+ // dphelper.fullScreen( document.body )
39
+
40
+ };