User:KokoroSenshi/common.js

// // // External wiki redirect prompt // Test to make a dialogue box ask whether to redirect when sent to soft redirect pages // }} //TODO: check http://niwanetwork.org/wiki/index.php/Akiko_Koumoto regarding var elemSoftRedirect = document.getElementById("softredirect"); console.log("/ - - -"); 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 have(?) worked 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 soft redirect page: console.log("| There's no softredirect"); }; console.log("\ - - -");

function ConfirmRedirect{ console.log("| "+elemSoftRedirect.lastElementChild); console.log("| "+elemSoftRedirect.lastElementChild.innerHTML); var wikiName = elemSoftRedirect.lastElementChild.innerHTML; var reply = confirm("Redirect to the page"+ URL +" on "+ wikiName +"?"); //navigates to the page with 10s delay after the confirmation box setTimeout(function{   console.log("| Will redirect since no cancel (5s delay for redirect exists to confirm end of script in log)");    console.log("\ - - -");    setTimeout(function{ window.location = URL; },(5 * 1000)); },(10 * 1000));  if(reply == true) { console.log("| Will redirect since clicked (5s delay for redirect exists to confirm end of script in log)"); console.log("\ - - -"); setTimeout(function{     window.location = URL;    },(5 * 1000)); } else { console.log("| Not redirecting"); }; };

// // // Wikitext test // - //

///console.log(" KokoroSenshi "); ///console.log("~"); ///console.log(" "); ///console.log("&#126;&#126;&#126;&#126;"); //