dphelper 0.2.57 → 0.2.62
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/index.js +2 -10
- package/index.js.LICENSE.txt +24 -0
- package/package.json +3 -2
- package/.editorconfig +0 -15
- package/.env +0 -3
- package/.eslintignore +0 -8
- package/.eslintrc.json +0 -36
- package/.gitattributes +0 -2
- package/.hintrc +0 -11
- package/.jsbeautifyrc +0 -25
- package/.jshintrc +0 -14
- package/.prettierignore +0 -2
- package/.prettierrc +0 -7
- package/.vscode/settings.json +0 -54
- package/3party/shortcut.js +0 -224
- package/backup.bat +0 -43
- package/data/list.json +0 -19
- package/dist/LICENSE +0 -201
- package/dist/README.md +0 -176
- package/index.d.ts +0 -14
- package/init.js +0 -48
- package/jest.config.js +0 -18
- package/public/assets/images/banner.png +0 -0
- package/public/assets/logos/logo.svg +0 -64
- package/scripts/anchorToOnClick.js +0 -47
- package/scripts/array.js +0 -142
- package/scripts/browser.js +0 -65
- package/scripts/console.js +0 -86
- package/scripts/coodinates.js +0 -41
- package/scripts/cookie.js +0 -97
- package/scripts/currency.js +0 -41
- package/scripts/date.js +0 -101
- package/scripts/disable.js +0 -90
- package/scripts/event.js +0 -39
- package/scripts/font.js +0 -52
- package/scripts/form.js +0 -113
- package/scripts/function.js +0 -47
- package/scripts/indexedDB.js +0 -222
- package/scripts/json.js +0 -42
- package/scripts/load.js +0 -85
- package/scripts/noCache.js +0 -26
- package/scripts/number.js +0 -66
- package/scripts/obj.js +0 -81
- package/scripts/onBeforeUnLoad.js +0 -120
- package/scripts/parseBool.js +0 -27
- package/scripts/path.js +0 -94
- package/scripts/promise.js +0 -35
- package/scripts/purge.js +0 -53
- package/scripts/screen.js +0 -64
- package/scripts/scrollbar.js +0 -245
- package/scripts/shortcut.js +0 -70
- package/scripts/storage.js +0 -62
- package/scripts/svg.js +0 -372
- package/scripts/text.js +0 -78
- package/scripts/time.js +0 -41
- package/scripts/timer.js +0 -35
- package/scripts/trigger.js +0 -46
- package/scripts/type.js +0 -56
- package/scripts/uuid.js +0 -33
- package/scripts/window.js +0 -50
- package/tests/ld-json-funtions.test.ts +0 -21
- package/tests/ld-json.test.ts +0 -46
- package/webpack.config.js +0 -240
package/scripts/scrollbar.js
DELETED
|
@@ -1,245 +0,0 @@
|
|
|
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" : "Scrollbar",
|
|
11
|
-
"description" : "test",
|
|
12
|
-
"version" : "0.0.1",
|
|
13
|
-
"command" : "scrollbar",
|
|
14
|
-
"subCommand" : [
|
|
15
|
-
{
|
|
16
|
-
"name":"custom",
|
|
17
|
-
"description":"test"
|
|
18
|
-
},{
|
|
19
|
-
"name":"indicator",
|
|
20
|
-
"description":"test"
|
|
21
|
-
},{
|
|
22
|
-
"name":"position.get",
|
|
23
|
-
"description":"test"
|
|
24
|
-
},{
|
|
25
|
-
"name":"position.set",
|
|
26
|
-
"description":"test"
|
|
27
|
-
},{
|
|
28
|
-
"name":"smooth",
|
|
29
|
-
"description":"test"
|
|
30
|
-
},{
|
|
31
|
-
"name":"scrollTo",
|
|
32
|
-
"description":"test"
|
|
33
|
-
}
|
|
34
|
-
],
|
|
35
|
-
"example" : "",
|
|
36
|
-
"author" : "Dario Passariello",
|
|
37
|
-
"active" : true
|
|
38
|
-
};
|
|
39
|
-
|
|
40
|
-
dphelper._list.scripts.push( description );
|
|
41
|
-
|
|
42
|
-
/***********************************************************************/
|
|
43
|
-
|
|
44
|
-
dphelper.scrollbar = {
|
|
45
|
-
|
|
46
|
-
custom: ( el, options ) => {
|
|
47
|
-
|
|
48
|
-
if(!options['color_1']) options['color_1'] = "black";
|
|
49
|
-
if(!options['color_2']) options['color_2'] = "transparent";
|
|
50
|
-
if(!options['color_3']) options['color_3'] = "rgba(30,150,255,.5)";
|
|
51
|
-
if(!options['type']) options['type'] = "thin";
|
|
52
|
-
if(!options['behavior']) options['behavior'] = "smooth";
|
|
53
|
-
if(!options['width']) options['width'] = "8px";
|
|
54
|
-
if(!options['height']) options['height'] = "8px";
|
|
55
|
-
if(!options['rounded']) options['rounded'] = "25px";
|
|
56
|
-
if(!options['margin']) options['margin'] = "5px";
|
|
57
|
-
if(!options['border']) options['border'] = "5px solid transparent";
|
|
58
|
-
|
|
59
|
-
const $style = `${el}{
|
|
60
|
-
scrollbar-width:auto;
|
|
61
|
-
scrollbar-color:${options['color_1']} ${options['color_2']};
|
|
62
|
-
scrollbar-width: ${options['type']};
|
|
63
|
-
scroll-behavior: ${options['behavior']};
|
|
64
|
-
scroll-margin: ${options['margin']};
|
|
65
|
-
-ms-overflow-style: -ms-autohiding-scrollbar;
|
|
66
|
-
}
|
|
67
|
-
${el}::-webkit-scrollbar {
|
|
68
|
-
scroll-behavior: ${options['behavior']};
|
|
69
|
-
width: ${options['width']};
|
|
70
|
-
height: ${options['height']};
|
|
71
|
-
}
|
|
72
|
-
${el}::-webkit-scrollbar-track {
|
|
73
|
-
background: ${options['color_2']};
|
|
74
|
-
border-radius: ${options['rounded']};
|
|
75
|
-
}
|
|
76
|
-
${el}::-webkit-scrollbar-thumb {
|
|
77
|
-
-webkit-border-radius: ${options['rounded']};
|
|
78
|
-
border-radius: ${options['rounded']};
|
|
79
|
-
background: ${options['color_1']};
|
|
80
|
-
border:
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
/* ${el}::-webkit-scrollbar-thumb:window-inactive {
|
|
84
|
-
background: ${options['color_3']}
|
|
85
|
-
}*/
|
|
86
|
-
`;
|
|
87
|
-
|
|
88
|
-
let styleToHead = document.createElement( "style" );
|
|
89
|
-
document.head.appendChild( styleToHead );
|
|
90
|
-
styleToHead.innerHTML = $style;
|
|
91
|
-
|
|
92
|
-
},
|
|
93
|
-
|
|
94
|
-
indicator: ( props ) => {
|
|
95
|
-
|
|
96
|
-
/**
|
|
97
|
-
/* This timeout it's to be suse that whole UI is loaded
|
|
98
|
-
/* Just smaller trick!
|
|
99
|
-
*/
|
|
100
|
-
|
|
101
|
-
let cont = document.querySelector( props.el );
|
|
102
|
-
let sc = document.querySelector('.scrollindicator');
|
|
103
|
-
|
|
104
|
-
if( !sc ){
|
|
105
|
-
|
|
106
|
-
const createEl = document.createElement('div');
|
|
107
|
-
createEl.classList.add("scrollindicator");
|
|
108
|
-
document.querySelector('header').appendChild(createEl);
|
|
109
|
-
|
|
110
|
-
createEl.style.cssText = `
|
|
111
|
-
height:5px;
|
|
112
|
-
background:#65c45c;
|
|
113
|
-
position:absolute;
|
|
114
|
-
bottom:0;
|
|
115
|
-
left:0;
|
|
116
|
-
z-index:2
|
|
117
|
-
`;
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
if( !props.el && sc) {
|
|
121
|
-
sc.style.width = 0 + '%';
|
|
122
|
-
return null;
|
|
123
|
-
}
|
|
124
|
-
|
|
125
|
-
try{
|
|
126
|
-
let sc = document.querySelector('.scrollindicator');
|
|
127
|
-
cont.addEventListener( 'scroll' , function ( e ) {
|
|
128
|
-
|
|
129
|
-
sc.style.width = 0 + '%';
|
|
130
|
-
let winScroll = this.scrollTop || this.scrollTop;
|
|
131
|
-
let height = this.scrollHeight - this.clientHeight;
|
|
132
|
-
let scrolled = Math.min(Math.max(parseInt( (winScroll / height) * 100 ), 0), 100);
|
|
133
|
-
sc.style.width = scrolled + '%';
|
|
134
|
-
|
|
135
|
-
sc.click();
|
|
136
|
-
|
|
137
|
-
});
|
|
138
|
-
|
|
139
|
-
window.addEventListener('popstate', function ( e ) {
|
|
140
|
-
sc.style.width = 0;
|
|
141
|
-
});
|
|
142
|
-
|
|
143
|
-
}catch( e ){
|
|
144
|
-
return;
|
|
145
|
-
}
|
|
146
|
-
|
|
147
|
-
return null;
|
|
148
|
-
|
|
149
|
-
},
|
|
150
|
-
|
|
151
|
-
position: {
|
|
152
|
-
|
|
153
|
-
set: ( el ) => {
|
|
154
|
-
let ar = [ $( el ).scrollTop() , $( el ).scrollLeft() ];
|
|
155
|
-
if( ar[0] != null && ar[1] != null ){ dphelper.storage.set( el , ar ); }
|
|
156
|
-
},
|
|
157
|
-
|
|
158
|
-
get: ( el ) => {
|
|
159
|
-
if( !dphelper.storage.get( el ) ) return;
|
|
160
|
-
let ar = dphelper.storage.get( el ).trim().split(',');
|
|
161
|
-
$( el ).scrollTop( ar[0] );
|
|
162
|
-
$( el ).scrollLeft( ar[1] );
|
|
163
|
-
}
|
|
164
|
-
|
|
165
|
-
},
|
|
166
|
-
|
|
167
|
-
smooth: (target, speed, smooth) => {
|
|
168
|
-
|
|
169
|
-
if (target === document)
|
|
170
|
-
target = (document.scrollingElement || document.documentElement || document.body.parentNode || document.body); // cross browser support for document scrolling
|
|
171
|
-
|
|
172
|
-
let moving = false;
|
|
173
|
-
let pos = target.scrollTop;
|
|
174
|
-
let frame = target === document.body && document.documentElement ? document.documentElement : target; // safari is the new IE
|
|
175
|
-
|
|
176
|
-
target.addEventListener('mousewheel', scrolled, { passive: false });
|
|
177
|
-
target.addEventListener('DOMMouseScroll', scrolled, { passive: false });
|
|
178
|
-
|
|
179
|
-
function scrolled( e ) {
|
|
180
|
-
e.preventDefault(); // disable default scrolling
|
|
181
|
-
|
|
182
|
-
let delta = normalizeWheelDelta( e );
|
|
183
|
-
|
|
184
|
-
pos += -delta * speed;
|
|
185
|
-
pos = Math.max(0, Math.min(pos, target.scrollHeight - frame.clientHeight)); // limit scrolling
|
|
186
|
-
|
|
187
|
-
if (!moving) update();
|
|
188
|
-
}
|
|
189
|
-
|
|
190
|
-
function normalizeWheelDelta( e ){
|
|
191
|
-
if(e.detail){
|
|
192
|
-
if(e.wheelDelta)
|
|
193
|
-
return e.wheelDelta/e.detail/40 * (e.detail>0 ? 1 : -1); // Opera
|
|
194
|
-
else
|
|
195
|
-
return -e.detail/3; // Firefox
|
|
196
|
-
}else
|
|
197
|
-
return e.wheelDelta/120; // IE,Safari,Chrome
|
|
198
|
-
}
|
|
199
|
-
|
|
200
|
-
function update() {
|
|
201
|
-
moving = true;
|
|
202
|
-
|
|
203
|
-
let delta = (pos - target.scrollTop) / smooth;
|
|
204
|
-
|
|
205
|
-
target.scrollTop += delta;
|
|
206
|
-
|
|
207
|
-
if (Math.abs(delta) > 0.5)
|
|
208
|
-
requestFrame(update);
|
|
209
|
-
else
|
|
210
|
-
moving = false;
|
|
211
|
-
}
|
|
212
|
-
|
|
213
|
-
let requestFrame = function() { // requestAnimationFrame cross browser
|
|
214
|
-
return (
|
|
215
|
-
window.requestAnimationFrame ||
|
|
216
|
-
window.webkitRequestAnimationFrame ||
|
|
217
|
-
window.mozRequestAnimationFrame ||
|
|
218
|
-
window.oRequestAnimationFrame ||
|
|
219
|
-
window.msRequestAnimationFrame ||
|
|
220
|
-
function(func) {
|
|
221
|
-
window.setTimeout(func, 1000 / 50);
|
|
222
|
-
}
|
|
223
|
-
);
|
|
224
|
-
}();
|
|
225
|
-
|
|
226
|
-
},
|
|
227
|
-
|
|
228
|
-
scrollTo: function( container, element, gap = 0 ) {
|
|
229
|
-
|
|
230
|
-
let el1 = document.querySelector( container );
|
|
231
|
-
let el2 = document.querySelector( element );
|
|
232
|
-
let el3 = gap; // DIVERGENCE
|
|
233
|
-
|
|
234
|
-
if( !el1 || !el2 || !el3 ) return;
|
|
235
|
-
|
|
236
|
-
el1.scrollTo({
|
|
237
|
-
top: el2.offsetTop,
|
|
238
|
-
behavior: "smooth"
|
|
239
|
-
});
|
|
240
|
-
|
|
241
|
-
}
|
|
242
|
-
|
|
243
|
-
};
|
|
244
|
-
|
|
245
|
-
//example: dphelper.scrollbar.custom('*')
|
package/scripts/shortcut.js
DELETED
|
@@ -1,70 +0,0 @@
|
|
|
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" : "Handle Shortcut",
|
|
11
|
-
"description" : "test",
|
|
12
|
-
"version" : "0.0.1",
|
|
13
|
-
"command" : "shortcut",
|
|
14
|
-
"example" : "",
|
|
15
|
-
"author" : "Dario Passariello",
|
|
16
|
-
"active" : true
|
|
17
|
-
};
|
|
18
|
-
|
|
19
|
-
dphelper._list.scripts.push( description );
|
|
20
|
-
|
|
21
|
-
/***********************************************************************/
|
|
22
|
-
|
|
23
|
-
dphelper.shortcut = ( e, trigger ) => {
|
|
24
|
-
const code = e.which ? e.which : e.keyCode;
|
|
25
|
-
|
|
26
|
-
if( !trigger ) trigger = {
|
|
27
|
-
// EXAMPLES:
|
|
28
|
-
"data" : [
|
|
29
|
-
{
|
|
30
|
-
"key" : "83",
|
|
31
|
-
"ctrl" : true,
|
|
32
|
-
"active" : true,
|
|
33
|
-
"description" : "CTRL+S",
|
|
34
|
-
//"element" : "#formSave",
|
|
35
|
-
"function" : ""
|
|
36
|
-
},
|
|
37
|
-
{
|
|
38
|
-
"key" : "27",
|
|
39
|
-
"ctrl" : false,
|
|
40
|
-
"active" : true,
|
|
41
|
-
"description" : "ESC",
|
|
42
|
-
"element" : "",
|
|
43
|
-
"function" : ""
|
|
44
|
-
},
|
|
45
|
-
{
|
|
46
|
-
"key" : "80",
|
|
47
|
-
"ctrl" : true,
|
|
48
|
-
"active" : true,
|
|
49
|
-
"description" : "CTRL+P",
|
|
50
|
-
"element" : "",
|
|
51
|
-
"function" : "function(){ Print }"
|
|
52
|
-
}
|
|
53
|
-
]
|
|
54
|
-
};
|
|
55
|
-
|
|
56
|
-
trigger.map( list => {
|
|
57
|
-
|
|
58
|
-
// IF CTRL COMMAND
|
|
59
|
-
if ( e.ctrlKey || e.metaKey && list.ctrl === true ) {
|
|
60
|
-
if( code === parseInt(list.key) && list.active === true ){
|
|
61
|
-
if( list.element ) simulateClick( list.element );
|
|
62
|
-
if( list.function ) JSON.stringify( list.function );
|
|
63
|
-
e.preventDefault();
|
|
64
|
-
return;
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
});
|
|
69
|
-
|
|
70
|
-
};
|
package/scripts/storage.js
DELETED
|
@@ -1,62 +0,0 @@
|
|
|
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" : "Local Storage Manager",
|
|
11
|
-
"description" : "test",
|
|
12
|
-
"version" : "0.0.1",
|
|
13
|
-
"command" : "storage",
|
|
14
|
-
"subCommand" : [
|
|
15
|
-
{
|
|
16
|
-
"name":"get",
|
|
17
|
-
"description":"test"
|
|
18
|
-
},{
|
|
19
|
-
"name":"set",
|
|
20
|
-
"description":"test"
|
|
21
|
-
},{
|
|
22
|
-
"name":"delete",
|
|
23
|
-
"description":"test"
|
|
24
|
-
},{
|
|
25
|
-
"name":"clearAll",
|
|
26
|
-
"description":"test"
|
|
27
|
-
}
|
|
28
|
-
],
|
|
29
|
-
"example" : "",
|
|
30
|
-
"author" : "Dario Passariello",
|
|
31
|
-
"active" : true
|
|
32
|
-
};
|
|
33
|
-
|
|
34
|
-
dphelper._list.scripts.push( description );
|
|
35
|
-
|
|
36
|
-
/***********************************************************************/
|
|
37
|
-
|
|
38
|
-
dphelper.storage = {
|
|
39
|
-
|
|
40
|
-
get: function( name ) {
|
|
41
|
-
if(!name) return;
|
|
42
|
-
return window.localStorage.getItem( name );
|
|
43
|
-
},
|
|
44
|
-
|
|
45
|
-
set: function( name, value ) {
|
|
46
|
-
if(!name || !value) return;
|
|
47
|
-
window.localStorage.setItem( name, JSON.stringify(value) );
|
|
48
|
-
},
|
|
49
|
-
|
|
50
|
-
delete: function( name ) {
|
|
51
|
-
if(!name) return;
|
|
52
|
-
window.localStorage.removeItem( name );
|
|
53
|
-
},
|
|
54
|
-
|
|
55
|
-
clearAll: function() {
|
|
56
|
-
window.localStorage.clear();
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
};
|
|
60
|
-
|
|
61
|
-
// START STORAGE DB
|
|
62
|
-
// dphelper.storage.set( "dpHelper", 'active' );
|