layerpro 0.0.56 → 0.0.60

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 (63) hide show
  1. package/.editorconfig +13 -0
  2. package/.env +3 -0
  3. package/.eslintignore +12 -0
  4. package/.eslintrc.json +110 -0
  5. package/.gitattributes +2 -0
  6. package/.jsbeautifyrc +26 -0
  7. package/.prettierignore +2 -0
  8. package/.prettierrc +7 -0
  9. package/.vscode/launch.json +22 -0
  10. package/.vscode/settings.json +84 -0
  11. package/.vscodeignore +28 -0
  12. package/__mocks__/fileMock.js +3 -0
  13. package/__mocks__/styleMock.js +3 -0
  14. package/babel.config.js +34 -0
  15. package/backup.bat +43 -0
  16. package/coverage/clover.xml +6 -0
  17. package/coverage/coverage-final.json +1 -0
  18. package/coverage/lcov-report/base.css +224 -0
  19. package/coverage/lcov-report/block-navigation.js +87 -0
  20. package/coverage/lcov-report/favicon.png +0 -0
  21. package/coverage/lcov-report/index.html +101 -0
  22. package/coverage/lcov-report/prettify.css +1 -0
  23. package/coverage/lcov-report/prettify.js +2 -0
  24. package/coverage/lcov-report/sort-arrow-sprite.png +0 -0
  25. package/coverage/lcov-report/sorter.js +196 -0
  26. package/coverage/lcov.info +0 -0
  27. package/{LICENSE.txt → dist/LICENSE.txt} +0 -0
  28. package/{README.md → dist/README.md} +0 -0
  29. package/documents/LICENSE.txt +21 -0
  30. package/documents/README.md +7 -0
  31. package/{SECURITY.md → documents/SECURITY.md} +0 -0
  32. package/index.js +7 -2
  33. package/init.js +35 -0
  34. package/jest.config.js +61 -0
  35. package/jsconfig.json +10 -0
  36. package/node/createTag.js +7 -0
  37. package/node/gitDeploy.js +7 -0
  38. package/node/goLive.js +7 -0
  39. package/package.json +40 -28
  40. package/scripts/GenLayer.jsx +234 -0
  41. package/scripts/message.jsx +280 -0
  42. package/scripts/mouseCoords.jsx +45 -0
  43. package/scripts/popup.jsx +604 -0
  44. package/scripts/purge.jsx +29 -0
  45. package/scripts/smoothScroll.js +69 -0
  46. package/scripts/window.js +28 -0
  47. package/styles/dock.scss +100 -0
  48. package/styles/general.scss +241 -0
  49. package/styles/icons.scss +33 -0
  50. package/styles/input.scss +35 -0
  51. package/styles/messages.scss +76 -0
  52. package/styles/resize.scss +99 -0
  53. package/styles/root.scss +14 -0
  54. package/styles/scrollbar.scss +24 -0
  55. package/tests/setupJest.tsx +4 -0
  56. package/tsconfig.json +69 -0
  57. package/typings/image.d.ts +9 -0
  58. package/typings/index.d.ts +7 -0
  59. package/typings/layerpro.d.ts +22 -0
  60. package/typings/styles.d.ts +27 -0
  61. package/typings/vscode.d.ts +14724 -0
  62. package/webpack.config.js +239 -0
  63. package/index.js.LICENSE.txt +0 -29
