Difference between revisions of "User:HallowizerTEST/common.js"

From WiiBrew
Jump to navigation Jump to search
(Switched to var)
(Fixed insertAfter)
Line 4: Line 4:
 
     a.href = "https://" + location.href.substring("http://".length);
 
     a.href = "https://" + location.href.substring("http://".length);
 
     a.innerText = "Upgrade to HTTPS";
 
     a.innerText = "Upgrade to HTTPS";
     nav.insertAfter(nav.children[0]);
+
     nav.insertBefore(nav.children[1]);
 
}
 
}

Revision as of 22:18, 24 April 2021

if (location.href.startsWith("http://")) {
    var nav = document.querySelector("#p-navigation ul");
    var a = document.createElement("a");
    a.href = "https://" + location.href.substring("http://".length);
    a.innerText = "Upgrade to HTTPS";
    nav.insertBefore(nav.children[1]);
}