@glitchr/transparent 1.0.58 → 1.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.
package/README.md CHANGED
@@ -1 +1,2 @@
1
1
  # TransparentJS
2
+
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@glitchr/transparent",
3
- "version": "1.0.58",
3
+ "version": "1.0.60",
4
4
  "description": "Transparent SPA Application",
5
5
  "main": "src/index.js",
6
6
  "access": "public",
@@ -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
 
@@ -179,8 +182,7 @@ jQuery.event.special.mousewheel = { setup: function( _, ns, handle ) { this.addE
179
182
  "smoothscroll_duration": "200ms",
180
183
  "smoothscroll_speed" : 0,
181
184
  "smoothscroll_easing" : "swing",
182
- "exceptions": [],
183
- "headlock": [],
185
+ "exceptions": []
184
186
  };
185
187
 
186
188
  const State = Transparent.state = {
@@ -955,6 +957,7 @@ jQuery.event.special.mousewheel = { setup: function( _, ns, handle ) { this.addE
955
957
  Transparent.evalScript($("body")[0]);
956
958
  }
957
959
 
960
+ Transparent.scrollTo({top:0, left:0, duration:0});
958
961
  Transparent.activeOut();
959
962
  }
960
963
 
@@ -1224,59 +1227,17 @@ jQuery.event.special.mousewheel = { setup: function( _, ns, handle ) { this.addE
1224
1227
 
1225
1228
  activeInRemainingTime = activeInRemainingTime - (Date.now() - activeInTime);
1226
1229
  setTimeout(function() {
1227
-
1230
+
1228
1231
  // Transfert attributes
1229
1232
  Transparent.transferAttributes(dom);
1230
- function isHeadLocked(el) {
1231
-
1232
- // only for <script>, <link>, etc. that carry a URL
1233
- const raw = (el.getAttribute("src") || el.getAttribute("href") || "").trim();
1234
- if (!raw) return false;
1235
-
1236
- // normalize to an absolute href string
1237
- let href = raw;
1238
- try { href = new URL(raw, location.href).href; } catch {}
1239
-
1240
- return Settings.headlock.some((rule) => {
1241
- if (rule instanceof RegExp) {
1242
- return rule.test(href); // <= test against the string, not url.href
1243
- }
1244
-
1245
- if (typeof rule === "string") {
1246
-
1247
- if (rule.includes("*")) {
1248
- const pattern = "^" + rule
1249
- .replace(/[.+^${}()|[\]\\]/g, "\\$&")
1250
- .replace(/\*/g, ".*") + "$";
1251
- return new RegExp(pattern).test(href);
1252
- }
1253
-
1254
- // No wildcard: treat as origin/prefix
1255
- // If rule parses as a URL, compare origins; otherwise do simple prefix
1256
- try {
1257
- const r = new URL(rule, location.href);
1258
- const u = new URL(href);
1259
- // Match same origin, OR rule is a full URL prefix of href
1260
- return (u.origin === r.origin) || href.startsWith(r.href);
1261
- } catch {
1262
- return href.startsWith(rule);
1263
- }
1264
- }
1265
-
1266
- return false;
1267
- });
1268
- }
1269
1233
 
1270
1234
  // Replace head..
1271
1235
  var head = $(dom).find("head");
1272
1236
  $("head").children().each(function() {
1273
1237
 
1274
1238
  var el = this;
1275
- if (isHeadLocked(el)) {
1276
- return;
1277
- }
1278
-
1279
1239
  var found = false;
1240
+
1280
1241
  head.children().each(function() {
1281
1242
 
1282
1243
  found = this.isEqualNode(el);
@@ -1294,6 +1255,7 @@ jQuery.event.special.mousewheel = { setup: function( _, ns, handle ) { this.addE
1294
1255
  $("head").children().each(function() { found |= this.isEqualNode(el); });
1295
1256
  if(!found) {
1296
1257
 
1258
+
1297
1259
  if(this.tagName != "SCRIPT" || Settings["global_code"] == true) {
1298
1260
 
1299
1261
  $("head").append(this.cloneNode(true));