User:Pythoncoder/global.js

/* Note: This is not a real CSS page. This JavaScript page * is located at a CSS title due to technical restrictions. */

/* Fake Vector JS * This is a JS addition to the Fake Vector CSS. You must have either User:Llwy-ar-lawr/fakevector1.css * or User:Llwy-ar-lawr/fakevector2.css installed for it to work properly. * To use this, copy the following line to your common.js: * importScript("User:Llwy-ar-lawr/fakevectorjs.css"); */

/* Stolen from https://github.com/azatoth/twinkle/blob/master/morebits.js * I don't know how to import something from GitHub, and I only need this one piece at the moment. */ userIsInGroup = function ( group ) { return mw.config.get( 'wgUserGroups' ).indexOf( group ) !== -1; };

/* Because wgRelevantUserName doesn't exist */ function wgRelevantUserName { if(wgNamespaceNumber == 2 || wgNamespaceNumber == 3) { if(wgPageName.indexOf("/") !== -1) { return wgTitle.slice(0, wgTitle.indexOf("/")).replace(/ /g, "_"); } else { return wgTitle.replace(/ /g, "_"); }   } else if(wgCanonicalSpecialPageName == "Special:Contributions") { return wgPageName.slice(wgPageName.indexOf("/") + 1).replace(/ /g, "_"); } }

/* get the subject page of a talk page or vice versa * Unlike some of the other code on this page, this should work for any language. */ function subjectTalkSwitch(dir) { if(dir == "talk") { if(document.getElementsByClassName("ns-subject")[0]) { return wgFormattedNamespaces[wgNamespaceNumber + 1].replace(/ /g, "_") + ":" + wgTitle; } else if(document.getElementsByClassName("ns-talk")[0]) { return wgPageName; }   } else if(dir == "subject") { if(document.getElementsByClassName("ns-talk")[0]) { if(wgNamespaceNumber == 1) { return wgTitle; } else { return wgFormattedNamespaces[wgNamespaceNumber - 1].replace(/ /g, "_") + ":" + wgTitle; }       } else if(document.getElementsByClassName("ns-subject")[0]) { return wgPageName; }   } }

/* tell if a page is movable (by local users, not necessarily the current user) */ function pageIsMovable { if(wgNamespaceNumber == 14) { return false; } else if(wgNamespaceNumber == 2) { if(wgPageName.slice(wgPageName.length - 3) == ".js") { return false; } else { return true; }   } else if(wgNamespaceNumber == 8) { if(wgPageName.slice(wgPageName.length - 3) == ".js"       || wgPageName.slice(wgPageName.length - 4) == ".css") { return false; } else { return true; }   } else { return true; } }

/* Internet Explorer doesn't support element.remove * Source: https://stackoverflow.com/questions/20428877/javascript-remove-doesnt-work-in-ie */ if(!("remove" in Element.prototype)) { Element.prototype.remove = function { if(this.parentNode) { this.parentNode.removeChild(this); }   }; }

//Add a .skin-vector class and remove .skin-oasis to make it easier to target styles $("body").addClass("skin-vector"); $("body").removeClass("skin-oasis");

//Blow up the layout and start over var body = document.getElementsByTagName("body")[0]; var pagebase = document.createElement("div"); body.appendChild(pagebase); pagebase.setAttribute("id", "mw-page-base"); var headbase = document.createElement("div"); body.appendChild(headbase); headbase.setAttribute("id", "mw-head-base");

//make green success boxes visible (other code hides them) if(document.getElementsByClassName("banner-notifications-placeholder")[0]) { body.appendChild(document.getElementsByClassName("banner-notifications-placeholder")[0]); } /* This has to be up here or the box ends up at the bottom. This is bad for * keyboard users who would have to tab through everything else to get to it. */

//continuing on body.appendChild(document.getElementById("WikiaPage")); /* Retaining standard sidebar if(document.getElementsByClassName("wds-community-header")[0]) { document.getElementsByClassName("wds-community-header")[0].remove; } if(document.getElementsByClassName("wds-global-footer")[0]) { document.getElementsByClassName("wds-global-footer")[0].remove; } var mwnav = document.createElement("div"); mwnav.setAttribute("id", "mw-navigation"); body.appendChild(mwnav); var mwhead = document.createElement("div"); mwhead.setAttribute("id", "mw-head"); mwnav.appendChild(mwhead); var personal = document.createElement("div"); mwhead.appendChild(personal); personal.setAttribute("id", "p-personal"); personal.setAttribute("role", "navigation"); personal.setAttribute("aria-labelledby", "p-personal-label"); var ph = document.createElement("h3"); personal.appendChild(ph); ph.setAttribute("id", "p-personal-label"); ph.innerHTML = "Personal tools"; var pul = document.createElement("ul"); personal.appendChild(pul); var pli0 = document.createElement("li"); pul.appendChild(pli0); pli0.setAttribute("id", "pt-userpage"); var plia0 = document.createElement("a"); pli0.appendChild(plia0); plia0.setAttribute("href", "/wiki/User:" + wgUserName); plia0.setAttribute("title", "Your user page [Alt+Shift+.]"); plia0.setAttribute("accesskey", "."); plia0.innerHTML = wgUserName; var pli1 = document.createElement("li"); pul.appendChild(pli1); pli1.setAttribute("id", "pt-notifications-alert"); pli1.appendChild(document.getElementsByClassName("wds-global-navigation__notifications-dropdown")[0]); var pli2 = document.createElement("li"); pul.appendChild(pli2); pli2.setAttribute("id", "pt-mytalk"); var plia2 = document.createElement("a"); pli2.appendChild(plia2); plia2.setAttribute("href", "/wiki/User_talk:" + wgUserName); plia2.setAttribute("title", "Your talk page [Alt+Shift+n]"); plia2.setAttribute("accesskey", "n"); plia2.innerHTML = "Talk"; var pli3 = document.createElement("li"); pul.appendChild(pli3); pli3.setAttribute("id", "pt-preferences"); var plia3 = document.createElement("a"); pli3.appendChild(plia3); plia3.setAttribute("href", "/wiki/Special:Preferences"); plia3.setAttribute("title", "Your preferences"); plia3.innerHTML = "Preferences"; var pli4 = document.createElement("li"); pul.appendChild(pli4); pli4.setAttribute("id", "pt-watchlist"); var plia4 = document.createElement("a"); pli4.appendChild(plia4); plia4.setAttribute("href", "/wiki/Special:Watchlist"); plia4.setAttribute("title", "A list of pages you are monitoring for changes [Alt+Shift+l]"); plia4.setAttribute("accesskey", "l"); plia4.innerHTML = "Watchlist"; var pli5 = document.createElement("li"); pul.appendChild(pli5); pli5.setAttribute("id", "pt-mycontribs"); var plia5 = document.createElement("a"); pli5.appendChild(plia5); plia5.setAttribute("href", "/wiki/Special:Contributions/" + wgUserName); plia5.setAttribute("title", "A list of your contributions [Alt+Shift+y]"); plia5.setAttribute("accesskey", "y"); plia5.innerHTML = "Contributions"; var pli6 = document.createElement("li"); pul.appendChild(pli6); pli6.setAttribute("id", "pt-logout"); var plia6 = document.createElement("a"); pli6.appendChild(plia6); /* broken up to pass Wikia's spam filter */ plia6.setAttribute("href", "/wiki/Special:U" + "serLogout?returnto=" + wgPageName); plia6.setAttribute("title", "Log out"); plia6.innerHTML = "Log out";

/* Extract existing tabs from their locations and add them to right-hand and left-hand * divs. Also add tabs that are missing in Oasis. * This will make other things easier and improve accessibility. */

//Set up the divs var left = document.createElement("div"); left.setAttribute("id", "left-navigation"); mwhead.appendChild(left); var pnam = document.createElement("div"); pnam.setAttribute("id", "p-namespaces"); pnam.setAttribute("class", "vectorTabs"); pnam.setAttribute("role", "navigation"); pnam.setAttribute("aria-labelledby", "p-namespaces-label"); left.appendChild(pnam); var right = document.createElement("div"); right.setAttribute("id", "right-navigation"); mwhead.appendChild(right); var pviews = document.createElement("div"); pviews.setAttribute("id", "p-views"); pviews.setAttribute("class", "vectorTabs"); pviews.setAttribute("role", "navigation"); pviews.setAttribute("aria-labelledby", "p-views-label"); right.appendChild(pviews); var leftul = document.createElement("ul"); pnam.appendChild(leftul); var rightul = document.createElement("ul"); pviews.appendChild(rightul);

