@glitchr/transparent 1.0.26 → 1.0.28
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 +29 -36
package/package.json
CHANGED
package/src/js/transparent.js
CHANGED
|
@@ -906,6 +906,7 @@
|
|
|
906
906
|
var head = $(dom).find("head").html();
|
|
907
907
|
var body = $(dom).find("body").html();
|
|
908
908
|
|
|
909
|
+
console.log(head, body);
|
|
909
910
|
if(head == undefined || body == "undefined") {
|
|
910
911
|
|
|
911
912
|
$(Settings.identifier).html("<div class='error'></div>");
|
|
@@ -1178,14 +1179,19 @@
|
|
|
1178
1179
|
// Transfert attributes
|
|
1179
1180
|
Transparent.transferAttributes(dom);
|
|
1180
1181
|
|
|
1181
|
-
// Replace head..
|
|
1182
|
+
// Replace head..
|
|
1182
1183
|
var head = $(dom).find("head");
|
|
1183
1184
|
$("head").children().each(function() {
|
|
1184
1185
|
|
|
1185
1186
|
var el = this;
|
|
1186
1187
|
var found = false;
|
|
1187
1188
|
|
|
1188
|
-
head.children().each(function() {
|
|
1189
|
+
head.children().each(function() {
|
|
1190
|
+
|
|
1191
|
+
found = this.isEqualNode(el);
|
|
1192
|
+
return !found;
|
|
1193
|
+
});
|
|
1194
|
+
|
|
1189
1195
|
if(!found) this.remove();
|
|
1190
1196
|
});
|
|
1191
1197
|
|
|
@@ -1202,30 +1208,16 @@
|
|
|
1202
1208
|
}
|
|
1203
1209
|
});
|
|
1204
1210
|
|
|
1205
|
-
// Replace body end (@TODO keep ordering, by adding after.. last node probed)
|
|
1206
1211
|
var bodyScript = $(dom).find("body > script");
|
|
1207
|
-
|
|
1208
|
-
|
|
1209
|
-
var el = this;
|
|
1210
|
-
var found = false;
|
|
1212
|
+
bodyScript.each(function() {
|
|
1211
1213
|
|
|
1212
|
-
|
|
1213
|
-
|
|
1214
|
-
});
|
|
1214
|
+
var el = this;
|
|
1215
|
+
var found = false;
|
|
1215
1216
|
|
|
1216
|
-
|
|
1217
|
-
|
|
1218
|
-
|
|
1219
|
-
var found = false;
|
|
1217
|
+
$("body").children().each(function() { found |= this.isEqualNode(el); });
|
|
1218
|
+
if(!found) $("body").append(this);
|
|
1219
|
+
});
|
|
1220
1220
|
|
|
1221
|
-
$("body").find("script").each(function() { found |= this.isEqualNode(el); });
|
|
1222
|
-
if(!found) {
|
|
1223
|
-
|
|
1224
|
-
if(this.tagName != "SCRIPT" || Settings["global_code"] == true) $("body").append(this.cloneNode(true));
|
|
1225
|
-
else $("body").append(this);
|
|
1226
|
-
}
|
|
1227
|
-
});
|
|
1228
|
-
|
|
1229
1221
|
// Replace canvases..
|
|
1230
1222
|
Transparent.replaceCanvases(dom);
|
|
1231
1223
|
|
|
@@ -1253,7 +1245,8 @@
|
|
|
1253
1245
|
oldPage.remove();
|
|
1254
1246
|
|
|
1255
1247
|
if(Settings["global_code"] == true) Transparent.evalScript($(page)[0]);
|
|
1256
|
-
dispatchEvent(new Event('DOMContentLoaded'));
|
|
1248
|
+
document.dispatchEvent(new Event('DOMContentLoaded'));
|
|
1249
|
+
window.dispatchEvent(new Event('DOMContentLoaded'));
|
|
1257
1250
|
|
|
1258
1251
|
Transparent.addLayout();
|
|
1259
1252
|
|
|
@@ -1286,21 +1279,19 @@
|
|
|
1286
1279
|
}
|
|
1287
1280
|
|
|
1288
1281
|
$('head').append(function() {
|
|
1289
|
-
$('body').append(function() {
|
|
1290
1282
|
|
|
1291
|
-
|
|
1283
|
+
$(Settings.identifier).append(function() {
|
|
1292
1284
|
|
|
1293
|
-
|
|
1285
|
+
setTimeout(function() {
|
|
1294
1286
|
|
|
1295
|
-
|
|
1296
|
-
|
|
1287
|
+
// Callback if needed, or any other actions
|
|
1288
|
+
callback();
|
|
1297
1289
|
|
|
1298
|
-
|
|
1299
|
-
|
|
1300
|
-
|
|
1290
|
+
// Trigger onload event
|
|
1291
|
+
dispatchEvent(new Event('transparent:load'));
|
|
1292
|
+
dispatchEvent(new Event('load'));
|
|
1301
1293
|
|
|
1302
|
-
|
|
1303
|
-
});
|
|
1294
|
+
}.bind(this), 1);
|
|
1304
1295
|
});
|
|
1305
1296
|
});
|
|
1306
1297
|
}
|
|
@@ -1427,7 +1418,7 @@
|
|
|
1427
1418
|
|
|
1428
1419
|
var form = target != undefined && target.tagName == "FORM" ? target : undefined;
|
|
1429
1420
|
if (form) {
|
|
1430
|
-
data =
|
|
1421
|
+
data = new FormEvent(form);
|
|
1431
1422
|
$(form).find(':submit').attr('disabled', 'disabled');
|
|
1432
1423
|
}
|
|
1433
1424
|
|
|
@@ -1550,7 +1541,7 @@
|
|
|
1550
1541
|
// From here the page is valid..
|
|
1551
1542
|
// so the new page is added to history..
|
|
1552
1543
|
if(xhr)
|
|
1553
|
-
history.pushState({uuid: uuid, status:status, method: method, data:
|
|
1544
|
+
history.pushState({uuid: uuid, status:status, method: method, data: {}, href: responseURL}, '', responseURL);
|
|
1554
1545
|
|
|
1555
1546
|
var dom = new DOMParser().parseFromString(responseText, "text/html");
|
|
1556
1547
|
if(status != 200) // Blatant error received..
|
|
@@ -1630,7 +1621,9 @@
|
|
|
1630
1621
|
url: url.href,
|
|
1631
1622
|
type: type,
|
|
1632
1623
|
data: data,
|
|
1633
|
-
|
|
1624
|
+
cache: false,
|
|
1625
|
+
contentType: false,
|
|
1626
|
+
processData: false,
|
|
1634
1627
|
headers: Settings["headers"] || {},
|
|
1635
1628
|
xhr: function () { return xhr; },
|
|
1636
1629
|
success: function (html, status, request) { return handleResponse(uuid, request.status, type, data, xhr, request); },
|