Utilizador:ZKoshak/mbook-js
A UESPWiki – Sua fonte de The Elder Scrolls desde 1995
Вариант 1(Gez):
*/ 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() { //ModifySidebar("action", "section", "name", "link"); //Actions are either "add" or "remove" //Sections are general, sections, community, toolbox, etc. // First, let's clean out the "sections" section entirely ModifySidebar("clear", "sections"); // With that out of the way, let's rebuild them in the order we want, for example... ModifySidebar("add", "sections", "Lore", "http://www.uesp.net/wiki/Lore:Main_Page"); ModifySidebar("add", "sections", "Arena", "http://www.uesp.net/wiki/Arena:Arena"); ModifySidebar("add", "sections", "Daggerfall", "http://www.uesp.net/wiki/Daggerfall:Daggerfall"); ModifySidebar("add", "sections", "Morrowind", "http://www.uesp.net/wiki/Morrowind:Morrowind", "Tribunal", "http://www.uesp.net/wiki/Tribunal:Tribunal", "Bloodmoon", "http://www.uesp.net/wiki/Bloodmoon:Bloodmoon", "Tamriel Rebuilt", "http://www.uesp.net/wiki/Tes3Mod:Tamriel_Rebuilt", "Map of Vvardenfell", "http://www.uesp.net/maps/mwmap/mwmap.shtml" ); ModifySidebar("add", "sections", "Oblivion", "http://www.uesp.net/wiki/Oblivion:Oblivion", "Shivering Isles", "http://www.uesp.net/wiki/Shivering:Shivering_Isles", "Tamriel Rebuilt", "http://www.uesp.net/wiki/Tes4Mod:Tamriel_Rebuilt", "Map of Cyrodiil", "http://www.uesp.net/maps/obmap/obmap.shtml", "Map of the Isles", "http://www.uesp.net/maps/simap/simap.shtml" ); ModifySidebar("add", "sections", "Skyrim", "http://www.uesp.net/wiki/Skyrim:Skyrim"); ModifySidebar("add", "sections", "Battlespire", "http://www.uesp.net/wiki/Battlespire:Battlespire"); ModifySidebar("add", "sections", "Redguard", "http://www.uesp.net/wiki/Redguard:Redguard"); ModifySidebar("add", "sections", "Shadowkey", "http://www.uesp.net/wiki/Shadowkey:Shadowkey"); // Finally, a few other tweaks ModifySidebar("remove", "general", "Featured Articles", "http://www.uesp.net/wiki/UESPWiki:Featured_Articles"); ModifySidebar("remove", "general", "Random Page", "http://www.uesp.net/wiki/Special:Random"); ModifySidebar("remove", "general", "How to Contribute", "http://www.uesp.net/wiki/UESPWiki:Getting_Started"); ModifySidebar("remove", "general", "Help Files", "http://www.uesp.net/wiki/Help:Contents"); ModifySidebar("add", "general", "All Content", "http://www.uesp.net/wiki/All_Content"); ModifySidebar("add", "toolbox", "Wanted Categories", "http://www.uesp.net/wiki/Special:Wantedcategories"); ModifySidebar("add", "toolbox", "Wanted Pages", "http://www.uesp.net/wiki/Special:Wantedpages"); } addOnloadHook(CustomizeModificationsOfSidebar); /*
Вариант 2(Kiz):
*/ // function addSinceTab() { // Default number of revisions to check. Set to 0 to use your usual default for a history page. // Sensible options might be 300, 500 or 750. Values up to 5000 are valid, but will be quite slow. if (!window.defaultdiffs) defaultdiffs=0; if (window.location.href.indexOf("&action=history&gotosince=true")!=-1) { do_since_I_last_edited() } else if (wgCanonicalNamespace != "Special") { addPortletLink("p-cactions", "/w/index.php?title="+wgPageName+"&action=history&gotosince=true" + ((defaultdiffs <= 0) ? "" : "&limit=" + defaultdiffs ), 'since', '', "all changes since your last edit"); } } function do_since_I_last_edited() { var csub=document.getElementById("contentSub"); var msg=document.createElement("p"); msg.appendChild(document.createTextNode ("Parsing history... please wait...")); msg.className="error"; csub.insertBefore(msg, csub.firstChild) var hists=document.getElementById("pagehistory").getElementsByTagName('li'); for (n=0;n<hists.length;n++) { if (hists[n].getElementsByTagName("span")[0].getElementsByTagName('a')[0].innerHTML==wgUserName) { document.location=hists[n].childNodes[1].href; return; } } msg.replaceChild(document.createTextNode ("You have not edited this page! (recently). Look at more edits? "), msg.firstChild); var lookharderA = document.createElement("A"); lookharderA.href = wgServer + '/w/index.php?title='+wgPageName+'&action=history&gotosince=true&limit=1000'; lookharderA.innerHTML = '1000'; msg.appendChild(lookharderA); msg.appendChild(document.createTextNode (" ")); lookharderA = document.createElement("A"); lookharderA.href = wgServer + '/w/index.php?title='+wgPageName+'&action=history&gotosince=true&limit=2500'; lookharderA.innerHTML = '2500'; msg.appendChild(lookharderA); msg.appendChild(document.createTextNode (" ")); lookharderA = document.createElement("A"); lookharderA.href = wgServer + '/w/index.php?title='+wgPageName+'&action=history&gotosince=true&limit=5000'; lookharderA.innerHTML = '5000'; msg.appendChild(lookharderA); } addOnloadHook(addSinceTab); // 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() { //ModifySidebar("action", "section", "name", "link"); //Actions are either "add" or "remove" //Sections are general, sections, community, toolbox, etc. // Clean up ModifySidebar("clear", "sections"); ModifySidebar("clear", "community"); ModifySidebar("clear", "general"); // Sections ModifySidebar("add", "sections", "All Content", "http://www.uesp.net/wiki/All_Content"); ModifySidebar("add", "sections", "Lore", "http://www.uesp.net/wiki/Lore:Main_Page"); ModifySidebar("add", "sections", "Skyrim", "http://www.uesp.net/wiki/Skyrim:Skyrim"); ModifySidebar("add", "sections", "Oblivion", "http://www.uesp.net/wiki/Oblivion:Oblivion", "Shivering Isles", "http://www.uesp.net/wiki/Shivering:Shivering_Isles", "Map of Cyrodil", "http://www.uesp.net/maps/obmap/obmap.shtml", "Map of the Isles", "http://www.uesp.net/maps/simap/simap.shtml" ); ModifySidebar("add", "sections", "Morrowind", "http://www.uesp.net/wiki/Morrowind:Morrowind"); ModifySidebar("add", "sections", "Daggerfall", "http://www.uesp.net/wiki/Daggerfall:Daggerfall"); ModifySidebar("add", "sections", "Arena", "http://www.uesp.net/wiki/Arena:Arena"); //General ModifySidebar("add", "general", "Main Page", "http://www.uesp.net/wiki/Main_Page"); ModifySidebar("add", "general", "Featured Articles", "http://www.uesp.net/wiki/UESPWiki:Featured Articles"); ModifySidebar("add", "general", "Featured Images", "http://www.uesp.net/wiki/UESPWiki:Featured Images"); ModifySidebar("add", "general", "Recent Changes", "http://www.uesp.net/wiki/Special:RecentChanges"); // Community ModifySidebar("add", "community", "CP", "http://www.uesp.net/wiki/UESPWiki:Community_Portal"); ModifySidebar("add", "community", "AN", "http://www.uesp.net/wiki/UESPWiki:Administrator_Noticeboard"); ModifySidebar("add", "community", "My Subpages", "http://www.uesp.net/wiki/User:Kiz/Subpages"); ModifySidebar("add", "community", "Help Contents", "http://www.uesp.net/wiki/Help:Contents"); ModifySidebar("add", "community", "Welcome Message", "http://www.uesp.net/wiki/User:Kiz/WMessage"); } addOnloadHook(CustomizeModificationsOfSidebar); addOnloadHook(function () { addPortletLink( "p-personal", wgServer + wgScriptPath + "/index.php?title=User_Talk:Krusty", "Krusty", "K", "More Help", "K", document.getElementById("pt-uaa")); }); addOnloadHook(function () { addPortletLink( "p-personal", wgServer + wgScriptPath + "/index.php?title=User_Talk:Rpeh", "Rpeh", "R", "Complicated Help", "R", document.getElementById("pt-uaa")); }); /*