Difference between revisions of "MediaWiki:Common.js"

From Make Inclusive Websites
Jump to navigation Jump to search
Line 23: Line 23:
 
var findform = document.querySelector("#form");
 
var findform = document.querySelector("#form");
 
console.log("findform",findform);
 
console.log("findform",findform);
if (findform.length == 0) {console.log("no form")}
+
if (findform) {findform.setAttribute("action", "/wiki/index.php?title=Special:WikiForum&wfaction=savenewcategory");}
else {findform.setAttribute("action", "/wiki/index.php?title=Special:WikiForum&wfaction=savenewcategory");}
+
else {console.log("no form")}
  
 
var findsearch = document.querySelector("#mw-wikiforum-searchbox > form");
 
var findsearch = document.querySelector("#mw-wikiforum-searchbox > form");
 
console.log("findsearch",findsearch);
 
console.log("findsearch",findsearch);
if (findsearch.length == 0) {console.log("no search")}
+
if (findsearch) {findsearch.setAttribute("action", "/wiki/index.php?title=Special:WikiForum&wfaction=search");}
else {findsearch.setAttribute("action", "/wiki/index.php?title=Special:WikiForum&wfaction=search");}
+
else {console.log("no search")}
 
//}, 100);
 
//}, 100);

Revision as of 14:13, 24 May 2021

/* Any JavaScript here will be loaded for all users on every page load. */
//setTimeout(function(){ 
    var header = document.getElementById("mw-head-base"); //top-bar for 2018
    var button = document.createElement("div");
    button.setAttribute("class", "selectionscreen");
    button.setAttribute("id", "backtoselectionscreen");
    var link = document.createElement("a");
    link.setAttribute("href", "/makeinclusivewebsites2/makeinclusivewebsites2.html")
    link.setAttribute("tabindex","0");
    var object = document.createElement("object");
    object.setAttribute("data", "../img/BackArrow-OL-01.svg");
    object.setAttribute("type", "image/svg+xml");
    object.setAttribute("class", "selectionscreen");
    if (header == 0) {
        console.log("found no header");
    } else {
        console.log(header);
        header.appendChild(button);
        button.appendChild(link);
        link.appendChild(object);
    }

var findform = document.querySelector("#form");
console.log("findform",findform);
if (findform) {findform.setAttribute("action", "/wiki/index.php?title=Special:WikiForum&wfaction=savenewcategory");}
else {console.log("no form")}

var findsearch = document.querySelector("#mw-wikiforum-searchbox > form");
console.log("findsearch",findsearch);
if (findsearch) {findsearch.setAttribute("action", "/wiki/index.php?title=Special:WikiForum&wfaction=search");}
else {console.log("no search")}
//}, 100);