/* Invisible headers for screen reader labels * Relevant info: https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/ARIA_Techniques/Using_the_aria-labelledby_attribute */ var pnaml = document.createElement("h3"); pnam.appendChild(pnaml); pnaml.setAttribute("id", "p-namespaces-label"); pnaml.innerHTML = "Namespaces"; var pviewsl = document.createElement("h3"); pviews.appendChild(pviewsl); pviewsl.setAttribute("id", "p-views-label"); pviewsl.innerHTML = "Views";

//Fill the left side var leftli1 = document.createElement("li"); leftul.appendChild(leftli1); var leftli1s = document.createElement("span"); leftli1.appendChild(leftli1s); if(document.getElementsByClassName("page-header__subtitle")[0] && document.getElementsByClassName("page-header__subtitle")[0].getElementsByTagName("a")[0] && document.getElementsByClassName("page-header__subtitle")[0].getElementsByTagName("a")[0].hasAttribute("accesskey") ) { var leftli1a = document.getElementsByClassName("page-header__subtitle")[0].getElementsByTagName("a")[0]; } else if(document.getElementsByClassName("page-header__page-subtitle")[0] && document.getElementsByClassName("page-header__page-subtitle")[0].getElementsByTagName("a")[0] && document.getElementsByClassName("page-header__page-subtitle")[0].getElementsByTagName("a")[0].hasAttribute("accesskey") ) { var leftli1a = document.getElementsByClassName("page-header__page-subtitle")[0].getElementsByTagName("a")[0]; } else { var leftli1a = document.createElement("a"); } leftli1s.appendChild(leftli1a); if(wgNamespaceNumber == 0 || wgNamespaceNumber == 1) { leftli1.setAttribute("id", "ca-nstab-main"); } else if(document.getElementsByClassName("ns-talk")[0]) { leftli1.setAttribute("id", "ca-nstab-" + wgFormattedNamespaces[wgNamespaceNumber - 1].toLowerCase.replace(/ /g, "_") ); } else { leftli1.setAttribute("id", "ca-nstab-" + wgCanonicalNamespace.toLowerCase ); } if(wgNamespaceNumber == -1) { leftli1a.setAttribute("href", "/wiki/" + wgPageName); leftli1a.setAttribute("title", "This is a special page which you cannot edit"); } else { leftli1a.setAttribute("href", "/wiki/" + subjectTalkSwitch("subject")); leftli1a.setAttribute("accesskey", "c"); if( (wgNamespaceNumber == 0) || (wgNamespaceNumber == 1) ) { leftli1a.title = "View the content page [Alt+Shift+c]"; } else if( (wgNamespaceNumber == 8) || (wgNamespaceNumber == 9) ) { leftli1a.title = "View the system message [Alt+Shift+c]"; } else if(document.getElementsByClassName("ns-talk")[0]) { leftli1a.title = "View the " + wgFormattedNamespaces[wgNamespaceNumber - 1].toLowerCase + " page [Alt+Shift+c]"; } else { leftli1a.title = "View the " + wgCanonicalNamespace.toLowerCase.replace(/_/g, " ") + " page [Alt+Shift+c]"; } } if(wgNamespaceNumber == -1) { leftli1a.innerHTML = "Special page"; } else if( (wgNamespaceNumber == 0) || (wgNamespaceNumber == 1) ) { leftli1a.innerHTML = "Article"; } else if( (wgNamespaceNumber == 2) || (wgNamespaceNumber == 3) ) { leftli1a.innerHTML = "User page"; } else if( (wgNamespaceNumber == 4) || (wgNamespaceNumber == 5) ) { leftli1a.innerHTML = "Project page"; } else if( (wgNamespaceNumber == 8) || (wgNamespaceNumber == 9) ) { leftli1a.innerHTML = "Interface page"; } else if(document.getElementsByClassName("ns-talk")[0]) { leftli1a.innerHTML = wgFormattedNamespaces[wgNamespaceNumber - 1]; } else { leftli1a.innerHTML = wgCanonicalNamespace.replace(/_/g, " "); } var leftli2 = document.createElement("li"); leftul.appendChild(leftli2); var leftli2s = document.createElement("span"); leftli2.appendChild(leftli2s); if(document.getElementById("ca-talk")) { leftli2s.appendChild(document.getElementById("ca-talk")); document.getElementById("ca-talk").title = "Discussion about the content page [Alt+Shift+t]"; document.getElementById("ca-talk").setAttribute("accesskey", "t"); document.getElementById("ca-talk").removeAttribute("id"); leftli2.setAttribute("id", "ca-talk"); } else if(wgNamespaceNumber !== -1) { var leftli2a = document.createElement("a"); leftli2s.appendChild(leftli2a); leftli2a.setAttribute("href", "/wiki/" + subjectTalkSwitch("talk")); leftli2a.title = "Discussion about the content page [Alt+Shift+t]"; leftli2a.setAttribute("accesskey", "t"); leftli2a.innerHTML = "Talk"; leftli2.setAttribute("id", "ca-talk"); } if((wgNamespaceNumber == -1) || (document.getElementsByClassName("ns-subject")[0])) { leftli1.setAttribute("class", "selected"); } else { leftli2.setAttribute("class", "selected"); } /* This has the accesskey t, so we can't have it */ if(document.getElementsByClassName("commentslikes")[0]) { document.getElementsByClassName("commentslikes")[0].remove; }

