@glitchr/transparent 1.0.49 → 1.0.51
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 +22 -5
package/package.json
CHANGED
package/src/js/transparent.js
CHANGED
|
@@ -547,7 +547,10 @@
|
|
|
547
547
|
return null;
|
|
548
548
|
}
|
|
549
549
|
|
|
550
|
-
if(!form.checkValidity())
|
|
550
|
+
if(!$(el).hasClass("skip-validation") && !form.checkValidity()) {
|
|
551
|
+
console.error("Invalid form submission.", el);
|
|
552
|
+
return null;
|
|
553
|
+
}
|
|
551
554
|
|
|
552
555
|
var pat = /^https?:\/\//i;
|
|
553
556
|
if (pat.test(href)) return [method, new URL(href), form];
|
|
@@ -589,7 +592,10 @@
|
|
|
589
592
|
return null;
|
|
590
593
|
}
|
|
591
594
|
|
|
592
|
-
if(!form.checkValidity())
|
|
595
|
+
if(!$(el).hasClass("skip-validation") && !form.checkValidity()) {
|
|
596
|
+
console.error("Invalid form submission.", el);
|
|
597
|
+
return null;
|
|
598
|
+
}
|
|
593
599
|
|
|
594
600
|
var pat = /^https?:\/\//i;
|
|
595
601
|
if (pat.test(href)) return ["POST", new URL(pathname), form];
|
|
@@ -1594,11 +1600,22 @@
|
|
|
1594
1600
|
}
|
|
1595
1601
|
|
|
1596
1602
|
// Invalid html page returned
|
|
1597
|
-
if(
|
|
1598
|
-
return Transparent.rescue(dom);
|
|
1603
|
+
if(request && request.getResponseHeader("Content-Type") == "text/html") {
|
|
1599
1604
|
|
|
1600
|
-
|
|
1605
|
+
if (!responseText.includes("<html") && !responseText.includes("<body") && !responseText.includes("<head"))
|
|
1606
|
+
return Transparent.rescue(dom);
|
|
1607
|
+
}
|
|
1608
|
+
|
|
1609
|
+
if(status == 302) {
|
|
1610
|
+
|
|
1611
|
+
if(responseURL) location.href = responseURL;
|
|
1612
|
+
else location.reload();
|
|
1613
|
+
|
|
1614
|
+
} else if(status != 200) {
|
|
1615
|
+
|
|
1616
|
+
// Blatant error received..
|
|
1601
1617
|
return Transparent.rescue(dom);
|
|
1618
|
+
}
|
|
1602
1619
|
|
|
1603
1620
|
// From here the page is valid..
|
|
1604
1621
|
// so the new page is added to history..
|