User:Dr ishmael/monobook.js

// links for admins and bcrats

function addBar { document.getElementById('p-navigation').innerHTML += ' '+ ' '+  ' Command Center '+ ' '+ 'Deletion'+ 'Copyvio'+ 'Master Log'+ 'New Pages</li>'+ '<li id=\>New Images</a></li>'+ '<li id=\>Unused Images</a></li>'+ '<li id=\>Site Notice</a></li>'+ '</ul> '; }

addOnloadHook(addBar);

// add Purge

function addPurge {   var hist; var url; if (!(hist = document.getElementById('ca-history') )) return; if (!(url = hist.getElementsByTagName('a')[0] )) return; if (!(url = url.href )) return; addPortletLink('p-cactions', url.replace(/([?&]action=)history([&#]|$)/, '$1purge$2'),                  'purge', 'ca-purge', 'Purge server cache', '0'); } addOnloadHook(addPurge);

function addCredits {  var hist; var url; if (!(hist = document.getElementById('ca-history') )) return; if (!(url = hist.getElementsByTagName('a')[0] )) return; if (!(url = url.href )) return; addPortletLink('p-cactions', url.replace(/([?&]action=)credits([&#]|$)/, '$1credits$2'),                 'credits', 'ca-credits', 'Display article credits', '0'); } addOnloadHook(addCredits);

// External editor tab addOnloadHook(function {   var editTab = document.getElementById("ca-edit");    if (!editTab) return;    var editURL = editTab.getElementsByTagName("a")[0].href;    addPortletLink("p-cactions", editURL + "&externaledit=true", "EE", "ca-exted", "External editor", ""); });

/**** Guild Wars Wiki Tools - GuildWiki Switch * (c) 2007 by Patrick Westerhoff [poke] */ function gwwtGuildWikiSwitch {  if ( wgNamespaceNumber < 100 ) {    var itemNode = document.createElement( 'li' ); itemNode.appendChild( document.createElement( 'a' ) ); itemNode.lastChild.href = 'http://wiki.guildwars.com/wiki/' + wgCanonicalNamespace + ':' + encodeURIComponent( wgTitle ); itemNode.lastChild.title = 'See this page on Guild Wars Wiki'; itemNode.lastChild.appendChild( document.createTextNode( 'GWW' ) ); document.getElementById( 'p-cactions' ).getElementsByTagName( 'ul' )[0].appendChild( itemNode ); } } hookEvent( 'load', gwwtGuildWikiSwitch );

/***** Custom edit buttons ****/ if (mwCustomEditButtons) { mwCustomEditButtons[mwCustomEditButtons.length] = { "imageFile": "http://images.wikia.com/central/images/2/23/Button_code.png", "speedTip": "Code", "tagOpen": " ", "sampleText": "foo"}

mwCustomEditButtons[mwCustomEditButtons.length] = { "imageFile": "http://images.wikia.com/central/images/d/d5/Button_noinclude.png", "speedTip": "Noinclude", "tagOpen": " ", "tagClose": " ", "sampleText": "bar"}

mwCustomEditButtons[mwCustomEditButtons.length] = { "imageFile": "http://images.wikia.com/gw/images/b/bf/Button_pagename.png", "speedTip": "Pagename", "tagOpen": "", "sampleText": "subst:PAGENAME"}

}

// * // * // SkillDescriptionToggle by Dr Ishmael // * // *

var descShowFull = "[show full descriptions]"; var descShowCon = "[show concise descriptions]";

// Based on createNavigationBarToggleButton in http://www.mediawiki.org/wiki/Manual:NavFrame

function createSkillDescToggleButton {	var descHead= document.getElementById("descHead"); // var descFull = document.getElementById('descFull'); // var descCon = document.getElementById('descCon');  // if (descHead && descFull && descCon) { var descToggleLink = document.createElement("a"); descToggleLink.style.fontWeight = "normal"; descToggleLink.style.fontSize = "smaller"; descToggleLink.setAttribute('id', 'descToggleLink'); descToggleLink.setAttribute('href', 'javascript:toggleSkillDesc;');

var cookiePos = document.cookie.indexOf("showconcise="); var descToggleText; if (cookiePos > -1 && document.cookie.charAt(cookiePos + 12) == 1) { // If showconcise is set, show the concise description... descToggleText = document.createTextNode(descShowFull); descFull.style.display = 'none'; descCon.style.display = 'block'; } else { // ...otherwise show the full description by default descToggleText = document.createTextNode(descShowCon); descFull.style.display = 'block'; descCon.style.display = 'none'; }		descToggleLink.appendChild(descToggleText);

var descToggle = document.getElementById("descToggle"); descToggle.appendChild(descToggleLink);

descHead.appendChild(descToggle); } } addOnloadHook( createSkillDescToggleButton );

//Based on toggleToc in http://guildwars.wikia.com/wiki/MediaWiki:Common.js/Toggler

function toggleSkillDesc { var descFull = document.getElementById('descFull'); // var descCon = document.getElementById('descCon');  // var toggleLink = document.getElementById('descToggleLink'); // 

if (descFull && descCon && toggleLink) { if (descFull.style.display == 'none') { changeText(toggleLink, "show concise descriptions"); descFull.style.display = 'block'; descCon.style.display = 'none'; document.cookie = "showconcise=0"; } else { changeText(toggleLink, "show full descriptions"); descFull.style.display = 'none'; descCon.style.display = 'block'; document.cookie = "showconcise=1"; }	} }

// * // End SkillDescriptionToggle // *

// * // * // PvE/PvP description toggle by Gimmethegepgun // * // *

var descShowPvP = "[show PvP descriptions]"; var descShowPvE = "[show PvE descriptions]"; var descHidePvP = "[hide PvP descriptions]"; var descHidePvE = "[hide PvE descriptions]"; var descShowPvETab = "[show PvE descriptions/table]"; var descShowPvPTab = "[show PvP descriptions/table]"; var descHidePvETab = "[hide PvE descriptions/table]"; var descHidePvPTab = "[hide PvP descriptions/table]";

function createTestToggleButton {	var testActive= document.getElementById("testActive"); if (testActive != null) { var PvEToggle = document.createElement("a"); var PvPToggle = document.createElement("a"); var PvEBody = document.getElementById("PvEBody"); var PvPBody = document.getElementById("PvPBody"); var PvEToggleSet = document.getElementById("showPvE"); var PvPToggleSet = document.getElementById("showPvP"); var PvETable1 = document.getElementById("pve1"); var PvETable2 = document.getElementById("pve2"); var PvETable3 = document.getElementById("pve3"); var PvETable4 = document.getElementById("pve4"); var PvPTable1 = document.getElementById("pvp1"); var PvPTable2 = document.getElementById("pvp2"); var PvPTable3 = document.getElementById("pvp3"); var PvPTable4 = document.getElementById("pvp4"); var fullTable = document.getElementById("progress");

PvEToggle.style.fontWeight = "normal"; PvEToggle.style.fontSize = "smaller"; PvEToggle.setAttribute('id', 'PvEToggler'); PvEToggle.setAttribute('href', 'javascript:toggleTest(0);'); PvPToggle.style.fontWeight = "normal"; PvPToggle.style.fontSize = "smaller"; PvPToggle.setAttribute('id', 'PvPToggler'); PvPToggle.setAttribute('href', 'javascript:toggleTest(1);');

var cookiePvE = document.cookie.indexOf("togglepve="); var cookiePvP = document.cookie.indexOf("togglepvp="); var PvEToggleText; var PvPToggleText; var prevCookie = false;

if (cookiePvE > -1 && document.cookie.charAt(cookiePvE + 10) == 0) { PvEBody.style.display = 'none'; if (PvETable1 != null) { PvETable1.style.display = 'none'; prevCookie = true; if (PvETable2 != null) { PvETable2.style.display = 'none'; } if (PvETable3 != null) { PvETable3.style.display = 'none'; } if (PvETable4 != null) { PvETable4.style.display = 'none'; } PvEToggleText = document.createTextNode(descShowPvETab); } else { PvEToggleText = document.createTextNode(descShowPvE); } } else { PvEBody.style.display = 'block'; if (PvETable1 != null) { fullTable.style.display = ''; PvETable1.style.display = ''; if (PvETable2 != null) { PvETable2.style.display = ''; } if (PvETable3 != null) { PvETable3.style.display = ''; } if (PvETable4 != null) { PvETable4.style.display = ''; } PvEToggleText = document.createTextNode(descHidePvETab); } else { PvEToggleText = document.createTextNode(descHidePvE); } }		if (cookiePvP > -1 && document.cookie.charAt(cookiePvP + 10) == 0) { if (prevCookie == true) { fullTable.style.display = 'none'; } PvPBody.style.display = 'none'; if (PvPTable1 != null) { PvPTable1.style.display = 'none'; if (PvPTable2 != null) { PvPTable2.style.display = 'none'; } if (PvPTable3 != null) { PvPTable3.style.display = 'none'; } if (PvPTable4 != null) { PvPTable4.style.display = 'none'; } PvPToggleText = document.createTextNode(descShowPvPTab); } else { PvPToggleText = document.createTextNode(descShowPvP); } } else { PvPBody.style.display = 'block'; if (PvPTable1 != null) { PvPTable1.style.display = ''; fullTable.style.display = ''; if (PvPTable2 != null) { PvPTable2.style.display = ''; } if (PvPTable3 != null) { PvPTable3.style.display = ''; } if (PvPTable4 != null) { PvPTable4.style.display = ''; } PvPToggleText = document.createTextNode(descHidePvPTab); } else { PvPToggleText = document.createTextNode(descHidePvP); } }		PvEToggle.appendChild(PvEToggleText); PvEToggleSet.appendChild(PvEToggle); PvPToggle.appendChild(PvPToggleText); PvPToggleSet.appendChild(PvPToggle); } } addOnloadHook( createTestToggleButton );

function toggleTest (toggleVal) { var PvEBody = document.getElementById('PvEBody'); var PvPBody = document.getElementById('PvPBody'); var PvEToggle = document.getElementById('PvEToggler'); var PvPToggle = document.getElementById('PvPToggler'); var PvETable1 = document.getElementById('pve1'); var PvETable2 = document.getElementById('pve2'); var PvETable3 = document.getElementById('pve3'); var PvETable4 = document.getElementById('pve4'); var PvPTable1 = document.getElementById('pvp1'); var PvPTable2 = document.getElementById('pvp2'); var PvPTable3 = document.getElementById('pvp3'); var PvPTable4 = document.getElementById('pvp4'); var fullTable = document.getElementById('progress');

if (toggleVal == 0) { if (PvEBody.style.display == 'none') { PvEBody.style.display = 'block'; document.cookie = "togglepve=1"; if (PvETable1 != null) { PvETable1.style.display = ''; if (PvETable2 != null) { PvETable2.style.display = ''; } if (PvETable3 != null) { PvETable3.style.display = ''; } if (PvETable4 != null) { PvETable4.style.display = ''; } changeText(PvEToggle, descHidePvETab); } else { changeText(PvEToggle, descHidePvE); } fullTable.style.display = ''; } else { PvEBody.style.display = 'none'; document.cookie = "togglepve=0"; if (PvETable1 != null) { PvETable1.style.display = 'none'; if (PvETable2 != null) { PvETable2.style.display = 'none'; } if (PvETable3 != null) { PvETable3.style.display = 'none'; } if (PvETable4 != null) { PvETable4.style.display = 'none'; } changeText(PvEToggle, descShowPvETab); } else { changeText(PvEToggle, descShowPvE); } if ((PvPTable1 != null && PvPTable1.style.display == 'none') || PvPTable1 == null) { fullTable.style.display = 'none'; } }	} else { if (PvPBody.style.display == 'none') { PvPBody.style.display = 'block'; document.cookie = "togglepvp=1"; if (PvPTable1 != null) { PvPTable1.style.display = ''; if (PvPTable2 != null) { PvPTable2.style.display = ''; } if (PvPTable3 != null) { PvPTable3.style.display = ''; } if (PvPTable4 != null) { PvPTable4.style.display = ''; } changeText(PvPToggle, descHidePvPTab); } else { changeText(PvPToggle, descHidePvP); } fullTable.style.display = ''; } else { PvPBody.style.display = 'none'; document.cookie = "togglepvp=0"; if (PvPTable1 != null) { PvPTable1.style.display = 'none'; if (PvPTable2 != null) { PvPTable2.style.display = 'none'; } if (PvPTable3 != null) { PvPTable3.style.display = 'none'; } if (PvPTable4 != null) { PvPTable4.style.display = 'none'; } changeText(PvPToggle, descShowPvPTab); } else { changeText(PvPToggle, descShowPvP); } if (PvETable1.style.display == 'none') { fullTable.style.display = 'none'; } }	} }

function removePvP { var removeChecker = document.getElementById('pvp_remove'); var PvPRow = document.getElementById('pvp'); if (removeChecker != null) { PvPRow.style.display = 'none'; } } addOnloadHook( removePvP ); // * // End PvE/PvP description toggle // *