//Fill the right side if(wgArticleId !== 0) { var rightli0 = document.createElement("li"); rightul.appendChild(rightli0); rightli0.setAttribute("id", "ca-view"); var rightli0s = document.createElement("span"); rightli0.appendChild(rightli0s); var rightli0a = document.createElement("a"); rightli0s.appendChild(rightli0a); rightli0a.setAttribute("href", "/wiki/" + wgPageName); rightli0a.innerHTML = "Read"; if(wgAction == "view") { rightli0.setAttribute("class", "selected"); } } if(document.getElementById("ca-edit")) { var rightli1 = document.createElement("li"); rightul.appendChild(rightli1); var rightli1s = document.createElement("span"); rightli1.appendChild(rightli1s); rightli1s.appendChild(document.getElementById("ca-edit")); document.getElementById("ca-edit").title = "Edit this page [Alt+Shift+e]"; document.getElementById("ca-edit").removeAttribute("id"); rightli1.setAttribute("id", "ca-edit"); } else if(document.getElementById("ca-viewsource")) { var rightli1 = document.createElement("li"); rightul.appendChild(rightli1); var rightli1s = document.createElement("span"); rightli1.appendChild(rightli1s); rightli1s.appendChild(document.getElementById("ca-viewsource")); document.getElementById("ca-viewsource").title = "This page is protected.\nYou can view its source [Alt+Shift+e]"; document.getElementById("ca-viewsource").setAttribute("accesskey", "e"); document.getElementById("ca-viewsource").removeAttribute("id"); rightli1.setAttribute("id", "ca-viewsource"); } else if(wgAction == "edit") { if(wgArticleId !== 0) { var rightli1 = document.createElement("li"); rightli1.setAttribute("class", "selected"); rightul.appendChild(rightli1); var rightli1s = document.createElement("span"); rightli1.appendChild(rightli1s); var rightli1a = document.createElement("a"); rightli1s.appendChild(rightli1a); rightli1a.setAttribute("href", "/wiki/" + wgPageName + "?action=edit"); rightli1a.setAttribute("accesskey", "e"); if(document.getElementsByClassName("EditPagePermissionError")[0]) { rightli1.setAttribute("id", "ca-viewsource"); rightli1a.setAttribute("title", "This page is protected.\nYou can view its source [Alt+Shift+e]"); rightli1a.innerHTML = "View source"; } else { rightli1.setAttribute("id", "ca-edit"); rightli1a.setAttribute("title", "Edit this page [Alt+Shift+e]"); rightli1a.innerHTML = "Edit"; }   } else if(!(document.getElementsByClassName("EditPagePermissionError")[0]) ) { var rightli1 = document.createElement("li"); rightli1.setAttribute("class", "selected"); rightul.appendChild(rightli1); var rightli1s = document.createElement("span"); rightli1.appendChild(rightli1s); var rightli1a = document.createElement("a"); rightli1s.appendChild(rightli1a); rightli1a.setAttribute("href", "/wiki/" + wgPageName + "?action=edit"); rightli1a.setAttribute("accesskey", "e"); rightli1.setAttribute("id", "ca-edit"); rightli1a.setAttribute("title", "Edit this page [Alt+Shift+e]"); rightli1a.innerHTML = "Create"; } } if(document.getElementById("ca-ve-edit")) { var rightli2 = document.createElement("li"); rightul.appendChild(rightli2); var rightli2s = document.createElement("span"); rightli2.appendChild(rightli2s); rightli2s.appendChild(document.getElementById("ca-ve-edit")); document.getElementById("ca-ve-edit").title = "Edit this page in WYSIWYG mode [Alt+Shift+s]"; document.getElementById("ca-ve-edit").removeAttribute("id"); rightli2.setAttribute("id", "ca-ve-edit"); } if(document.getElementById("ca-addsection")) { var rightli3 = document.createElement("li"); rightul.appendChild(rightli3); var rightli3s = document.createElement("span"); rightli3.appendChild(rightli3s); rightli3s.appendChild(document.getElementById("ca-addsection")); document.getElementById("ca-addsection").title = "Start a new section [Alt+Shift++]"; document.getElementById("ca-addsection").setAttribute("accesskey", "+"); document.getElementById("ca-addsection").removeAttribute("id"); rightli3.setAttribute("id", "ca-addsection"); } if(wgArticleId !== 0) { var rightli4 = document.createElement("li"); rightul.appendChild(rightli4); var rightli4s = document.createElement("span"); rightli4.appendChild(rightli4s); if(document.getElementById("ca-history")) { rightli4s.appendChild(document.getElementById("ca-history")); document.getElementById("ca-history").setAttribute("accesskey", "h"); document.getElementById("ca-history").title = "Past revisions of this page [Alt+Shift+h]"; document.getElementById("ca-history").removeAttribute("id"); } else { var rightli4a = document.createElement("a"); rightli4s.appendChild(rightli4a); rightli4a.setAttribute("href", "/wiki/" + wgPageName + "?action=history"); rightli4a.setAttribute("accesskey", "h"); rightli4a.title = "Past revisions of this page [Alt+Shift+h]"; rightli4a.innerHTML = "View history"; }   rightli4.setAttribute("id", "ca-history"); if(wgAction == "history") { rightli4.setAttribute("class", "selected"); } } /* These will be moved into the dropdown shortly, so they don't get spans. */ if(document.getElementById("ca-delete")) { var rightli5 = document.createElement("li"); rightul.appendChild(rightli5); rightli5.appendChild(document.getElementById("ca-delete")); document.getElementById("ca-delete").setAttribute("accesskey", "d"); document.getElementById("ca-delete").title = "Delete this page [Alt+Shift+d]"; document.getElementById("ca-delete").removeAttribute("id"); rightli5.setAttribute("id", "ca-delete"); } else if(document.getElementById("ca-undelete")) { var rightli5 = document.createElement("li"); rightul.appendChild(rightli5); rightli5.appendChild(document.getElementById("ca-undelete")); document.getElementById("ca-undelete").setAttribute("accesskey", "d"); document.getElementById("ca-undelete").setAttribute("title", "Restore the edits done to this page before it was deleted [Alt+Shift+d]"); document.getElementById("ca-undelete").removeAttribute("id"); rightli5.setAttribute("id", "ca-undelete"); } else if(document.getElementById("ca-edit")      && userIsInGroup("sysop") ) { if(wgArticleId !== 0) { var rightli5 = document.createElement("li"); rightul.appendChild(rightli5); var rightli5a = document.createElement("a"); rightli5.appendChild(rightli5a); rightli5.setAttribute("id", "ca-delete"); rightli5a.setAttribute("href", "/wiki/" + wgPageName + "?action=delete"); rightli5a.setAttribute("accesskey", "d"); rightli5a.title = "Delete this page [Alt+Shift+d]"; rightli5a.innerHTML = "Delete"; } else if(document.getElementsByClassName("mw-warning-with-logexcerpt")[0]     && !(document.getElementsByClassName("mw-titleprotected-warning")[0])      || (document.getElementsByClassName("mw-warning-with-logexcerpt")[1] && document.getElementsByClassName("mw-titleprotected-warning")[0]) ) { var rightli5 = document.createElement("li"); rightul.appendChild(rightli5); var rightli5a = document.createElement("a"); rightli5.appendChild(rightli5a); rightli5.setAttribute("id", "ca-undelete"); rightli5a.setAttribute("href", "/wiki/Special:Undelete?target=" + wgPageName); rightli5a.setAttribute("accesskey", "d"); rightli5a.title = "Restore the edits done to this page before it was deleted [Alt+Shift+d]"; rightli5a.innerHTML = "Undelete"; } } if(document.getElementById("ca-move")) { var rightli6 = document.createElement("li"); rightul.appendChild(rightli6); rightli6.appendChild(document.getElementById("ca-move")); document.getElementById("ca-move").setAttribute("accesskey", "m"); document.getElementById("ca-move").title = "Rename this page [Alt+Shift+m]"; document.getElementById("ca-move").removeAttribute("id"); rightli6.setAttribute("id", "ca-move"); } else if( document.getElementById("ca-edit")      && wgArticleId !== 0       && pageIsMovable == true       && ( userIsInGroup("rollback") || userIsInGroup("sysop") )       ) { var rightli6 = document.createElement("li"); rightul.appendChild(rightli6); rightli6.setAttribute("id", "ca-move"); var rightli6a = document.createElement("a"); rightli6.appendChild(rightli6a); rightli6a.setAttribute("href", "/wiki/Special:MovePage/" + wgPageName); rightli6a.setAttribute("accesskey", "m"); rightli6a.title = "Rename this page [Alt+Shift+m]"; rightli6a.innerHTML = "Move"; } if(document.getElementById("ca-protect")) { var rightli7 = document.createElement("li"); rightul.appendChild(rightli7); rightli7.appendChild(document.getElementById("ca-protect")); document.getElementById("ca-protect").title = "Protect this page [Alt+Shift+=]"; document.getElementById("ca-protect").setAttribute("accesskey", "="); document.getElementById("ca-protect").removeAttribute("id"); rightli7.setAttribute("id", "ca-protect"); } else if(document.getElementById("ca-unprotect")) { var rightli7 = document.createElement("li"); rightul.appendChild(rightli7); rightli7.appendChild(document.getElementById("ca-unprotect")); document.getElementById("ca-unprotect").title = "Change protection of this page [Alt+Shift+=]"; document.getElementById("ca-unprotect").setAttribute("accesskey", "="); document.getElementById("ca-unprotect").removeAttribute("id"); rightli7.setAttribute("id", "ca-unprotect"); } else if(document.getElementById("ca-edit")      && userIsInGroup("sysop")       && wgNamespaceNumber !== 8 ) { var rightli7 = document.createElement("li"); rightul.appendChild(rightli7); var rightli7a = document.createElement("a"); rightli7.appendChild(rightli7a); rightli7a.setAttribute("accesskey", "="); if( (wgArticleId !== 0 && document.getElementsByClassName("mw-warning-with-logexcerpt")[0] )     || (wgArticleId == 0 && document.getElementsByClassName("mw-titleprotectedwarning")[0] )      ) { rightli7.setAttribute("id", "ca-unprotect"); rightli7a.setAttribute("href", "/wiki/" + wgPageName + "?action=unprotect"); rightli7a.title = "Change protection of this page [Alt+Shift+=]"; rightli7a.innerHTML = "Change protection"; } else { rightli7.setAttribute("id", "ca-protect"); rightli7a.setAttribute("href", "/wiki/" + wgPageName + "?action=protect"); rightli7a.title = "Protect this page [Alt+Shift+=]"; rightli7a.innerHTML = "Protect"; } } //Back to non-dropdown tabs if(document.getElementById("ca-watch")) { var rightli8 = document.createElement("li"); rightul.appendChild(rightli8); var rightli8s = document.createElement("span"); rightli8.appendChild(rightli8s); rightli8s.appendChild(document.getElementById("ca-watch")); document.getElementById("ca-watch").title = "Add this page to your watchlist [Alt+Shift+w]"; document.getElementById("ca-watch").removeAttribute("id"); rightli8.setAttribute("id", "ca-watch"); } else if(document.getElementById("ca-unwatch")) { var rightli8 = document.createElement("li"); rightul.appendChild(rightli8); var rightli8s = document.createElement("span"); rightli8.appendChild(rightli8s); rightli8s.appendChild(document.getElementById("ca-unwatch")); document.getElementById("ca-unwatch").title = "Remove this page from your watchlist [Alt+Shift+w]"; document.getElementById("ca-unwatch").removeAttribute("id"); rightli8.setAttribute("id", "ca-unwatch"); } if(document.getElementById("CuratedContentTool")) { var rightli9 = document.createElement("li"); rightul.appendChild(rightli9); var rightli9s = document.createElement("span"); rightli9.appendChild(rightli9s); rightli9s.appendChild(document.getElementById("CuratedContentTool")); rightli9.setAttribute("id", "ca-editmobile"); } if(document.getElementsByClassName("tools-customize")[0]) { var rightli10 = document.createElement("li"); rightul.appendChild(rightli10); rightli10.appendChild(document.getElementsByClassName("tools-customize")[0]); rightli10.setAttribute("id", "ca-tools-customize"); } if(document.getElementsByClassName("tools")[0].querySelector("a[href='/wiki/Special:AdminDashboard']")) { var rightli11 = document.createElement("li"); rightul.appendChild(rightli11); rightli11.appendChild(document.getElementsByClassName("tools")[0].querySelector("a[href='/wiki/Special:AdminDashboard']")); rightli11.setAttribute("id", "ca-admin"); } if(document.getElementsByClassName("global-shortcuts-help-entry-point")[0]) { var rightli12 = document.createElement("li"); rightul.appendChild(rightli12); rightli12.appendChild(document.getElementsByClassName("global-shortcuts-help-entry-point")[0]); rightli12.setAttribute("id", "ca-shortcuts"); } //Remove emptied original container /*if(document.getElementsByClassName("page-header__contribution-buttons")[0]) { document.getElementsByClassName("page-header__contribution-buttons")[0].remove; } else if(document.getElementsByClassName("UserProfileActionButton")[0]) { document.getElementsByClassName("UserProfileActionButton")[0].remove; }*/ /* Replace text in original leftmost, "history" and "talk" tabs to remove code * clutter and fix wording * Note that this will not work correctly for users whose selected language is * not English. */ if(document.getElementById("ca-addsection")) { document.getElementById("ca-addsection").getElementsByTagName("a")[0].innerHTML = "New section"; document.getElementById("ca-addsection").getElementsByTagName("a")[0].removeAttribute("class"); } else if(document.getElementById("ca-edit")) { if(wgArticleId !== 0) { document.getElementById("ca-edit").getElementsByTagName("a")[0].innerHTML = "Edit"; } else { document.getElementById("ca-edit").getElementsByTagName("a")[0].innerHTML = "Create"; }   document.getElementById("ca-edit").getElementsByTagName("a")[0].removeAttribute("class"); } else if(document.getElementById("ca-viewsource")) { document.getElementById("ca-viewsource").getElementsByTagName("a")[0].innerHTML = "View source"; document.getElementById("ca-viewsource").getElementsByTagName("a")[0].removeAttribute("class"); } if(document.getElementById("ca-history")) { document.getElementById("ca-history").getElementsByTagName("a")[0].innerHTML = "View history"; } if(document.getElementById("ca-talk")) { document.getElementById("ca-talk").getElementsByTagName("a")[0].innerHTML = "Talk"; }

