User:Internoob/colour.js

From Wiktionary, the free dictionary
Jump to navigation Jump to search

Note – after saving, you may have to bypass your browser’s cache to see the changes.

  • Mozilla / Firefox / Safari: hold Shift while clicking Reload, or press either Ctrl-F5 or Ctrl-R (Command-R on a Macintosh);
  • Konqueror and Chrome: click Reload or press F5;
  • Opera: clear the cache in Tools → Preferences;
  • Internet Explorer: hold Ctrl while clicking Refresh, or press Ctrl-F5.

/* This will import a stylesheet for only the main namespace and Appendices of terms. */

var baseOfPage = wgPageName.indexOf("/"); // what position (in numbers) is the / in the pagename

if (baseOfPage == -1) { //if there's no / in the page name
 baseOfPage = wgPageName.length; 
 }

var nameOfPage = wgPageName.slice(0, baseOfPage); //the page name up to and not including the /

// make a list of appendices where the stylesheet is to be included
var listOfAppendices = [ 
 "Appendix:A_Programming_Language", "Appendix:Hyper_Text_Markup_Language", 
 "Appendix:Brave_New_World", "Appendix:DC_Comics", "Appendix:Harry_Potter", 
 "Appendix:Marvel_Comics", "Appendix:Pokémon", "Appendix:Star_Trek", "Appendix:Star_Wars", 
 "Appendix:Tolkien's_legendarium", "Appendix:Unsupported_titles" 
 ]

for (a in listOfAppendices) {
 if (wgNamespaceNumber == 0 || listOfAppendices[a] == nameOfPage ) { //main namespace or one of the list
  importStylesheet("User:Internoob/colour.css");
  break;
  }
 }

importStylesheet("User:Internoob/colour1.css"); //this stuff goes on all pages