@glitchr/transparent 1.0.38 → 1.0.40

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@glitchr/transparent",
3
- "version": "1.0.38",
3
+ "version": "1.0.40",
4
4
  "description": "Transparent SPA Application",
5
5
  "main": "src/index.js",
6
6
  "access": "public",
@@ -1208,12 +1208,12 @@
1208
1208
 
1209
1209
  $("head").children().each(function() { found |= this.isEqualNode(el); });
1210
1210
  if(!found) {
1211
-
1212
-
1211
+
1212
+
1213
1213
  if(this.tagName != "SCRIPT" || Settings["global_code"] == true) {
1214
-
1214
+
1215
1215
  $("head").append(this.cloneNode(true));
1216
-
1216
+
1217
1217
  } else {
1218
1218
 
1219
1219
  $("head").append(this);
@@ -1568,19 +1568,18 @@
1568
1568
  return dispatchEvent(new Event('load'));
1569
1569
  }
1570
1570
 
1571
- // From here the page is valid..
1572
- // so the new page is added to history..
1573
- if(xhr)
1574
- history.pushState({uuid: uuid, status:status, method: method, data: {}, href: responseURL}, '', responseURL);
1575
-
1576
1571
  // Invalid html page returned
1577
- if(!responseText.includes("<html>") || !responseText.includes("<body>") || !responseText.includes("<head>"))
1572
+ if(!responseText.includes("<html") || !responseText.includes("<body") || !responseText.includes("<head"))
1578
1573
  return Transparent.rescue(dom);
1579
1574
 
1580
- var dom = new DOMParser().parseFromString(responseText, "text/html");
1581
1575
  if(status != 200) // Blatant error received..
1582
1576
  return Transparent.rescue(dom);
1583
1577
 
1578
+ // From here the page is valid..
1579
+ // so the new page is added to history..
1580
+ if(xhr)
1581
+ history.pushState({uuid: uuid, status:status, method: method, data: {}, href: responseURL}, '', responseURL);
1582
+
1584
1583
  // Page not recognized.. just go fetch by yourself.. no POST information transmitted..
1585
1584
  if(!Transparent.isPage(dom))
1586
1585
  return window.location.href = url;
@@ -1709,6 +1708,8 @@
1709
1708
 
1710
1709
  window.onbeforeunload = function() {
1711
1710
 
1711
+ if(Settings.disable) return;
1712
+
1712
1713
  var preventDefault = false;
1713
1714
  var formDataAfter = [];
1714
1715
  $("form").each(function() {