Difference between revisions of "User:HallowizerTEST/common.js"
Jump to navigation
Jump to search
m (added a semicolon) |
(Switched to var) |
||
Line 1: | Line 1: | ||
if (location.href.startsWith("http://")) { | 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.href = "https://" + location.href.substring("http://".length); | ||
a.innerText = "Upgrade to HTTPS"; | a.innerText = "Upgrade to HTTPS"; | ||
nav.insertAfter(nav.children[0]); | nav.insertAfter(nav.children[0]); | ||
} | } |
Revision as of 22:17, 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.insertAfter(nav.children[0]);
}