@glitchr/transparent 1.0.17 → 1.0.18
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 +26 -22
package/package.json
CHANGED
package/src/js/transparent.js
CHANGED
|
@@ -267,7 +267,7 @@
|
|
|
267
267
|
|
|
268
268
|
function isDomEntity(entity)
|
|
269
269
|
{
|
|
270
|
-
return typeof entity === 'object' && entity.nodeType !== undefined;
|
|
270
|
+
return entity !== null && typeof entity === 'object' && entity.nodeType !== undefined;
|
|
271
271
|
}
|
|
272
272
|
|
|
273
273
|
Transparent.setResponse = function(uuid, responseText, scrollableXY = [], exceptionRaised = false)
|
|
@@ -903,21 +903,16 @@
|
|
|
903
903
|
console.error("Rescue mode.. called");
|
|
904
904
|
rescueMode = true;
|
|
905
905
|
|
|
906
|
-
var head = $(dom).find("head").html();
|
|
907
906
|
var body = $(dom).find("body").html();
|
|
908
|
-
|
|
909
|
-
if(head == undefined || body == "undefined") {
|
|
907
|
+
if(body == "undefined") {
|
|
910
908
|
|
|
911
909
|
$(Settings.identifier).html("<div class='error'></div>");
|
|
912
|
-
|
|
913
910
|
setTimeout(function() { window.location.reload(); }, Transparent.parseDuration(Settings["rescue_reload"]));
|
|
914
911
|
|
|
915
912
|
} else {
|
|
916
|
-
|
|
917
|
-
document.
|
|
918
|
-
|
|
919
|
-
Transparent.evalScript($("head")[0]);
|
|
920
|
-
Transparent.evalScript($("body")[0]);
|
|
913
|
+
|
|
914
|
+
document.documentElement.innerHTML = dom.documentElement === undefined ? dom : dom.documentElement.innerHTML;
|
|
915
|
+
Transparent.transferAttributes(dom);
|
|
921
916
|
}
|
|
922
917
|
|
|
923
918
|
Transparent.activeOut();
|
|
@@ -1146,27 +1141,37 @@
|
|
|
1146
1141
|
$("html").removeAttr(attr.name);
|
|
1147
1142
|
});
|
|
1148
1143
|
|
|
1149
|
-
|
|
1150
|
-
|
|
1151
|
-
$(
|
|
1152
|
-
|
|
1144
|
+
if(html.length > 0) {
|
|
1145
|
+
|
|
1146
|
+
$($(html)[0].attributes).each(function(i, attr) {
|
|
1147
|
+
if(attr.name == "class") return;
|
|
1148
|
+
$("html").attr(attr.name, attr.value);
|
|
1149
|
+
});
|
|
1150
|
+
}
|
|
1153
1151
|
|
|
1154
1152
|
var head = $(dom).find("head");
|
|
1155
1153
|
$($("head")[0].attributes).each(function(i, attr) {
|
|
1156
1154
|
$("head").removeAttr(attr.name);
|
|
1157
1155
|
});
|
|
1158
1156
|
|
|
1159
|
-
|
|
1160
|
-
|
|
1161
|
-
|
|
1157
|
+
if(head.length > 0) {
|
|
1158
|
+
|
|
1159
|
+
$($(head)[0].attributes).each(function(i, attr) {
|
|
1160
|
+
$("head").attr(attr.name, attr.value);
|
|
1161
|
+
});
|
|
1162
|
+
}
|
|
1162
1163
|
|
|
1163
1164
|
var body = $(dom).find("body");
|
|
1164
1165
|
$($("body")[0].attributes).each(function(i, attr) {
|
|
1165
1166
|
$("body").removeAttr(attr.name);
|
|
1166
1167
|
});
|
|
1167
|
-
|
|
1168
|
-
|
|
1169
|
-
|
|
1168
|
+
|
|
1169
|
+
if(body.length > 0) {
|
|
1170
|
+
|
|
1171
|
+
$($(body)[0].attributes).each(function(i, attr) {
|
|
1172
|
+
$("body").attr(attr.name, attr.value);
|
|
1173
|
+
});
|
|
1174
|
+
}
|
|
1170
1175
|
}
|
|
1171
1176
|
|
|
1172
1177
|
Transparent.onLoad = function(uuid, dom, callback = null, scrollTo = false) {
|
|
@@ -1500,7 +1505,6 @@
|
|
|
1500
1505
|
if(!Transparent.hasResponse(uuid))
|
|
1501
1506
|
Transparent.setResponse(uuid, responseText);
|
|
1502
1507
|
}
|
|
1503
|
-
|
|
1504
1508
|
var dom = new DOMParser().parseFromString(responseText, "text/html");
|
|
1505
1509
|
if(request && request.getResponseHeader("Content-Type") == "application/json") {
|
|
1506
1510
|
|
|
@@ -1537,7 +1541,7 @@
|
|
|
1537
1541
|
|
|
1538
1542
|
// Page not recognized.. just go there.. no POST information transmitted..
|
|
1539
1543
|
if(!Transparent.isPage(dom))
|
|
1540
|
-
return
|
|
1544
|
+
return Transparent.rescue(responseText);
|
|
1541
1545
|
|
|
1542
1546
|
// Layout not compatible.. needs to be reloaded (exception when POST is detected..)
|
|
1543
1547
|
if(!Transparent.isCompatiblePage(dom, method, data))
|