Skip to content
Snippets Groups Projects
Commit 3218082b authored by Dominik Hebeler's avatar Dominik Hebeler
Browse files

Merge branch 'development' into 'master'

Development

See merge request !2046
parents 809f7801 df7ee64e
No related branches found
No related tags found
1 merge request!2046Development
......@@ -4,7 +4,7 @@ require("fetch-ie8");
try {
// Should get blocked by csp
eval("window.sp = 1;");
} catch (err) {}
} catch (err) { }
let key = getKey();
let url = "/img/logo.png?id=" + key;
......@@ -16,9 +16,45 @@ if (navigator.webdriver) {
url += "&wd";
}
fetch(url);
let interval;
let unload = false;
window.addEventListener("beforeunload", () => {
unload = true;
})
fetch(url).then(result => {
interval = setInterval(verify, 100);
});
function getKey() {
let nonce_element = document.querySelector("meta[name=nonce]");
return nonce_element.content;
}
function verify() {
if (unload) {
clearInterval(interval);
return;
}
let styleSheet = getStyleSheet();
if (!styleSheet || !("cssRules" in styleSheet) || styleSheet.cssRules.length === 0) {
return false;
}
clearInterval(interval);
history.go();
}
function getStyleSheet() {
let styleSheets = document.styleSheets;
for (let i = 0; i < styleSheets.length; i++) {
let styleSheet = styleSheets[i];
let matches = styleSheet.href.match(/index\.css\?id=([a-f0-9]{32})$/);
if (!matches) {
continue;
}
return styleSheet;
}
return null;
}
......@@ -21,7 +21,7 @@
<script src="{{ mix('js/index.js') }}"></script>
<link rel="stylesheet" href="/index.css?id={{ $mgv }}">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1" />
<meta http-equiv="refresh" content="0">
<meta http-equiv="refresh" content="1">
</head>
<body>
<div id="resultpage-container">
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment