@glitchr/transparent 1.0.56 → 1.0.58
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 +48 -7
package/package.json
CHANGED
package/src/js/transparent.js
CHANGED
|
@@ -179,7 +179,8 @@ jQuery.event.special.mousewheel = { setup: function( _, ns, handle ) { this.addE
|
|
|
179
179
|
"smoothscroll_duration": "200ms",
|
|
180
180
|
"smoothscroll_speed" : 0,
|
|
181
181
|
"smoothscroll_easing" : "swing",
|
|
182
|
-
"exceptions": []
|
|
182
|
+
"exceptions": [],
|
|
183
|
+
"headlock": [],
|
|
183
184
|
};
|
|
184
185
|
|
|
185
186
|
const State = Transparent.state = {
|
|
@@ -315,7 +316,7 @@ jQuery.event.special.mousewheel = { setup: function( _, ns, handle ) { this.addE
|
|
|
315
316
|
responseText = responseText.outerHTML;
|
|
316
317
|
|
|
317
318
|
var array = JSON.parse(sessionStorage.getItem('transparent')) || [];
|
|
318
|
-
if(
|
|
319
|
+
if (!array.includes(uuid)) {
|
|
319
320
|
|
|
320
321
|
array.push(uuid);
|
|
321
322
|
while(array.length > Settings["response_limit"])
|
|
@@ -873,7 +874,6 @@ jQuery.event.special.mousewheel = { setup: function( _, ns, handle ) { this.addE
|
|
|
873
874
|
}.bind(this), active.delay);
|
|
874
875
|
}
|
|
875
876
|
|
|
876
|
-
|
|
877
877
|
Transparent.replaceCanvases = function(dom) {
|
|
878
878
|
|
|
879
879
|
// Extract existing canvas to avoid redrawing them.. (time consuming)
|
|
@@ -1224,17 +1224,59 @@ jQuery.event.special.mousewheel = { setup: function( _, ns, handle ) { this.addE
|
|
|
1224
1224
|
|
|
1225
1225
|
activeInRemainingTime = activeInRemainingTime - (Date.now() - activeInTime);
|
|
1226
1226
|
setTimeout(function() {
|
|
1227
|
-
|
|
1227
|
+
|
|
1228
1228
|
// Transfert attributes
|
|
1229
1229
|
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
|
+
}
|
|
1230
1269
|
|
|
1231
1270
|
// Replace head..
|
|
1232
1271
|
var head = $(dom).find("head");
|
|
1233
1272
|
$("head").children().each(function() {
|
|
1234
1273
|
|
|
1235
1274
|
var el = this;
|
|
1275
|
+
if (isHeadLocked(el)) {
|
|
1276
|
+
return;
|
|
1277
|
+
}
|
|
1278
|
+
|
|
1236
1279
|
var found = false;
|
|
1237
|
-
|
|
1238
1280
|
head.children().each(function() {
|
|
1239
1281
|
|
|
1240
1282
|
found = this.isEqualNode(el);
|
|
@@ -1252,7 +1294,6 @@ jQuery.event.special.mousewheel = { setup: function( _, ns, handle ) { this.addE
|
|
|
1252
1294
|
$("head").children().each(function() { found |= this.isEqualNode(el); });
|
|
1253
1295
|
if(!found) {
|
|
1254
1296
|
|
|
1255
|
-
|
|
1256
1297
|
if(this.tagName != "SCRIPT" || Settings["global_code"] == true) {
|
|
1257
1298
|
|
|
1258
1299
|
$("head").append(this.cloneNode(true));
|
|
@@ -1378,7 +1419,7 @@ jQuery.event.special.mousewheel = { setup: function( _, ns, handle ) { this.addE
|
|
|
1378
1419
|
|
|
1379
1420
|
Transparent.remToPixel = function(rem) { return parseFloat(rem) * parseFloat(getComputedStyle(document.documentElement).fontSize); }
|
|
1380
1421
|
Transparent.emToPixel = function(em, el) { return parseFloat(em ) * parseFloat(getComputedStyle(el.parentElement).fontSize); }
|
|
1381
|
-
Transparent.percentToPixel = function(p , el) { return parseFloat(p ) * el.outerWidth(); }
|
|
1422
|
+
Transparent.percentToPixel = function(p , el) { return parseFloat(p ) * $(el).outerWidth(); }
|
|
1382
1423
|
Transparent.parseToPixel = function(str, el) {
|
|
1383
1424
|
|
|
1384
1425
|
if(str === undefined) return undefined;
|