User:KokoroSenshi/common.js

//Test to make a dialogue box ask whether to redirect when sent to soft redirect pages var elemSoftRedirect = document.getElementById("softredirect"); console.log(elemSoftRedirect); if (elemSoftRedirect != null) { console.log("This is a softredirect"); //Check if href exists (better save than sorry) ///console.log(elemSoftRedirect.children[0]); //An alternative console.log(elemSoftRedirect.firstElementChild); ///.firstChild should(?) work but didn't if (elemSoftRedirect.firstElementChild.hasAttribute("href")) { //Redirect confirmation box var URL = elemSoftRedirect.firstElementChild.getAttribute("href"); console.log(URL); ConfirmRedirect } else { console.log("There's no href"); }; } else { //If not a softredirect page: console.log("There's no softredirect"); };

function ConfirmRedirect{ var reply = confirm("Redirect to the page ___ on ___(wiki)?"); if(reply == true) { console.log("Will redirect; TODO: remove delay?"); //navigates to the page with 10s delay setTimeout(function{window.location = URL;},(10 * 1000)); } else { console.log("Not redirecting"); }; };