//dropdown 1 if( document.getElementById("ca-move")   var cactions = document.createElement("div");    right.appendChild(cactions);    cactions.setAttribute("id", "p-cactions");    cactions.setAttribute("class", "vectorMenu");    cactions.setAttribute("role", "navigation");    cactions.setAttribute("aria-labelledby", "p-cactions-label");    var cactionsi = document.createElement("input");    cactions.appendChild(cactionsi);    cactionsi.setAttribute("class", "vectorMenuCheckbox");    cactionsi.setAttribute("aria-labelledby", "p-cactions-label");    cactionsi.setAttribute("type", "checkbox");    var cactionsh = document.createElement("h3");    cactions.appendChild(cactionsh);    cactionsh.setAttribute("id", "p-cactions-label");    cactionsh.innerHTML = (" More ");    var menu = document.createElement("div");    menu.setAttribute("class", "menu");    cactions.appendChild(menu);    var menul = document.createElement("ul"); menu.appendChild(menul); if(document.getElementById("ca-delete")) { menul.appendChild(document.getElementById("ca-delete")); } else if(document.getElementById("ca-undelete")) { menul.appendChild(document.getElementById("ca-undelete")); }   if(document.getElementById("ca-move")) { menul.appendChild(document.getElementById("ca-move")); }   if(document.getElementById("ca-protect")) { menul.appendChild(document.getElementById("ca-protect")); } else if(document.getElementById("ca-unprotect")) { menul.appendChild(document.getElementById("ca-unprotect")); } } //dropdown 2 var mytools = document.createElement("div"); right.appendChild(mytools); mytools.setAttribute("id", "p-mytools"); mytools.setAttribute("role", "navigation"); mytools.setAttribute("aria-labelledby", "p-mytools-label"); mytools.setAttribute("class", "vectorMenu"); var mytoolsi = document.createElement("input"); mytools.appendChild(mytoolsi); mytoolsi.setAttribute("class", "vectorMenuCheckbox"); mytoolsi.setAttribute("aria-labelledby", "p-mytools-label"); mytoolsi.setAttribute("type", "checkbox"); var mytoolsh = document.createElement("h3"); mytools.appendChild(mytoolsh); mytoolsh.setAttribute("id", "p-mytools-label"); mytoolsh.innerHTML = (" Tools "); var menu2 = document.createElement("div"); menu2.setAttribute("class", "menu"); mytools.appendChild(menu2); var menul2 = document.getElementsByClassName("tools-menu")[0]; menu2.appendChild(menul2); if(document.getElementById("ca-tools-customize")) { menul2.appendChild(document.getElementById("ca-tools-customize")); } if(document.getElementById("ca-admin")) { menul2.appendChild(document.getElementById("ca-admin")); } if(document.getElementById("ca-shortcuts")) { menul2.appendChild(document.getElementById("ca-shortcuts")); } if(document.getElementsByClassName("mytools")[0]) { document.getElementsByClassName("mytools")[0].remove; //emptied }
 * document.getElementById("ca-delete")
 * document.getElementById("ca-undelete")
 * document.getElementById("ca-protect")
 * document.getElementById("ca-unprotect") ) {

/* sidebar * Based on Wikipedia's sidebar and Uncyclopedia's former Monobook sidebar. */ /** commented out by Pythoncoder... too Uncyclopedia-specific var mwpanel = document.createElement("div"); mwnav.appendChild(mwpanel); mwpanel.setAttribute("id", "mw-panel"); //logo var plogo = document.createElement("div"); mwpanel.appendChild(plogo); plogo.setAttribute("id", "p-logo"); plogo.setAttribute("role", "banner"); var plogoa = document.createElement("a"); plogo.appendChild(plogoa); plogoa.setAttribute("class", "mw-wiki-logo"); plogoa.setAttribute("href", "/wiki/Main_Page"); plogoa.setAttribute("title", "Visit the main page"); //Navigation var pnav = document.createElement("div"); mwpanel.appendChild(pnav); pnav.setAttribute("id", "p-navigation"); pnav.setAttribute("class", "portal"); pnav.setAttribute("role", "navigation"); pnav.setAttribute("aria-labelledby", "p-navigation-label"); var pnavh = document.createElement("h3"); pnav.appendChild(pnavh); pnavh.setAttribute("id", "p-navigation-label"); pnavh.innerHTML = "Navigation"; var body1 = document.createElement("div"); pnav.appendChild(body1); body1.setAttribute("class", "body"); var body1ul = document.createElement("ul"); body1.appendChild(body1ul); var body1li1 = document.createElement("li"); body1ul.appendChild(body1li1); body1li1.setAttribute("id", "n-mainpage-description"); var body1li1a = document.createElement("a"); body1li1.appendChild(body1li1a); body1li1a.setAttribute("href", "/wiki/Main_Page"); body1li1a.setAttribute("title", "Visit the main page [Alt+Shift+z]"); body1li1a.setAttribute("accesskey", "z"); body1li1a.innerHTML = "Main page"; var body1li2 = document.createElement("li"); body1ul.appendChild(body1li2); body1li2.setAttribute("id", "n-featuredcontent"); var body1li2a = document.createElement("a"); body1li2.appendChild(body1li2a); body1li2a.setAttribute("href", "/wiki/Uncyclopedia:Best_of"); body1li2a.setAttribute("title", "Featured content – the best of Uncyclopedia"); body1li2a.innerHTML = "Featured content"; var body1li3 = document.createElement("li"); body1ul.appendChild(body1li3); body1li3.setAttribute("id", "n-currentevents"); var body1li3a = document.createElement("a"); body1li3.appendChild(body1li3a); body1li3a.setAttribute("href", "/wiki/UnNews:Main_Page"); body1li3a.setAttribute("title", "Find background information on current events"); body1li3a.innerHTML = "Current events"; var body1li4 = document.createElement("li"); body1ul.appendChild(body1li4); body1li4.setAttribute("id", "n-randompage"); var body1li4a = document.createElement("a"); body1li4.appendChild(body1li4a); body1li4a.setAttribute("href", "/wiki/Special:Random"); body1li4a.setAttribute("title", "Load a random article [Alt+Shift+x]"); body1li4a.setAttribute("accesskey", "x"); body1li4a.innerHTML = "Random article"; var body1li5 = document.createElement("li"); body1ul.appendChild(body1li5); body1li5.setAttribute("id", "n-randompage"); var body1li5a = document.createElement("a"); body1li5.appendChild(body1li5a); body1li5a.setAttribute("href", "/wiki/Uncyclopedia:Fundraising"); body1li5a.setAttribute("title", "Support us"); body1li5a.innerHTML = "Donate to Uncyclopedia"; //Interaction var pint = document.createElement("div"); mwpanel.appendChild(pint); pint.setAttribute("id", "p-interaction"); pint.setAttribute("class", "portal"); pint.setAttribute("role", "navigation"); pint.setAttribute("aria-labelledby", "p-interaction-label"); var pinth = document.createElement("h3"); pint.appendChild(pinth); pinth.setAttribute("id", "p-interaction-label"); pinth.innerHTML = "Interaction"; var body2 = document.createElement("div"); pint.appendChild(body2); body2.setAttribute("class", "body"); var body2ul = document.createElement("ul"); body2.appendChild(body2ul); var body2li1 = document.createElement("li"); body2ul.appendChild(body2li1); body2li1.setAttribute("id", "n-help"); var body2li1a = document.createElement("a"); body2li1.appendChild(body2li1a); body2li1a.setAttribute("href", "/wiki/Help:Contents"); body2li1a.setAttribute("title", "Guidance on how to use and edit Uncyclopedia"); body2li1a.innerHTML = "Help"; var body2li2 = document.createElement("li"); body2ul.appendChild(body2li2); body2li2.setAttribute("id", "n-aboutsite"); var body2li2a = document.createElement("a"); body2li2.appendChild(body2li2a); body2li2a.setAttribute("href", "/wiki/Uncyclopedia:About"); body2li2a.setAttribute("title", "Find out about Uncyclopedia"); body2li2a.innerHTML = "About Uncyclopedia"; var body2li3 = document.createElement("li"); body2ul.appendChild(body2li3); body2li3.setAttribute("id", "n-portal"); var body2li3a = document.createElement("a"); body2li3.appendChild(body2li3a); body2li3a.setAttribute("href", "/wiki/Uncyclopedia:Community_Portal"); body2li3a.setAttribute("title", "About the project, what you can do, where to find things"); body2li3a.innerHTML = "Community portal"; var body2li4 = document.createElement("li"); body2ul.appendChild(body2li4); body2li4.setAttribute("id", "n-recentchanges"); var body2li4a = document.createElement("a"); body2li4.appendChild(body2li4a); body2li4a.setAttribute("href", "/wiki/Special:RecentChanges"); body2li4a.setAttribute("title", "A list of recent changes in the wiki [Alt+Shift+r]"); body2li4a.setAttribute("accesskey", "r"); body2li4a.innerHTML = "Recent changes"; var body2li5 = document.createElement("li"); body2ul.appendChild(body2li5); body2li5.setAttribute("id", "n-villagedump"); var body2li5a = document.createElement("a"); body2li5.appendChild(body2li5a); body2li5a.setAttribute("href", "/wiki/Forum:Village_Dump"); body2li5a.setAttribute("title", "Join the CABAL (if there is one (which there isn't))"); body2li5a.innerHTML = "Village Dump"; var body2li6 = document.createElement("li"); body2ul.appendChild(body2li6); body2li6.setAttribute("id", "n-peereview"); var body2li6a = document.createElement("a"); body2li6.appendChild(body2li6a); body2li6a.setAttribute("href", "/wiki/Uncyclopedia:Pee_Review"); body2li6a.setAttribute("title", "Free urine sample evaluations"); body2li6a.innerHTML = "Pee Review"; var body2li7 = document.createElement("li"); body2ul.appendChild(body2li7); body2li7.setAttribute("id", "n-vfh"); var body2li7a = document.createElement("a"); body2li7.appendChild(body2li7a); body2li7a.setAttribute("href", "/wiki/Uncyclopedia:VFH/summary"); body2li7a.setAttribute("title", "Vote for articles to feature on the main page"); body2li7a.innerHTML = "Votes for Highlight"; var body2li8 = document.createElement("li"); body2ul.appendChild(body2li8); body2li8.setAttribute("id", "n-vfd"); var body2li8a = document.createElement("a"); body2li8.appendChild(body2li8a); body2li8a.setAttribute("href", "/wiki/Uncyclopedia:VFD"); body2li8a.setAttribute("title", "Vote for articles to be deleted"); body2li8a.innerHTML = "Votes for Deletion"; var body2li9 = document.createElement("li"); body2ul.appendChild(body2li9); body2li9.setAttribute("id", "n-vfp"); var body2li9a = document.createElement("a"); body2li9.appendChild(body2li9a); body2li9a.setAttribute("href", "/wiki/Uncyclopedia:VFP"); body2li9a.setAttribute("title", "Vote for images to feature on the main page"); body2li9a.innerHTML = "Votes for Pictures"; var body2li10 = document.createElement("li"); body2ul.appendChild(body2li10); body2li10.setAttribute("id", "n-unsignpost"); var body2li10a = document.createElement("a"); body2li10.appendChild(body2li10a); body2li10a.setAttribute("href", "/wiki/Uncyclopedia:UnSignpost"); body2li10a.setAttribute("title", "The latest Uncyclopedia news (or lack thereof)"); body2li10a.innerHTML = "UnSignpost"; //Participate var ppar = document.createElement("div"); mwpanel.appendChild(ppar); ppar.setAttribute("id", "p-participate"); ppar.setAttribute("class", "portal"); ppar.setAttribute("role", "navigation"); ppar.setAttribute("aria-labelledby", "p-participate-label"); var pparh = document.createElement("h3"); ppar.appendChild(pparh); pparh.setAttribute("id", "p-participate-label"); pparh.innerHTML = "Participate"; var body3 = document.createElement("div"); ppar.appendChild(body3); body3.setAttribute("class", "body"); var body3ul = document.createElement("ul"); body3.appendChild(body3ul); var body3li1 = document.createElement("li"); body3ul.appendChild(body3li1); body3li1.setAttribute("id", "n-thingstodo"); var body3li1a = document.createElement("a"); body3li1.appendChild(body3li1a); body3li1a.setAttribute("href", "/wiki/Uncyclopedia:What_You_Can_Do"); body3li1a.setAttribute("title", "Prevents you from touching yourself"); body3li1a.innerHTML = "Things to do"; var body3li2 = document.createElement("li"); body3ul.appendChild(body3li2); body3li2.setAttribute("id", "n-requestedarticles"); var body3li2a = document.createElement("a"); body3li2.appendChild(body3li2a); body3li2a.setAttribute("href", "/wiki/Uncyclopedia:Requested_articles"); body3li2a.setAttribute("title", "List articles you'd like to see written but are too lazy to work on yourself. Slacker. Or create articles other people have listed, but we'd rather not get our hopes up."); body3li2a.innerHTML = "Requested articles"; var body3li3 = document.createElement("li"); body3ul.appendChild(body3li3); body3li3.setAttribute("id", "n-requestedimages"); var body3li3a = document.createElement("a"); body3li3.appendChild(body3li3a); body3li3a.setAttribute("href", "/wiki/Uncyclopedia:RadicalX's_Corner"); //body3li3a.setAttribute("title", ""); body3li3a.innerHTML = "Requested images"; var body3li4 = document.createElement("li"); body3ul.appendChild(body3li4); body3li4.setAttribute("id", "n-reportaproblem"); var body3li4a = document.createElement("a"); body3li4.appendChild(body3li4a); body3li4a.setAttribute("href", "/wiki/Uncyclopedia:Report_a_problem"); //body3li4a.setAttribute("title", ""); body3li4a.innerHTML = "Report a problem"; var body3li5 = document.createElement("li"); body3ul.appendChild(body3li5); body3li5.setAttribute("id", "n-happening"); var body3li5a = document.createElement("a"); body3li5.appendChild(body3li5a); body3li5a.setAttribute("href", "/wiki/Uncyclopedia:At_A_Glance"); //body3li5a.setAttribute("title", ""); body3li5a.innerHTML = "What's happening"; var body3li6 = document.createElement("li"); body3ul.appendChild(body3li6); body3li6.setAttribute("id", "n-foreignoffice"); var body3li6a = document.createElement("a"); body3li6.appendChild(body3li6a); body3li6a.setAttribute("href", "/wiki/Uncyclopedia:Foreign_Office"); //body3li6a.setAttribute("title", ""); body3li6a.innerHTML = "Foreign Office"; //Tools var ptb = document.createElement("div"); mwpanel.appendChild(ptb); ptb.setAttribute("id", "p-tb"); ptb.setAttribute("class", "portal"); ptb.setAttribute("role", "navigation"); ptb.setAttribute("aria-labelledby", "p-tb-label"); var ptbh = document.createElement("h3"); ptb.appendChild(ptbh); ptbh.setAttribute("id", "p-tb-label"); ptbh.innerHTML = "Tools"; var body4 = document.createElement("div"); ptb.appendChild(body4); body4.setAttribute("class", "body"); var body4ul = document.createElement("ul"); body4.appendChild(body4ul); if(wgNamespaceNumber !== -1) { var body4li1 = document.createElement("li"); body4ul.appendChild(body4li1); body4li1.setAttribute("id", "t-whatlinkshere"); var body4li1a = document.createElement("a"); body4li1.appendChild(body4li1a); body4li1a.setAttribute("href", "/wiki/Special:WhatLinksHere/" + wgPageName); body4li1a.setAttribute("title", "List of all English Uncyclopedia pages containing links to this page [Alt+Shift+j]"); body4li1a.setAttribute("accesskey", "j"); body4li1a.innerHTML = "What links here"; } if(wgArticleId !== 0) { var body4li2 = document.createElement("li"); body4ul.appendChild(body4li2); body4li2.setAttribute("id", "t-recentchangeslinked"); var body4li2a = document.createElement("a"); body4li2.appendChild(body4li2a); body4li2a.setAttribute("href", "/wiki/Special:RecentChangesLinked/" + wgPageName); body4li2a.setAttribute("title", "Recent changes in pages linked from this page [Alt+Shift+k]"); body4li2a.setAttribute("accesskey", "k"); body4li2a.innerHTML = "Related changes"; } if(wgRelevantUserName !== undefined) { var body4li3 = document.createElement("li"); body4ul.appendChild(body4li3); body4li3.setAttribute("id", "t-contributions"); var body4li3a = document.createElement("a"); body4li3.appendChild(body4li3a); body4li3a.setAttribute("href", "/wiki/Special:Contributions/" + wgRelevantUserName ); body4li3a.setAttribute("title", "A list of contributions by this user"); body4li3a.innerHTML = "User contributions"; var body4li4 = document.createElement("li"); body4ul.appendChild(body4li4); body4li4.setAttribute("id", "t-log"); var body4li4a = document.createElement("a"); body4li4.appendChild(body4li4a); body4li4a.setAttribute("href", "/wiki/Special:Log/" + wgRelevantUserName ); body4li4a.setAttribute("title", "View the list of actions by this user"); body4li4a.innerHTML = "Logs"; if(userIsInGroup("sysop")) { var body4li5 = document.createElement("li"); body4ul.appendChild(body4li5); body4li5.setAttribute("id", "t-blockip"); var body4li5a = document.createElement("a"); body4li5.appendChild(body4li5a); body4li5a.setAttribute("href", "/wiki/Special:Block/" + wgRelevantUserName ); body4li5a.innerHTML = "Block user"; var body4li6 = document.createElement("li"); body4ul.appendChild(body4li6); body4li6.setAttribute("id", "t-userrights"); var body4li6a = document.createElement("a"); body4li6.appendChild(body4li6a); body4li6a.setAttribute("href", "/wiki/Special:UserRights/" + wgRelevantUserName ); body4li6a.innerHTML = "User rights management";*/ /* I'm using the old wording because the pre-1.30(?) Special:UserRights is * different in permissions, language and spirit from the modern "view/change * user groups" version. */ /* commented out by Pythoncoder... too Uncyclopedia-specific } } var body4li7 = document.createElement("li"); body4ul.appendChild(body4li7); body4li7.setAttribute("id", "t-whatlinkshere"); var body4li7a = document.createElement("a"); body4li7.appendChild(body4li7a); body4li7a.setAttribute("href", "/wiki/Special:Upload"); body4li7a.setAttribute("title", "Upload files [Alt+Shift+u]"); body4li7a.setAttribute("accesskey", "u"); body4li7a.innerHTML = "Upload file"; var body4li8 = document.createElement("li"); body4ul.appendChild(body4li8); body4li8.setAttribute("id", "t-specialpages"); var body4li8a = document.createElement("a"); body4li8.appendChild(body4li8a); body4li8a.setAttribute("href", "/wiki/Special:SpecialPages"); body4li8a.setAttribute("title", "A list of all special pages [Alt+Shift+q]"); body4li8a.setAttribute("accesskey", "q"); body4li8a.innerHTML = "Special pages"; if(wgArticleId !== 0) { var body4li9 = document.createElement("li"); body4ul.appendChild(body4li9); body4li9.setAttribute("id", "t-permalink"); var body4li9a = document.createElement("a"); body4li9.appendChild(body4li9a); body4li9a.setAttribute("href", "/wiki/" + wgPageName + "?oldid=" + wgCurRevisionId); body4li9a.setAttribute("title", "Permanent link to this revision of the page"); body4li9a.innerHTML = "Permanent link"; } //Languages var plang = document.createElement("div"); mwpanel.appendChild(plang); plang.setAttribute("id", "p-lang"); plang.setAttribute("class", "portal"); plang.setAttribute("role", "navigation"); plang.setAttribute("aria-labelledby", "p-lang-label"); var plangh = document.createElement("h3"); plang.appendChild(plangh); plangh.setAttribute("id", "p-lang-label"); plangh.innerHTML = "Languages"; var body5 = document.createElement("div"); plang.appendChild(body5); body5.setAttribute("class", "body"); if(document.getElementsByClassName("WikiaArticleInterlang")[0]) { body5.appendChild(document.getElementsByClassName("WikiaArticleInterlang")[0].getElementsByTagName("ul")[0]); document.getElementsByClassName("WikiaArticleInterlang")[0].remove; } else { //empty ul for looks var body5ul = document.createElement("ul"); body5.appendChild(body5ul); } //footer /*var footer = document.createElement("div"); body.appendChild(footer); footer.setAttribute("id", "footer"); footer.setAttribute("role", "contentinfo"); var footerul1 = document.createElement("ul"); footer.appendChild(footerul1); footerul1.setAttribute("id", "footer-places"); var footerli1 = document.createElement("li"); footerul1.appendChild(footerli1); footerli1.setAttribute("id", "footer-places-privacy"); var footerli1a = document.createElement("a"); footerli1.appendChild(footerli1a); footerli1a.setAttribute("href", "https://www.wikia.com/Privacy_Policy"); footerli1a.setAttribute("title", "wikia:Privacy Policy"); footerli1a.innerHTML = "Privacy policy"; var footerli2 = document.createElement("li"); footerul1.appendChild(footerli2); footerli2.setAttribute("id", "footer-places-about"); var footerli2a = document.createElement("a"); footerli2.appendChild(footerli2a); footerli2a.setAttribute("href", "https://uncyclopedia.wikia.com/wiki/Uncyclopedia:About"); footerli2a.setAttribute("title", "Uncyclopedia:About"); footerli2a.innerHTML = "About Uncyclopedia"; var footerli3 = document.createElement("li"); footerul1.appendChild(footerli3); footerli3.setAttribute("id", "footer-places-disclaimer"); var footerli3a = document.createElement("a"); footerli3.appendChild(footerli3a); footerli3a.setAttribute("href", "https://uncyclopedia.wikia.com/wiki/Uncyclopedia:General_disclaimer"); footerli3a.setAttribute("title", "Uncyclopedia:General disclaimer"); footerli3a.innerHTML = "Disclaimers"; //Copyright var footerul2 = document.createElement("ul"); footer.appendChild(footerul2); footerul2.setAttribute("id", "footer-icons"); footerul2.setAttribute("class", "noprint"); var footer2li1 = document.createElement("li"); footerul2.appendChild(footer2li1); footer2li1.setAttribute("id", "footer-copyrightico"); var footer2li1a = document.createElement("a"); footer2li1.appendChild(footer2li1a); footer2li1a.setAttribute("href", "https://creativecommons.org/licenses/by-nc-sa/3.0/"); var footer2img1 = document.createElement("img"); footer2li1a.appendChild(footer2img1); footer2img1.setAttribute("src", "https://images1.wikia.nocookie.net/uncyclopedia/images/4/44/Cc-some_rights_88x31.png"); footer2img1.setAttribute("alt", "Creative Commons cc-by-nc-sa"); footer2img1.setAttribute("width", "88"); footer2img1.setAttribute("height", "31"); //Attribution //Yes Wikia, it really is powered by MediaWiki, even if you would like to pretend otherwise. var footer2li2 = document.createElement("li"); footerul2.appendChild(footer2li2); var footer2li2a = document.createElement("a"); footer2li2.appendChild(footer2li2a); footer2li2a.setAttribute("href", "//www.mediawiki.org"); var footer2img2 = document.createElement("img"); footer2li2a.appendChild(footer2img2); footer2img2.setAttribute("src", "//en.wikipedia.org/static/images/poweredby_mediawiki_88x31.png"); footer2img2.setAttribute("alt", "Powered by MediaWiki"); footer2img2.setAttribute("srcset", "//en.wikipedia.org/static/images/poweredby_mediawiki_132x47.png 1.5x, //en.wikipedia.org/static/images/poweredby_mediawiki_176x62.png 2x"); footer2img2.setAttribute("width", "88"); footer2img2.setAttribute("height", "31"); //clear div var footerdiv = document.createElement("div"); footer.appendChild(footerdiv); footerdiv.setAttribute("style", "clear: both");*/

/* Replace uncustomizable text in browser title bar (copy Wikipedia which does not have "the free encyclopedia" as of 2016) */ /* document.getElementsByTagName("title")[0].innerHTML = document.getElementsByTagName("title")[0].innerHTML.replace("| Uncyclopedia | FANDOM powered by Wikia", "- Uncyclopedia");*/

/* Search bar * Touching the Oasis search bar kills the attached javascript and makes it impossible * to edit, so we're doing it the hard way. * The result works fine despite lacking Wikipedia's many event listeners, but there * may be important missing functionality I'm not aware of. */ var psearch = document.createElement("div"); right.appendChild(psearch); psearch.setAttribute("id", "p-search"); psearch.setAttribute("role", "search"); var psearchh = document.createElement("h3"); psearch.appendChild(psearchh); var psearchl = document.createElement("label"); psearchh.appendChild(psearchl); psearchl.setAttribute("for", "searchInput"); psearchl.innerHTML = "Search"; var searchform = document.createElement("form"); psearch.appendChild(searchform); searchform.setAttribute("id", "searchform"); searchform.setAttribute("action", "//uncyclopedia.wikia.com/wiki/Special:Search"); var simplesearch = document.createElement("div"); searchform.appendChild(simplesearch); simplesearch.setAttribute("id", "simpleSearch"); var searchi1 = document.createElement("input"); simplesearch.appendChild(searchi1); searchi1.setAttribute("id", "searchInput"); searchi1.setAttribute("name", "search"); searchi1.setAttribute("placeholder", "Search Uncyclopedia"); searchi1.setAttribute("title", "Search Uncyclopedia [Alt+Shift+f]"); searchi1.setAttribute("accesskey", "f"); searchi1.setAttribute("tabindex", "1"); searchi1.setAttribute("autocomplete", "off"); var searchi2 = document.createElement("input"); simplesearch.appendChild(searchi2); searchi2.setAttribute("value", "Special:Search"); searchi2.setAttribute("name", "title"); searchi2.setAttribute("type", "hidden"); var searchi3 = document.createElement("input"); simplesearch.appendChild(searchi3); searchi3.setAttribute("id", "searchButton"); searchi3.setAttribute("class", "searchButton"); searchi3.setAttribute("name", "go"); searchi3.setAttribute("value", "Go"); searchi3.setAttribute("title", "Go to a page with this exact name if it exists"); searchi3.setAttribute("type", "submit");

/* Make a consistent class for whatever we're using as the "content area" div. * I tried this with replacing the id but now the edit form is doing that annoying thing */ $(".WikiaArticle").addClass("bodyContent"); $(".EditPage").addClass("bodyContent");

//skip links var jumpdiv = document.createElement("div"); document.getElementsByClassName("bodyContent")[0].appendChild(jumpdiv); jumpdiv.setAttribute("id", "jump-to-nav"); var jumplink1 = document.createElement("a"); document.getElementsByClassName("bodyContent")[0].appendChild(jumplink1); jumplink1.setAttribute("class", "mw-jump-link"); jumplink1.setAttribute("href", "#mw-head"); jumplink1.innerHTML = "Jump to navigation"; var jumplink2 = document.createElement("a"); document.getElementsByClassName("bodyContent")[0].appendChild(jumplink2); jumplink2.setAttribute("class", "mw-jump-link"); jumplink2.setAttribute("href", "#p-search"); jumplink2.innerHTML = "Jump to search";

//New messages bar if(document.getElementById("WikiaNotifications")) { var usermessage = document.getElementById("WikiaNotifications").getElementsByTagName("div")[0]; document.getElementsByClassName("bodyContent")[0].appendChild(usermessage); if(document.getElementsByClassName("WikiaArticle")[0]) { document.getElementsByClassName("WikiaArticle")[0].appendChild(document.getElementById("mw-content-text")); } else if(document.getElementsByClassName("EditPage")[0]) { document.getElementsByClassName("EditPage")[0].appendChild(document.getElementById("EditPageMain")); document.getElementsByClassName("EditPage")[0].appendChild(document.getElementsByClassName("editpage-widemode-trigger")[0]); document.getElementsByClassName("EditPage")[0].appendChild(document.getElementById("EditPageRail")); } //make the text slightly more helpful usermessage.setAttribute("class", "usermessage"); usermessage.innerHTML = 'You have new messages (last change).'; } /* otherwise I don't know what we do, or if there is an otherwise */

/* Wrap content and navigation in a div to make it easier to push * it out of the way of the preview box. Yes, it's an annoying hack. */ function fooBar { if(document.getElementById("EditPageDialog")) { //remove existing preview boxes document.getElementById("EditPageDialog").remove; }   var editwrapper = document.createElement("div"); body.appendChild(editwrapper); editwrapper.setAttribute("id", "editwrapper"); editwrapper.appendChild(pagebase); editwrapper.appendChild(headbase); editwrapper.appendChild(document.getElementById("WikiaPage")); editwrapper.appendChild(mwnav); editwrapper.appendChild(footer); } if(document.getElementById("wpPreview")) { document.getElementById("wpPreview").setAttribute("onclick", "fooBar"); } if(document.getElementById("wpPreviewMobile")) { document.getElementById("wpPreviewMobile").setAttribute("onclick", "fooBar"); } if(document.getElementById("wpDiff")) { document.getElementById("wpDiff").setAttribute("onclick", "fooBar"); }

//reorder items after placement of skip links and message bar if(document.getElementsByClassName("WikiaArticle")[0]) { document.getElementsByClassName("WikiaArticle")[0].appendChild(document.getElementById("mw-content-text")); } else if(document.getElementsByClassName("EditPage")[0]) { document.getElementsByClassName("EditPage")[0].appendChild(document.getElementById("EditPageMain")); document.getElementsByClassName("EditPage")[0].appendChild(document.getElementsByClassName("editpage-widemode-trigger")[0]); document.getElementsByClassName("EditPage")[0].appendChild(document.getElementById("EditPageRail")); } if(document.getElementsByClassName("printfooter")[0]) { document.getElementsByClassName("bodyContent")[0].appendChild(document.getElementsByClassName("printfooter")[0]); }

//fix page titles if(document.getElementById("PageHeader")) {//non-user non-editform pages /* All talk pages and all subject pages other than files (solved differently), several * unproblematic namespaces, and user/talk space: get the title from. This * allows DISPLAYTITLE to work. */   if(wgNamespaceNumber !== 0    && wgNamespaceNumber !== -1    && wgNamespaceNumber !== 2 //user subpages    && wgNamespaceNumber !== 6    && wgNamespaceNumber !== 12 //Help    && wgNamespaceNumber !== 102 //UnNews    && wgNamespaceNumber !== 104 //Undictionary    && wgNamespaceNumber !== 106 //Game    && wgNamespaceNumber !== 108 //Babel    ) { document.getElementsByClassName("page-header__title")[0].innerHTML = document.getElementsByTagName("title")[0].innerHTML.replace(" - Uncyclopedia", ""); } else if(wgNamespaceNumber == 6) { /* File pages: get the title from the page name because is also incorrect * here. DISPLAYTITLE doesn't work here anyway so we're not breaking it. */       document.getElementsByClassName("page-header__title")[0].innerHTML = wgPageName.replace(/_/g, " "); }   document.getElementsByClassName("page-header__title")[0].setAttribute("id",    "firstHeading"); } else if(document.getElementById("WikiaUserPagesHeader")) {//user info var fh = document.createElement("h1"); document.getElementById("WikiaUserPagesHeader").appendChild(fh); fh.setAttribute("id", "firstHeading"); if(wgNamespaceNumber == -1) { fh.innerHTML = "User contributions"; } else { fh.innerHTML = document.getElementsByTagName("title")[0].innerHTML.replace(" - Uncyclopedia", ""); }   document.getElementById("UserProfileMasthead").remove; document.getElementsByClassName("tabs-container")[0].remove; } else if(document.getElementById("EditPageHeader")) {//edit window document.getElementById("EditPageHeader").getElementsByTagName("h2")[0].remove; document.getElementById("EditPageHeader").getElementsByTagName("h1")[0].setAttribute("id", "firstHeading"); if(wgArticleId == 0) { document.getElementById("firstHeading").innerHTML = "Creating " + wgPageName.replace(/_/g, " "); } else { document.getElementById("firstHeading").innerHTML = "Editing " + wgPageName.replace(/_/g, " "); } } //diffs if(document.getElementsByClassName("diff-contentalign-left")[0]) { document.getElementById("firstHeading").innerHTML = 'Difference between revisions of "' + wgPageName.replace(/_/g,   " ") + '"'; }

//Add tooltip to "info-icon" on image thumbnails $( 'a.info-icon' ).attr( 'title', 'Enlarge' );

//Edit window

//Preview button stuff if(document.getElementById("wpPreview")) { document.getElementById("wpPreview").setAttribute("accesskey", "p"); document.getElementById("wpPreview").setAttribute("title", "Preview your changes. Please use this before saving. [Alt+Shift+p]"); /* The titles for this and mobile preview don't work because the title attribute somehow gets hijacked into * "data-original-title". I don't know why or how this happens or how to prevent or reverse it. */   document.getElementById("wpPreview").setAttribute("class", "vbutton vbutton2"); //lazy class names document.getElementById("wpPreview").innerHTML = "Show preview"; document.getElementsByClassName("buttons")[0].appendChild(document.getElementById("wpPreview")); } if(document.getElementById("wpPreviewMobile")) { document.getElementById("wpPreviewMobile").setAttribute("accesskey", "a"); document.getElementById("wpPreviewMobile").setAttribute("title", "Preview your changes for a mobile device [Alt+Shift+a]"); document.getElementById("wpPreviewMobile").setAttribute("class", "vbutton vbutton2"); document.getElementById("wpPreviewMobile").innerHTML = "Show mobile preview"; document.getElementsByClassName("buttons")[0].appendChild(document.getElementById("wpPreviewMobile")); } if(document.getElementById("wpDiff")) { document.getElementById("wpDiff").title = "Show the changes you made to the text [Alt+Shift+v]"; document.getElementById("wpDiff").setAttribute("class", "vbutton vbutton2"); document.getElementsByClassName("buttons")[0].appendChild(document.getElementById("wpDiff")); } if(document.getElementById("wpSave")) { document.getElementById("wpSave").title = "Publish your changes [Alt+Shift+s]"; document.getElementById("wpSave").setAttribute("value", "Publish changes"); document.getElementById("wpSave").setAttribute("class", "vbutton vbutton1"); document.getElementsByClassName("buttons")[0].insertBefore(document.getElementById("wpSave"), document.getElementById("wpPreview")); } //Move "Minor edit" after edit summary field if(document.getElementsByClassName("wpSummaryFields")[0]) { document.getElementsByClassName("wpSummaryFields")[0].appendChild(document.getElementsByClassName("checkboxes")[0]); } //Add spans to enable styling if(document.getElementsByClassName("wpMinoredit")[0]) { var mspan1 = document.createElement("span"); document.getElementsByClassName("wpMinoredit")[0].insertBefore(mspan1, document.getElementsByClassName("wpMinoredit")[0].getElementsByTagName("span")[0]); mspan1.appendChild(document.getElementById("wpMinoredit")); var mspan2 = document.createElement("span"); mspan1.appendChild(mspan2); } //Move copyright warning into the gray box if(document.getElementsByClassName("module_content")[0]) { document.getElementsByClassName("module_content")[0].insertBefore(document.getElementsByClassName("mw-editTools")[0], document.getElementsByClassName("buttons")[0]); } //Edit summary field fixes if(document.getElementById("wpSummary")) { document.getElementById("wpSummary").setAttribute("accesskey", "b"); document.getElementById("wpSummary").title = "Enter a short summary [Alt+Shift+b]"; document.getElementById("wpSummary").removeAttribute("placeholder"); } //Move warnings and notices out of the edit box if(document.getElementsByClassName("editor")[0]) { //log boxes if(document.getElementsByClassName("mw-warning-with-logexcerpt")[0]) { document.getElementById("EditPage").insertBefore(document.getElementsByClassName("mw-warning-with-logexcerpt")[0], document.getElementById("EditPageMain")); }   //undo if(document.getElementById("diff")) { document.getElementById("EditPage").insertBefore(document.getElementById("diff"), document.getElementById("EditPageMain")); document.getElementById("EditPage").insertBefore(document.getElementsByClassName("mw-undo-success")[0], document.getElementById("diff")); }   if(document.getElementsByClassName("editpage-notices-html")[0]) { document.getElementById("EditPage").insertBefore(document.getElementsByClassName("editpage-notices-html")[0], document.getElementById("EditPageMain")); } } //Edit window "wordmark" should be removed with JS not CSS because it has the access key "z". if(wgAction == "edit") { if(document.getElementsByClassName("wordmark")[0]) { document.getElementsByClassName("wordmark")[0].remove; } }

//Recent change to red links in recent changes var redlinks = document.getElementsByClassName("new"); var i; for (i = 0; i < redlinks.length; i++) { if(redlinks[i].getAttribute("data-uncrawlable-url")) { redlinks[i].setAttribute("href", window.atob(redlinks[i].getAttribute("data-uncrawlable-url"))); } }

/* Circumvent lazy loading to ensure that hidden images are displayed properly. See also Forum:Images not rendered. if(document.getElementsByTagName("img")[0]) { var images = document.getElementsByTagName("img"); for (var i = 0; i < images.length; i++) { if(images[i].getAttribute("data-src")) { images[i].setAttribute("src", images[i].getAttribute("data-src")); }   } }