Commit 994f3403 authored by cgm616's avatar cgm616

Fix build error with javascript

parent cc01b52b
......@@ -14,22 +14,23 @@ if ('serviceWorker' in navigator) {
window.onload = function() {
var x = document.getElementsByTagName("a");
var i;
for (i = 0; i < x.length; i++) {
var href = x[i].getAttribute("href");
if(href.substr(0,1) == '/' && href !== window.location.pathname) {
x[i].addEventListener("mouseenter", (function() {
if (!navigator.serviceWorker.controller) {
console.log("no controller");
return;
}
navigator.serviceWorker.controller.postMessage({
url: this.getAttribute('href'),
command: 'fetch'
});
}),
{ 'once': true, 'passive': true, }
);
}
if('serviceWorker' in navigator) {
for (i = 0; i < x.length; i++) {
var href = x[i].getAttribute("href");
if(href.substr(0,1) == '/' && href !== window.location.pathname) {
x[i].addEventListener("mouseenter", (function() {
if (!navigator.serviceWorker.controller) {
console.log("no controller");
return;
}
navigator.serviceWorker.controller.postMessage({
url: this.getAttribute('href'),
command: 'fetch'
});
}),
{ 'once': true, 'passive': true, }
);
}
}
}
}
};
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment