@glitchr/transparent 1.0.59 → 1.0.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/package.json +1 -1
- package/src/js/transparent.js +16 -13
package/package.json
CHANGED
package/src/js/transparent.js
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import $ from 'jquery';
|
|
2
|
+
|
|
1
3
|
// Modern browser: use passive event listeners where appropriate for better performance
|
|
2
4
|
jQuery.event.special.touchstart = { setup: function( _, ns, handle ) { this.addEventListener("touchstart", handle, { passive: !ns.includes("noPreventDefault") }); } };
|
|
3
5
|
jQuery.event.special.touchmove = { setup: function( _, ns, handle ) { this.addEventListener("touchmove", handle, { passive: !ns.includes("noPreventDefault") }); } };
|
|
@@ -12,6 +14,7 @@ jQuery.event.special.mousewheel = { setup: function( _, ns, handle ) { this.addE
|
|
|
12
14
|
} else if (typeof exports === 'object') {
|
|
13
15
|
module.exports = factory();
|
|
14
16
|
} else {
|
|
17
|
+
root = window;
|
|
15
18
|
root.Transparent = factory();
|
|
16
19
|
}
|
|
17
20
|
|
|
@@ -575,7 +578,7 @@ jQuery.event.special.mousewheel = { setup: function( _, ns, handle ) { this.addE
|
|
|
575
578
|
}
|
|
576
579
|
}
|
|
577
580
|
|
|
578
|
-
closestEl = $(el).closest("a");
|
|
581
|
+
var closestEl = $(el).closest("a");
|
|
579
582
|
if(!closestEl.length) closestEl = $(el).closest("button");
|
|
580
583
|
if(!closestEl.length) closestEl = $(el).closest("input");
|
|
581
584
|
if (closestEl.length) el = closestEl[0];
|
|
@@ -974,19 +977,19 @@ jQuery.event.special.mousewheel = { setup: function( _, ns, handle ) { this.addE
|
|
|
974
977
|
var maxScrollY = $(el).prop("scrollHeight") - Math.round($(el).prop("clientHeight"));
|
|
975
978
|
if (maxScrollY == 0) maxScrollY = Math.round($(el).prop("clientHeight"));
|
|
976
979
|
|
|
977
|
-
scrollTop = Math.max(0, Math.min(dict["top"] ?? $(el).prop("scrollTop"), maxScrollY));
|
|
978
|
-
scrollLeft = Math.max(0, Math.min(dict["left"] ?? $(el).prop("scrollLeft"), maxScrollX));
|
|
980
|
+
var scrollTop = Math.max(0, Math.min(dict["top"] ?? $(el).prop("scrollTop"), maxScrollY));
|
|
981
|
+
var scrollLeft = Math.max(0, Math.min(dict["left"] ?? $(el).prop("scrollLeft"), maxScrollX));
|
|
979
982
|
|
|
980
|
-
speed = parseFloat(dict["speed"] ?? 0);
|
|
981
|
-
easing = dict["easing"] ?? "swing";
|
|
982
|
-
debounce = dict["debounce"] ?? 0;
|
|
983
|
+
var speed = parseFloat(dict["speed"] ?? 0);
|
|
984
|
+
var easing = dict["easing"] ?? "swing";
|
|
985
|
+
var debounce = dict["debounce"] ?? 0;
|
|
983
986
|
|
|
984
|
-
duration = 1000*Transparent.parseDuration(dict["duration"] ?? 0);
|
|
985
|
-
durationX = 1000*Transparent.parseDuration(dict["duration-x"] ?? dict["duration"] ?? 0);
|
|
986
|
-
durationY = 1000*Transparent.parseDuration(dict["duration-y"] ?? dict["duration"] ?? 0);
|
|
987
|
+
var duration = 1000*Transparent.parseDuration(dict["duration"] ?? 0);
|
|
988
|
+
var durationX = 1000*Transparent.parseDuration(dict["duration-x"] ?? dict["duration"] ?? 0);
|
|
989
|
+
var durationY = 1000*Transparent.parseDuration(dict["duration-y"] ?? dict["duration"] ?? 0);
|
|
987
990
|
|
|
988
991
|
if(speed) {
|
|
989
|
-
|
|
992
|
+
|
|
990
993
|
var currentScrollX = $(el)[0].scrollLeft;
|
|
991
994
|
if(currentScrollX < scrollLeft || scrollLeft == 0) // Going to the right
|
|
992
995
|
distanceX = Math.abs(scrollLeft - currentScrollX);
|
|
@@ -1319,7 +1322,7 @@ jQuery.event.special.mousewheel = { setup: function( _, ns, handle ) { this.addE
|
|
|
1319
1322
|
var scrollableElements = Transparent.getScrollableElement();
|
|
1320
1323
|
var scrollableElementsXY = Transparent.getResponsePosition(uuid);
|
|
1321
1324
|
|
|
1322
|
-
for(i = 0; i < scrollableElements.length; i++) {
|
|
1325
|
+
for(var i = 0; i < scrollableElements.length; i++) {
|
|
1323
1326
|
|
|
1324
1327
|
var el = scrollableElements[i];
|
|
1325
1328
|
var positionXY = undefined;
|
|
@@ -1457,7 +1460,7 @@ jQuery.event.special.mousewheel = { setup: function( _, ns, handle ) { this.addE
|
|
|
1457
1460
|
var elementsXY = [];
|
|
1458
1461
|
var elements = Transparent.getScrollableElement();
|
|
1459
1462
|
|
|
1460
|
-
for(i = 0; i < elements.length; i++)
|
|
1463
|
+
for(var i = 0; i < elements.length; i++)
|
|
1461
1464
|
elementsXY.push([$(elements[i]).scrollTop(), $(elements[i]).scrollLeft()]);
|
|
1462
1465
|
|
|
1463
1466
|
return elementsXY;
|
|
@@ -1597,7 +1600,7 @@ jQuery.event.special.mousewheel = { setup: function( _, ns, handle ) { this.addE
|
|
|
1597
1600
|
var responseURL;
|
|
1598
1601
|
responseURL = xhr !== null ? xhr.responseURL : url.href;
|
|
1599
1602
|
|
|
1600
|
-
responseText = Transparent.getResponseText(uuid);
|
|
1603
|
+
var responseText = Transparent.getResponseText(uuid);
|
|
1601
1604
|
|
|
1602
1605
|
var fragmentPos = responseURL.indexOf("#");
|
|
1603
1606
|
var strippedResponseUrl = (fragmentPos < 0 ? responseURL : responseURL.substring(0, fragmentPos)).trimEnd("/");
|