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

From WiiBrew
Jump to navigation Jump to search
m (added a semicolon)
(Changed label text)
 
(6 intermediate revisions by the same user not shown)
Line 1: Line 1:
 
if (location.href.startsWith("http://")) {
 
if (location.href.startsWith("http://")) {
     let nav = document.querySelector("#p-navigation ul");
+
     var nav = document.querySelector("#p-navigation ul");
     let a = document.createElement("a");
+
     var li = document.createElement("li");
     a.href = "https://" + location.href.substring("http://".length);
+
     var href = "https://" + location.href.substring("http://".length);
     a.innerText = "Upgrade to HTTPS";
+
     li.innerHTML = '<a href="' + href + '">Switch to HTTPS</a>';
     nav.insertAfter(nav.children[0]);
+
     nav.insertBefore(li, nav.children[1]);
 
}
 
}

Latest revision as of 22:22, 24 April 2021

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