@@ -0,0 +1,604 @@
1
+ /*
2
+ Copyright: © 2022 Dario Passariello <dariopassariello@gmail.com>
3
+ License: MIT
4
+ */
5
+
6
+ //import React, { useState, useEffect } from "react";
7
+
8
+ import { GenLayer } from "./GenLayer.jsx"
9
+ import { mouseCoord } from "./mouseCoords.jsx"
10
+ import "./message.jsx"
11
+
12
+ import "../styles/general.scss"
13
+
14
+ $.ajaxSetup({
15
+ async: true,
16
+ cache: true,
17
+ global: true
18
+ })
19
+
20
+ const larX = 300
21
+ const larY = 150
22
+ // const prefs = localStorage.getItem('layerpro')
23
+
24
+ let isdresizableRes
25
+ let highIndex = 1
26
+ let startX
27
+ let startY
28
+ let startWidth
29
+ let startHeight
30
+ let startLeft
31
+ let startTop
32
+ let startBottom
33
+ let startRight
34
+ let Win = $(window)
35
+ let Body = $('body')
36
+
37
+ // let oldy;
38
+ // let oldx;
39
+ // let oldw;
40
+ // let oldh;
41
+
42
+ export const popup = {
43
+
44
+ open: function (p) {
45
+
46
+ if (!p) return false
47
+
48
+ p.id = p.id || Math.round(Math.random() * 1000)
49
+ p.body = p.body || null
50
+ p.width = p.width || 640
51
+ p.height = p.height || 480
52
+ p.name = p.name || 'popUp_' + p.id
53
+ p.source = p.source || null
54
+ p.icon = p.icon || null
55
+ p.iconize = p.iconize || null
56
+ p.maximize = p.maximize || null
57
+ p.isMaximize = p.isMaximize || null
58
+ p.dockable = p.dockable || null
59
+ p.close = p.close || null
60
+ p.raised = p.raised || null
61
+ p.movable = p.movable || null
62
+ p.resizable = p.resizable || null
63
+ p.store = p.store || false
64
+ p.top = p.top ? p.top : 'auto'
65
+ p.left = p.left ? p.left : 'auto'
66
+ p.right = p.right ? p.right : 'auto'
67
+ p.bottom = p.bottom ? p.bottom : 'auto'
68
+ p.fadeIn = p.fadeIn || 100
69
+ p.fadeOut = p.fadeOut || 100
70
+ p.minWidth = p.minWidth || 340
71
+ p.minHeight = p.minHeight || 220
72
+
73
+ /*******************************************************************/
74
+
75
+ // Check if windows is too small;
76
+ if (p.width < p.minWidth) p.width = p.minWidth
77
+ if (p.height < p.minHeight) p.height = p.minHeight
78
+
79
+ if (p.width === 'auto') p.width = '100%'
80
+ if (p.height === 'auto') p.height = '100%'
81
+
82
+ /*******************************************************************/
83
+
84
+ // create popUp container
85
+ if ($('#popup').length === 0) {
86
+ $('<div id="popup">', '#popup')
87
+ .appendTo('body')
88
+ .css({
89
+ 'pointer-events': 'none',
90
+ 'z-index': popup.zIndex($('*')) + 1
91
+ })
92
+ }
93
+
94
+ // Creation of final PopUp (avoid to recreate if same id exist)
95
+ if ($('.popup_window_' + p.id, '#popup').length === 0) {
96
+ GenLayer(p)
97
+ }
98
+
99
+ /*******************************************************************/
100
+
101
+ // window.onresize = function( p ){
102
+ // if( Win.width() < 600 ) layerpro.popup.maximize( p );
103
+ // console.log('r');
104
+ // };
105
+
106
+ /*******************************************************************/
107
+
108
+ layerpro.purge(document)
109
+ return p
110
+
111
+ },
112
+
113
+ show: function (item) {
114
+ item.toggle()
115
+ return false
116
+ },
117
+
118
+ vfx: function (item, vis, all = false) {
119
+
120
+ setTimeout(() => {
121
+
122
+ $('[class^="popup_overflow_"]', '#popup')
123
+ .css('opacity', vis == true ? 1 : 0.5)
124
+ .find('[class^="popup_body_"]')
125
+ .css({ 'content-visibility': vis == true ? 'auto' : 'hidden' })
126
+
127
+ item.css('opacity', 1)
128
+
129
+ if (!all) $('[class^="popup_body_"]', item).css('content-visibility', 'visible')
130
+
131
+ return false
132
+
133
+ }, 0)
134
+
135
+ window.dispatchEvent(new Event('resize'))
136
+
137
+ },
138
+
139
+ center: function (p) {
140
+ let _overflow = $('.popup_overflow_' + p.id, '#popup')
141
+ _overflow.css("top", Math.max(0, ((Win.height() - _overflow.outerHeight()) / 2) + Win.scrollTop()))
142
+ _overflow.css("left", Math.max(0, ((Win.width() - _overflow.outerWidth()) / 2) + Win.scrollLeft()))
143
+ return false
144
+ },
145
+
146
+ checkArea: function (e) {
147
+ return [
148
+ e.clientX,
149
+ e.clientY,
150
+ Win.scrollLeft(),
151
+ Win.scrollTop(),
152
+ Win.height(),
153
+ Win.width()
154
+ ]
155
+ },
156
+
157
+ close: function (p) {
158
+
159
+ if (!p) {
160
+
161
+ $("#popup").fadeOut(function () {
162
+ $(this).remove()
163
+ })
164
+
165
+ } else {
166
+
167
+ if (p.raised === true) {
168
+
169
+ $('.popup_raised_' + p.id).fadeOut(p.fadeOut, function () {
170
+ $('.popup_raised_' + p.id).remove()
171
+ })
172
+
173
+ } else {
174
+
175
+ $('.popup_overflow_' + p.id).fadeOut(p.fadeOut, function () {
176
+ $(this).remove()
177
+ popup.removeDock(p)
178
+ })
179
+
180
+ }
181
+
182
+ }
183
+
184
+ layerpro.purge(document)
185
+ localStorage.removeItem('popup_' + p.id)
186
+ return false
187
+
188
+ },
189
+
190
+ removeDock: function (p) {
191
+
192
+ $(".icon_" + p.id).remove()
193
+
194
+ if ($('[class^="popup_overflow_"]', '#popup').length <= 0) {
195
+ $('#popup_dock').remove()
196
+ $('#root').css('margin', '0')
197
+ }
198
+
199
+ return false
200
+
201
+ },
202
+
203
+ iconize: function (p) {
204
+
205
+ let _overflow = $('.popup_overflow_' + p.id, '#popup')
206
+
207
+ // iconize only if is top layer
208
+ if (_overflow.find('[class^=popup_window_]').hasClass("zHigh") === false) return false
209
+
210
+ popup.vfx(_overflow, false, true)
211
+
212
+ if (!_overflow.data('iconize')) {
213
+
214
+ _overflow.animate({
215
+ top: '100%',
216
+ left: $('.icon_' + p.id, '#popup_dock').offset().left + 15,
217
+ width: 0,
218
+ height: 0,
219
+ opacity: 0
220
+ }, 200, function () {
221
+
222
+ popup.vfx(_overflow, true)
223
+
224
+ })
225
+
226
+ _overflow.data('iconize', {
227
+ y: _overflow.offset().top,
228
+ x: _overflow.offset().left,
229
+ w: _overflow.width(),
230
+ h: _overflow.height()
231
+
232
+ }, 200)
233
+
234
+ } else if (_overflow.data('iconize')) {
235
+
236
+ var s = _overflow.data('iconize')
237
+
238
+ _overflow.animate({
239
+ top: s.y,
240
+ left: s.x,
241
+ width: s.w,
242
+ height: s.h,
243
+ opacity: 1,
244
+ }, function () {
245
+
246
+ popup.vfx(_overflow, true)
247
+
248
+ })
249
+
250
+ _overflow.removeData('iconize')
251
+
252
+ }
253
+
254
+ return false
255
+ },
256
+
257
+
258
+ maximize: function (p) {
259
+
260
+ let _overflow = $('.popup_overflow_' + p.id, '#popup')
261
+ let gap = 6
262
+
263
+ popup.vfx(_overflow, false, true)
264
+
265
+ if (!_overflow.data('store')) {
266
+
267
+ _overflow.data('store', {
268
+ y: _overflow.offset().top,
269
+ x: _overflow.offset().left,
270
+ w: _overflow.width(),
271
+ h: _overflow.height()
272
+ })
273
+
274
+ _overflow.animate({
275
+ position: 'absolute',
276
+ top: -gap,
277
+ left: -gap,
278
+ right: -gap,
279
+ bottom: - gap,
280
+ width: Win.width() + (gap * 2),
281
+ height: Win.height() + (gap * 2) - 45,
282
+ }, function () {
283
+
284
+ Win.on("resize.eventItem", function () {
285
+ _overflow
286
+ .css({
287
+ width: Win.width() + (gap * 2),
288
+ height: Win.height() + (gap * 2) - 40,
289
+ })
290
+ })
291
+
292
+ $('[class^="resize_"]', _overflow).off('mousedown')
293
+ popup.vfx(_overflow, true, true)
294
+
295
+ })
296
+
297
+ } else if (_overflow.data('store')) {
298
+
299
+ var s = _overflow.data('store')
300
+
301
+ _overflow.animate({
302
+ top: s.y,
303
+ left: s.x,
304
+ width: s.w,
305
+ height: s.h,
306
+ }, function () {
307
+
308
+ $("[class^='resize_']",)
309
+ .on('mousedown', function (e) {
310
+ popup.ResizePopups(e, this)
311
+ })
312
+
313
+ Win.off("resize.eventItem")
314
+ popup.vfx(_overflow, true)
315
+
316
+ })
317
+
318
+ _overflow.removeData('store')
319
+
320
+ }
321
+
322
+ return false
323
+ },
324
+
325
+ movable: function (p) {
326
+
327
+ if (!p.movable) return
328
+
329
+ let _overflow = $('.popup_overflow_' + p.id, '#popup')
330
+ let _dragger = $('.popup_drag_' + p.id, _overflow)
331
+ let _body = $('.popup_body_' + p.id, _overflow)
332
+
333
+ let pos1 = 0, pos2 = 0, pos3 = 0, pos4 = 0
334
+
335
+ _dragger.on('mousedown', function (e) {
336
+ _body.css('pointer-events', 'none')
337
+
338
+ if (Win.width() > _overflow.width()) {
339
+
340
+ dragMouseDown(e)
341
+ popup.vfx(_overflow, false)
342
+
343
+ } else {
344
+
345
+ e.stopImmediatePropagation()
346
+ return false
347
+
348
+ }
349
+ })
350
+
351
+ _dragger.on('dblclick', function (p) {
352
+ layerpro.popup.maximize(p)
353
+ })
354
+
355
+ function dragMouseDown(e) {
356
+ pos3 = e.clientX
357
+ pos4 = e.clientY
358
+ document.addEventListener('mousemove', elementDrag)
359
+ document.addEventListener('mouseup', elementDragEnd)
360
+ return false
361
+ }
362
+
363
+ function elementDrag(e) {
364
+
365
+ pos1 = pos3 - e.clientX
366
+ pos2 = pos4 - e.clientY
367
+ pos3 = e.clientX
368
+ pos4 = e.clientY
369
+
370
+ if (popup.checkArea(e)[1] < popup.checkArea(e)[4] && Math.sign(popup.checkArea(e)[1]) === 1) _overflow.css('top', (_overflow.offset().top - pos2))
371
+ if (popup.checkArea(e)[0] < popup.checkArea(e)[5] && Math.sign(popup.checkArea(e)[0]) === 1) _overflow.css('left', (_overflow.offset().left - pos1))
372
+
373
+ return false
374
+
375
+ }
376
+
377
+ function elementDragEnd() {
378
+ document.onmouseup = null
379
+ document.onmousemove = null
380
+ _body.css('pointer-events', 'auto')
381
+ popup.vfx(_overflow, true)
382
+ return false
383
+ }
384
+
385
+ return false
386
+
387
+ },
388
+
389
+ resizable: function (p) {
390
+
391
+ if (!p.resizable) return
392
+
393
+ let _overflow = $('.popup_overflow_' + p.id, '#popup')
394
+
395
+ // EDGE
396
+ $("<div class='resize_0'>", _overflow).appendTo(_overflow)
397
+ $("<div class='resize_1'>", _overflow).appendTo(_overflow)
398
+ $("<div class='resize_2'>", _overflow).appendTo(_overflow)
399
+ $("<div class='resize_3'>", _overflow).appendTo(_overflow)
400
+
401
+ // CORNERS
402
+ $("<div class='resize_corner_0'>", _overflow).appendTo(_overflow)
403
+ $("<div class='resize_corner_1'>", _overflow).appendTo(_overflow)
404
+ $("<div class='resize_corner_2'>", _overflow).appendTo(_overflow)
405
+ $("<div class='resize_corner_3'>", _overflow).appendTo(_overflow)
406
+
407
+ $("[class^='resize_']",)
408
+ .on('mousedown', function (e) {
409
+ popup.ResizePopups(e, this)
410
+ })
411
+
412
+ return false
413
+
414
+ },
415
+
416
+ ResizePopups: function (e, id) {
417
+
418
+ let _sizer = $(id)
419
+ let _parent = _sizer.parent()
420
+ let cords = mouseCoord(e)
421
+ Body.css('pointer-events', 'none')
422
+ _parent.css('pointer-events', 'none')
423
+
424
+ popup.vfx(_parent, false)
425
+
426
+ document.addEventListener('mousemove', (e) => { popup.doRes(e, id) })
427
+ document.addEventListener('mouseup', () => { popup.stopRes(id) })
428
+
429
+ startX = cords[0]
430
+ startY = cords[1]
431
+
432
+ startWidth = _parent.width()
433
+ startHeight = _parent.height()
434
+ startLeft = _parent.position().left
435
+ startTop = _parent.position().top
436
+ startBottom = startTop + startHeight + 1
437
+ startRight = startLeft + startWidth + 1
438
+
439
+ isdresizableRes = id
440
+
441
+ return false
442
+
443
+ },
444
+
445
+ doRes: function (e, id) {
446
+
447
+ window.dispatchEvent(new Event('resize'))
448
+
449
+ const _sizer = $(id)
450
+ const _parent = _sizer.parent()
451
+ const cords = mouseCoord(e)
452
+
453
+ if (id === isdresizableRes) {
454
+
455
+ let X = (startWidth + cords[0] - startX)
456
+ let Y = (startHeight + cords[1] - startY)
457
+ let X1 = (startWidth - cords[0] + startX)
458
+ let Y1 = (startHeight - cords[1] + startY)
459
+
460
+ if (X <= 0) { X = 0 }
461
+ if (Y <= 0) { Y = 0 }
462
+
463
+ /********************************************************************************************************************************************/
464
+
465
+ // TOP DRAG
466
+ if (popup.checkArea(e)[1] < popup.checkArea(e)[4] && Math.sign(popup.checkArea(e)[1]) === 1 && _sizer.hasClass("resize_0")) {
467
+ if (_parent.height() >= larY) { _parent.css({ 'top': Number.parseInt(startBottom - Y1), 'height': Number.parseInt(Y1) }) }
468
+ if (_parent.height() <= larY && Y1 > larY) { _parent.css({ 'height': Number.parseInt(larY + 1) }) }
469
+ }
470
+
471
+ if (popup.checkArea(e)[0] < popup.checkArea(e)[5] && Math.sign(popup.checkArea(e)[0]) === 1 && // RIGHT DRAG
472
+ _sizer.hasClass("resize_1")) {
473
+ if (_parent.width() >= larX) { _parent.css({ 'width': Number.parseInt(X), 'right': Number.parseInt(startLeft - X) }) }
474
+ if (_parent.width() <= larX) { _parent.css({ 'width': Number.parseInt(larX + 1) }) }
475
+ }
476
+
477
+ if (popup.checkArea(e)[1] < popup.checkArea(e)[4] && Math.sign(popup.checkArea(e)[1]) === 1 && // BOTTOM DRAG
478
+ _sizer.hasClass("resize_2")) {
479
+ if (_parent.height() >= larY) { _parent.css({ 'height': Number.parseInt(Y) }) }
480
+ if (_parent.height() <= larY && Y > larY) { _parent.css({ 'height': Number.parseInt(larY + 1) }) }
481
+ }
482
+
483
+ if (popup.checkArea(e)[0] < popup.checkArea(e)[5] && Math.sign(popup.checkArea(e)[0]) === 1 && // LEFT DRAG
484
+ _sizer.hasClass("resize_3")) {
485
+ if (_parent.width() >= larX) { _parent.css({ 'width': Number.parseInt(X1), 'left': Number.parseInt(startRight - X1) }) }
486
+ if (_parent.width() <= larX && X1 > larX) { _parent.css({ 'width': Number.parseInt(larX + 1) }) }
487
+ }
488
+
489
+ /********************************************************************************************************************************************/
490
+
491
+ if (
492
+ popup.checkArea(e)[1] < popup.checkArea(e)[4] &&
493
+ popup.checkArea(e)[0] < popup.checkArea(e)[5] &&
494
+ Math.sign(popup.checkArea(e)[0]) === 1 &&
495
+ Math.sign(popup.checkArea(e)[1]) === 1
496
+ ) {
497
+
498
+ // TOP LEFT
499
+ if (_sizer.hasClass("resize_corner_0")) {
500
+ if (_parent.height() >= larY) { _parent.css({ 'top': Number.parseInt(startBottom - Y1), 'height': Number.parseInt(Y1) }) }
501
+ if (_parent.height() <= larY && Y1 > larY) { _parent.css({ 'height': Number.parseInt(larY + 1) }) }
502
+ if (_parent.width() >= larX) { _parent.css({ 'width': Number.parseInt(X1), 'left': Number.parseInt(startRight - X1) }) }
503
+ if (_parent.width() <= larX && X1 > larX) { _parent.css({ 'width': Number.parseInt(larX + 1) }) }
504
+ }
505
+
506
+ // TOP RIGHT
507
+ if (_sizer.hasClass("resize_corner_1")) {
508
+ if (_parent.height() >= larY) { _parent.css({ 'top': Number.parseInt(startBottom - Y1), 'height': Number.parseInt(Y1) }) }
509
+ if (_parent.height() <= larY && Y1 > larY) { _parent.css({ 'height': Number.parseInt(larY + 1) }) }
510
+ if (_parent.width() >= larX) { _parent.css({ 'width': Number.parseInt(X), 'right': Number.parseInt(startLeft - X) }) }
511
+ if (_parent.width() <= larX) { _parent.css({ 'width': Number.parseInt(larX + 1) }) }
512
+ }
513
+
514
+ // BOTTOM RIGHT
515
+ if (_sizer.hasClass("resize_corner_2")) {
516
+ if (_parent.height() >= larY) { _parent.css({ 'height': Number.parseInt(Y) }) }
517
+ if (_parent.height() <= larY && Y > larY) { _parent.css({ 'height': Number.parseInt(larY + 1) }) }
518
+ if (_parent.width() >= larX) { _parent.css({ 'width': Number.parseInt(X), 'right': Number.parseInt(startLeft - X) }) }
519
+ if (_parent.width() <= larX) { _parent.css({ 'width': Number.parseInt(larX + 1) }) }
520
+ }
521
+
522
+ // BOTTOM LEFT
523
+ if (_sizer.hasClass("resize_corner_3")) {
524
+ if (_parent.height() >= larY) { _parent.css({ 'height': Number.parseInt(Y) }) }
525
+ if (_parent.height() <= larY && Y > larY) { _parent.css({ 'height': Number.parseInt(larY + 1) }) }
526
+ if (_parent.width() >= larX) { _parent.css({ 'width': Number.parseInt(X1), 'left': Number.parseInt(startRight - X1) }) }
527
+ if (_parent.width() <= larX && X1 > larX) { _parent.css({ 'width': Number.parseInt(larX + 1) }) }
528
+ }
529
+
530
+ }
531
+
532
+ }
533
+
534
+ return false
535
+
536
+ },
537
+
538
+ stopRes: function (id) {
539
+
540
+ let _sizer = $(id)
541
+ let _parent = _sizer.parent()
542
+ Body.css('pointer-events', 'auto')
543
+ _parent.css('pointer-events', 'auto')
544
+
545
+ popup.vfx(_parent, true)
546
+
547
+ isdresizableRes = false
548
+ document.onmouseup = null
549
+ document.onmousemove = null
550
+
551
+ return false
552
+
553
+ },
554
+
555
+ index: function (p) {
556
+
557
+ let _overflow = $('[class^="popup_overflow_"]', '#popup')
558
+
559
+ $('[class^="popup_window_"]', '#popup').removeClass('zHigh')
560
+ $('[class^="popup_bar_"]', '#popup').removeClass('pupup_bar_selected')
561
+ $('[class^="icon_"]', '#popup').removeClass('pupup_bar_selected')
562
+
563
+ _overflow.each(function () {
564
+ $(this, '#popup')
565
+ .css('zIndex', $(this, '#popup')[0].style.zIndex - 1)
566
+ })
567
+
568
+ $(".icon_" + p.id, '#popup')
569
+ .addClass('pupup_bar_selected')
570
+
571
+ $(".popup_overflow_" + p.id, '#popup')
572
+ .css('zIndex', popup.zIndex(_overflow))
573
+
574
+ $(".popup_bar_" + p.id, '#popup')
575
+ .addClass('pupup_bar_selected')
576
+
577
+ $(".popup_window_" + p.id, '#popup')
578
+ .addClass('zHigh')
579
+
580
+ return false
581
+
582
+ },
583
+
584
+ zIndex: function (els) {
585
+
586
+ els.each(function () {
587
+ let currentIndex = Number.parseInt($(this, '#popup').css("zIndex"), 10)
588
+
589
+ if (currentIndex > highIndex) {
590
+ highIndex = currentIndex
591
+ }
592
+
593
+ })
594
+
595
+ return highIndex + 1
596
+
597
+ }
598
+
599
+ }
600
+
601
+ /**************************************************************************/
602
+ // MAKE GLOBAL
603
+
604
+ layerpro.popup = popup
@@ -0,0 +1,29 @@
1
+ /*
2
+ Copyright: © 2022 Dario Passariello <dariopassariello@gmail.com>
3
+ License: MIT
4
+ */
5
+
6
+ layerpro.purge = (d) => {
7
+
8
+ var a = d.attributes, index, l, n
9
+
10
+ if (a) {
11
+ l = a.length
12
+ for (index = 0; index < l; index += 1) {
13
+ n = a[index].name
14
+ if (typeof d[n] === 'function') {
15
+ //d[n] = null;
16
+ }
17
+ }
18
+ }
19
+
20
+ a = d.childNodes
21
+
22
+ if (a) {
23
+ l = a.length
24
+ for (index = 0; index < l; index += 1) {
25
+ layerpro.purge(d.childNodes[index])
26
+ }
27
+ }
28
+
29
+ }
@@ -0,0 +1,69 @@
1
+ /*
2
+ Copyright: © 2022 Dario Passariello <dariopassariello@gmail.com>
3
+ License: MIT
4
+ */
5
+
6
+ //(function () {
7
+ // new SmoothScroll( document, 120, 12 );
8
+ //})();
9
+
10
+ function SmoothScroll(target, speed, smooth) {
11
+ if (target === document)
12
+ target = (document.scrollingElement || document.documentElement || document.body.parentNode || document.body)
13
+
14
+ var moving = false
15
+ var pos = target.scrollTop
16
+ var frame = target === document.body && document.documentElement ? document.documentElement : target
17
+
18
+ target.addEventListener('mousewheel', scrolled, { passive: false })
19
+ target.addEventListener('DOMMouseScroll', scrolled, { passive: false })
20
+
21
+ function scrolled(e) {
22
+ e.preventDefault() // disable default scrolling
23
+
24
+ var delta = normalizeWheelDelta(e)
25
+
26
+ pos += -delta * speed
27
+ pos = Math.max(0, Math.min(pos, target.scrollHeight - frame.clientHeight)) // limit scrolling
28
+
29
+ if (!moving) update()
30
+ }
31
+
32
+ function normalizeWheelDelta(e) {
33
+ if (e.detail) {
34
+ if (e.wheelDelta)
35
+ return e.wheelDelta / e.detail / 40 * (e.detail > 0 ? 1 : -1) // Opera
36
+ else
37
+ return -e.detail / 3 // Firefox
38
+ } else
39
+ return e.wheelDelta / 120 // IE,Safari,Chrome
40
+ }
41
+
42
+ function update() {
43
+ moving = true
44
+
45
+ var delta = (pos - target.scrollTop) / smooth
46
+
47
+ target.scrollTop += delta
48
+
49
+ if (Math.abs(delta) > 0.5) {
50
+ requestFrame(update)
51
+ } else {
52
+ moving = false
53
+ }
54
+ }
55
+
56
+ var requestFrame = function () { // requestAnimationFrame cross browser
57
+ return (
58
+ window.requestAnimationFrame ||
59
+ window.webkitRequestAnimationFrame ||
60
+ window.mozRequestAnimationFrame ||
61
+ window.oRequestAnimationFrame ||
62
+ window.msRequestAnimationFrame ||
63
+ function (function_) {
64
+ window.setTimeout(function_, 1000 / 50)
65
+ }
66
+ )
67
+ }()
68
+
69
+ }