Fix default-js

This commit is contained in:
Sofia 2018-04-20 09:13:33 +03:00
parent 2c78966fe8
commit a7bede494f

View File

@ -22,7 +22,17 @@ function _default_js_main() {
function _default_js_onclick(event) {
event.preventDefault();
let url = event.target.href;
let node = event.target;
while (node.nodeName != "A") {
if (node.parentNode == null) {
return;
}
node = node.parentNode;
}
let url = node.href;
_default_js_open_page(url, true);
}
@ -49,7 +59,9 @@ function change_page(new_document, new_url, no_pop_state) {
// Some meta tags
document.title = new_document.title;
let new_favicon = new_document.querySelector("link[rel*='icon']").href;
let new_favicon = "";
new_favicon = new_document.querySelector("link[rel*='icon']").href;
document.querySelector("link[rel*='icon']").href = new_favicon;
@ -79,4 +91,4 @@ function change_page(new_document, new_url, no_pop_state) {
window.history.pushState(new_url, new_url, new_url);
}
}
}