Utilizador:Kiz/monobook.js

A UESPWiki – Sua fonte de The Elder Scrolls desde 1995

Nota: Após gravar, terá de limpar a cache do seu navegador para ver as alterações.

  • Firefox / Safari: Pressione Shift enquanto clica Recarregar, ou pressione Ctrl-F5 ou Ctrl-R (⌘-R no Mac)
  • Google Chrome: Pressione Ctrl-Shift-R (⌘-Shift-R no Mac)
  • Internet Explorer: Pressione Ctrl enquanto clica Recarregar, ou pressione Ctrl-F5
  • Opera: Ir para Menu → Configurações (Opera → Preferências no Mac) e, em seguida, Privacidade e segurança → Limpar dados de navegação → Imagens e ficheiros em cache.
// <pre><nowiki>

importScript('User:Kiz/wikied.js');
//importscript fails script somehow

function ModifySidebar(action, section, name, link, sub1name, sub1link, sub2name, sub2link, 
                       sub3name, sub3link, sub4name, sub4link, sub5name, sub5link) {
    try {
        switch (section) {
          case "languages":
            var target = "p-lang";
            break;
          case "toolbox":
            var target = "p-tb";
            break;
          case "navigation":
            var target = "p-navigation";
            break;
          default:
            var target = "p-" + section;
            break;
        }
 
        if (action == "add") {
            var node = document.getElementById(target)
                               .getElementsByTagName('div')[0]
                               .getElementsByTagName('ul')[0];
 
            var aNode = document.createElement('a');
            var liNode = document.createElement('li');
            var ulSub = document.createElement('ul');
 
            var a1Node = document.createElement('a');
            var li1Node = document.createElement('li');
            var a2Node = document.createElement('a');
            var li2Node = document.createElement('li');
            var a3Node = document.createElement('a');
            var li3Node = document.createElement('li');
            var a4Node = document.createElement('a');
            var li4Node = document.createElement('li');
            var a5Node = document.createElement('a');
            var li5Node = document.createElement('li');

            aNode.appendChild(document.createTextNode(name));
            aNode.setAttribute('href', link);
            liNode.appendChild(aNode);
            liNode.className='plainlinks';

            if (!((sub1name === undefined) && (sub1link === undefined))) {
            a1Node.appendChild(document.createTextNode(sub1name));
            a1Node.setAttribute('href', sub1link);
            li1Node.appendChild(a1Node);
            li1Node.className='plainlinks';
            ulSub.appendChild(li1Node);

            if (!((sub2name === undefined) && (sub2link === undefined))) {
            a2Node.appendChild(document.createTextNode(sub2name));
            a2Node.setAttribute('href', sub2link);
            li2Node.appendChild(a2Node);
            li2Node.className='plainlinks';
            ulSub.appendChild(li2Node);

            if (!((sub3name === undefined) && (sub3link === undefined))) {
            a3Node.appendChild(document.createTextNode(sub3name));
            a3Node.setAttribute('href', sub3link);
            li3Node.appendChild(a3Node);
            li3Node.className='plainlinks';
            ulSub.appendChild(li3Node);

            if (!((sub4name === undefined) && (sub4link === undefined))) {
            a4Node.appendChild(document.createTextNode(sub4name));
            a4Node.setAttribute('href', sub4link);
            li4Node.appendChild(a4Node);
            li4Node.className='plainlinks';
            ulSub.appendChild(li4Node);

            if (!((sub5name === undefined) && (sub5link === undefined))) {
            a5Node.appendChild(document.createTextNode(sub5name));
            a5Node.setAttribute('href', sub5link);
            li5Node.appendChild(a5Node);
            li5Node.className='plainlinks';
            ulSub.appendChild(li5Node);
            }
            }
            }
            }
            liNode.appendChild(ulSub);
            }

            node.appendChild(liNode);
        }
 
        if (action == "remove") {
            var list = document.getElementById(target)
                               .getElementsByTagName('div')[0]
                               .getElementsByTagName('ul')[0];
 
            var listelements = list.getElementsByTagName('li');
 
            for (var i = 0; i < listelements.length; i++) {
                if (listelements[i].getElementsByTagName('a')[0].innerHTML == name ||
                    listelements[i].getElementsByTagName('a')[0].href == link) {
 
                    list.removeChild(listelements[i]);
                }
            }
        }
 
        if (action == "clear") {
            var list = document.getElementById(target)
                               .getElementsByTagName('div')[0]
                               .getElementsByTagName('ul')[0];
 
            var listelements = list.childNodes;
             for (var i = list.childNodes.length-1; i>=0; i--) {
                list.removeChild(list.childNodes[i]);
            }
        }

    } catch(e) {
      // lets just ignore what's happened
      return;
    }
}
function CustomizeModificationsOfSidebar() {
//start customsidebar
//cleargeneral
   ModifySidebar("clear",  "general");

//general
   ModifySidebar("add",    "general",   "Main Page",             "http://www.uesp.net/wiki/Main_Page");
   ModifySidebar("add",    "general",   "Featured Images",       "http://www.uesp.net/wiki/UESPWiki:Featured_Images");
   ModifySidebar("add",    "general",   "Featured Articles",     "http://www.uesp.net/wiki/UESPWiki:Featured_Articles");
   ModifySidebar("add",    "general",   "Recent Changes",        "http://www.uesp.net/wiki/Special:RecentChanges");
   ModifySidebar("add",    "general",   "CSList Skyrim",         "http://cs.uesp.net/index.php?game=sr");
   ModifySidebar("add",    "general",   "CSList Oblivion",       "http://cs.uesp.net/index.php?game=ob"); 
 
//sections
    ModifySidebar("clear", "sections");
    ModifySidebar("add",   "sections",  "Lore",                "http://www.uesp.net/wiki/Lore:Main_Page");
    ModifySidebar("add",   "sections",  "Books",               "http://www.uesp.net/wiki/Books:Books");
    ModifySidebar("add",   "sections",  "Online",              "http://www.uesp.net/wiki/Online:Main_Page",
                                        "ESO Map",             "http://esomap.uesp.net");
    ModifySidebar("add",   "sections",  "Skyrim",              "http://www.uesp.net/wiki/Skyrim:Skyrim",
                                        "SR Map",              "http://srmap.uesp.net",
                                        "Dawnguard",           "http://www.uesp.net/Skyrim:Dawnguard",
                                        "Hearthfire",          "http://www.uesp.net/Skyrim:Hearthfire",
                                        "Dragonborn",          "http://www.uesp.net/Dragonborn:Dragonborn",
                                        "DB Map",              "http://dbmap.uesp.net");
    ModifySidebar("add",   "sections",  "Oblivion",            "http://www.uesp.net/wiki/Oblivion:Oblivion",
                                        "OB Map",              "http://obmap.uesp.net",
                                        "Shivering Isles",     "http://www.uesp.net/wiki/Shivering:Shivering_Isles",
                                        "SI Map",              "http://simap.uesp.net",
                                        "Official Plugins",    "http://www.uesp.net/wiki/Oblivion:Official_Plug-ins");
    ModifySidebar("add",   "sections",  "Morrowind",           "http://www.uesp.net/wiki/Morrowind:Morrowind",
                                        "Official Plugins",    "http://www.uesp.net/wiki/Morrowind:Official_Plug-ins");
//community
   ModifySidebar("remove", "community", "Contact Us",            "http://www.uesp.net/wiki/UESPWiki:Contact");
   ModifySidebar("remove", "community", "Links",                 "http://www.uesp.net/wiki/General:Links");
   ModifySidebar("remove", "community", "Community Portal",      "http://www.uesp.net/wiki/UESPWiki:Community_Portal");
   ModifySidebar("add",    "community", "Admin Noticeboard",      "http://www.uesp.net/wiki/UESPWiki:Administrator_Noticeboard");
   ModifySidebar("add",    "community", "Community Portal",       "http://www.uesp.net/wiki/UESPWiki:Community_Portal");
//toolbox
   ModifySidebar("add",    "toolbox",    "My Subpages",           "http://www.uesp.net/wiki/User:Kiz/Subpages");

//chattabremoval
   ModifySidebar("remove", "cactions",  "chat");
}
$(CustomizeModificationsOfSidebar);
// </nowiki></pre>