aboutsummaryrefslogtreecommitdiff
path: root/js/iframe.js
diff options
context:
space:
mode:
Diffstat (limited to 'js/iframe.js')
-rw-r--r--js/iframe.js94
1 files changed, 47 insertions, 47 deletions
diff --git a/js/iframe.js b/js/iframe.js
index 415f095..a031872 100644
--- a/js/iframe.js
+++ b/js/iframe.js
@@ -1,48 +1,48 @@
-function iframeURLChange(iframe, callback) {
- var unloadHandler = function () {
- setTimeout(function () {
- callback(iframe.contentWindow.location.href);
- }, 0);
- };
-
- function attachUnload() {
- iframe.contentWindow.removeEventListener("pagehide", unloadHandler);
- iframe.contentWindow.addEventListener("pagehide", unloadHandler);
- iframe.contentWindow.removeEventListener("unload", unloadHandler);
- iframe.contentWindow.addEventListener("unload", unloadHandler);
- }
-
- iframe.addEventListener("load", attachUnload);
- attachUnload();
-}
-
-Array.from(document.getElementsByTagName("iframe")).forEach((par) => {
- iframeURLChange(par, function (newURL) {
- $(".loader").fadeIn(200);
- });
-})
-
-function unload() {
- $(".loader").fadeIn(200);
-}
-
-Array.from(document.getElementsByTagName("iframe")).forEach((par) => {
- par.onbeforeunload = unload
-})
-
-function loaded () {
- $(".loader").fadeOut(200);
-
- setTimeout(() => {
- $(".loader").fadeOut(200);
- }, 300)
-
- setTimeout(() => {
- $(".loader").fadeOut(200);
- }, 1500);
-}
-
-Array.from(document.getElementsByTagName("iframe")).forEach((par) => {
- par.onload = loaded;
- par.onabort = loaded;
+function iframeURLChange(iframe, callback) {
+ var unloadHandler = function () {
+ setTimeout(function () {
+ callback(iframe.contentWindow.location.href);
+ }, 0);
+ };
+
+ function attachUnload() {
+ iframe.contentWindow.removeEventListener("pagehide", unloadHandler);
+ iframe.contentWindow.addEventListener("pagehide", unloadHandler);
+ iframe.contentWindow.removeEventListener("unload", unloadHandler);
+ iframe.contentWindow.addEventListener("unload", unloadHandler);
+ }
+
+ iframe.addEventListener("load", attachUnload);
+ attachUnload();
+}
+
+Array.from(document.getElementsByTagName("iframe")).forEach((par) => {
+ iframeURLChange(par, function (newURL) {
+ $(".loader").fadeIn(200);
+ });
+})
+
+function unload() {
+ $(".loader").fadeIn(200);
+}
+
+Array.from(document.getElementsByTagName("iframe")).forEach((par) => {
+ par.onbeforeunload = unload
+})
+
+function loaded () {
+ $(".loader").fadeOut(200);
+
+ setTimeout(() => {
+ $(".loader").fadeOut(200);
+ }, 300)
+
+ setTimeout(() => {
+ $(".loader").fadeOut(200);
+ }, 1500);
+}
+
+Array.from(document.getElementsByTagName("iframe")).forEach((par) => {
+ par.onload = loaded;
+ par.onabort = loaded;
}) \ No newline at end of file