User:MarkvA/global.js

// BEGIN Dynamic Navigation Bars (experimental) Script taken from Wikipedia. // Test if an element has a certain class // Description: Uses regular expressions and caching for better performance. // Dutch version

function setCookie(c_name,value,expiredays) { var exdate=new Date; exdate.setDate(exdate.getDate+expiredays); document.cookie=c_name+ "=" +escape(value)+((expiredays==null) ? "" : ";expires="+exdate.toGMTString); }

function getCookie(c_name) { if (document.cookie.length>0) { c_start=document.cookie.indexOf(c_name + "="); if (c_start!=-1) { c_start=c_start + c_name.length+1; c_end=document.cookie.indexOf(";",c_start); if (c_end==-1) c_end=document.cookie.length; return unescape(document.cookie.substring(c_start,c_end)); } } return ""; }

var hasClass = (function { var reCache = {}; return function (element, className) { return (reCache[className] ? reCache[className] : (reCache[className] = new RegExp("(?:\\s|^)" + className + "(?:\\s|$)"))).test(element.className); }; }); var autoCollapse = 2; var collapseCaption = "verberg"; var expandCaption = "toon"; function collapseTable(tableIndex) { var Button = document.getElementById("collapseButton" + tableIndex); var Table = document.getElementById("collapsibleTable" + tableIndex); if (!Table || !Button) return false; var Rows = Table.rows; if (Button.firstChild.data == collapseCaption) { for (var i = 1; i < Rows.length; i++) Rows[i].style.display = "none"; setCookie("hideTable-" + wgArticleId + "-" + tableIndex,1,30); Button.firstChild.data = expandCaption; } else { for (var i = 1; i < Rows.length; i++) Rows[i].style.display = Rows[0].style.display; setCookie("hideTable-" + wgArticleId + "-" + tableIndex,0,30); Button.firstChild.data = collapseCaption; } } function createCollapseButtons { var tableIndex = 0; var NavigationBoxes = new Object; var Tables = document.getElementsByTagName("table"); for (var i = 0; i < Tables.length; i++) { if (hasClass(Tables[i], "collapsible")) { // only add button and increment count if there is a header row to work with var HeaderRow = Tables[i].getElementsByTagName("tr")[0]; if (!HeaderRow) continue; var Header = HeaderRow.getElementsByTagName("th")[0]; if (!Header) continue; NavigationBoxes[tableIndex] = Tables[i]; Tables[i].setAttribute("id", "collapsibleTable" + tableIndex); var Button = document.createElement("span"); var ButtonLink = document.createElement("a"); var ButtonText = document.createTextNode(collapseCaption); Button.style.styleFloat = "right"; Button.style.cssFloat = "right"; Button.style.fontWeight = "normal"; Button.style.textAlign = "right"; Button.style.width = "6em"; ButtonLink.style.color = Header.style.color; ButtonLink.setAttribute("id", "collapseButton" + tableIndex); ButtonLink.setAttribute("href", "javascript:collapseTable(" + tableIndex + ");"); ButtonLink.appendChild(ButtonText); Button.appendChild(document.createTextNode("[")); Button.appendChild(ButtonLink); Button.appendChild(document.createTextNode("]")); Header.insertBefore(Button, Header.childNodes[0]); tableIndex++; } } for (var i = 0; i ",     "sampleText": "Voer code hier in"};   mwCustomEditButtons[mwCustomEditButtons.length] = {     "imageFile": "http://images1.wikia.nocookie.net/central/images/7/73/Button_code_nowiki.png?1",     "speedTip": "Code+Nowiki",     "tagOpen": " ",     "sampleText": "Voer code hier in"};   mwCustomEditButtons[mwCustomEditButtons.length] = {     "imageFile": "http://images1.wikia.nocookie.net/central/images/9/9f/Button_defaultsort.png?1",     "speedTip": "Defaultsort",     "tagOpen": "",     "sampleText": "Voer sleutel hier in"};   mwCustomEditButtons[mwCustomEditButtons.length] = {     "imageFile": "http://images1.wikia.nocookie.net/central/images/3/33/Button_onlyinclude.png",     "speedTip": "Onlyinclude",     "tagOpen": "<" + "onlyinclude" + ">",     "tagClose": "",     "sampleText": "Voer sleutel hier in"};   mwCustomEditButtons[mwCustomEditButtons.length] = { "imageFile": "http://images1.wikia.nocookie.net/central/images/d/d1/Button_pipehack.png?1", "speedTip": "WikiTable hack", "tagOpen": "|", "tagClose": "", "sampleText": ""}; mwCustomEditButtons[mwCustomEditButtons.length] = { "imageFile": "http://images1.wikia.nocookie.net/central/images/2/29/Button_user.png?1", "speedTip": "Mijn globale gebruikerspagina sjabloon", "tagOpen": "", "tagClose": "", "sampleText": ""}; mwCustomEditButtons[mwCustomEditButtons.length] = { "imageFile": "http://images1.wikia.nocookie.net/central/images/2/29/Button_user.png?1", "speedTip": "Mijn globale overlegpagina sjabloon", "tagOpen": "", "tagClose": "", "sampleText": ""};

mwCustomEditButtons[mwCustomEditButtons.length] = { "imageFile": "http://images1.wikia.nocookie.net/central/images/2/29/Button_user.png?1", "speedTip": "Mijn globale gebruikerspagina (NL)", "tagOpen": "", "tagClose": "", "sampleText": ""}; mwCustomEditButtons[mwCustomEditButtons.length] = { "imageFile": "http://images1.wikia.nocookie.net/central/images/2/29/Button_user.png?1", "speedTip": "Mijn globale overlegpagina sjabloon (NL)", "tagOpen": "", "tagClose": "", "sampleText": ""}; } /*********start fd setup ******************/ appendScript('http://www.wikia.com/index.php?title=User:Splarka/fastdelete.js&action=raw&ctype=text/javascript&dontcountme=s') /*********end fd setup, start fd use ******************/ var fdButtons = []; fdButtons[fdButtons.length] = { 'summary': 'Spam', 'label': 'S'}; fdButtons[fdButtons.length] = { 'summary': 'Vandalism', 'label': 'V'}; fdButtons[fdButtons.length] = { 'summary': 'Marked for deletion', 'label': 'M'}; fdButtons[fdButtons.length] = { 'summary': 'Housekeeping', 'label': 'H'}; fdButtons[fdButtons.length] = { 'summary': 'Editing test', 'label': 'T'}; fdButtons[fdButtons.length] = { 'summary': 'Talk page from deleted page', 'label': 'TPD'}; fdButtons[fdButtons.length] = { 'summary': ' ', 'label': 'NR'}; /*************end fd************************************/ /* Almost universal purge button for Wikia. Written Primarily by Splarka and Adapted from http://www.wikia.com/index.php?title=User:Splarka/fastdelete.js Original Purge Script by Rgoodermote http://www.spongebob.wikia.com/wiki/User:Rgoodermote if(wgNamespaceNumber != -1 && wgCurRevisionId != 0) addOnloadHook(addPurgeButton) function addPurgeButton { switch(skin) { case 'quartz': /* pass to quartzslate */ case 'quartzsmoke': /* pass to quartzslate */ case 'quartzslate': addArticleBarlink(wgScriptPath + '/index.php?title=' + encodeURIComponent(wgPageName) + '&action=purge', 'Vernieuw'); break; case 'wow': /* pass to slate */ case 'wookie': /* pass to slate */ case 'memalpha': /* pass to slate */ case 'smoke': /* pass to slate */ case 'slate': addMSBlink(wgScriptPath + '/index.php?title=' + encodeURIComponent(wgPageName) + '&action=purge', 'Vernieuw'); break; case 'chick': /* pass to monobook */ case 'simple': /* pass to monobook */ case 'myskin': /* pass to monobook */ case 'uncyclopedia': /* pass to monobook */ case 'monobook': addPortletLink('p-cactions',wgScriptPath + '/index.php?title=' + encodeURIComponent(wgPageName) + '&action=purge', 'Vernieuw'); break; case 'classic': break; /* not supported yet */ case 'standard': break; /* not supported yet */ case 'cologneblue': break; /* not supported yet */ case 'nostalgia': break; /* not supported yet */ case 'monaco': case 'answers': case 'awesome': addPageBarlink(wgScriptPath + '/index.php?title=' + encodeURIComponent(wgPageName) + '&action=purge', 'Vernieuw'); break; } } function addMSBlink(url, text) { var msbs = document.getElementById('myStuffBar').getElementsByTagName('a')[0].parentNode; var link = document.createElement('a'); link.href = url; link.appendChild(document.createTextNode(text)); link.style.marginLeft = '10px'; link.style.color = 'red'; msbs.appendChild(link); } function addArticleBarlink(url, text) { var ab = getElementsByClassName(document, 'div', 'articleBar'); if(ab.length < 1) return var obj = ab[0].getElementsByTagName('div')[0]; var link = document.createElement('a'); link.style.color = 'red'; link.href = url; link.appendChild(document.createTextNode(text)); obj.appendChild(link); } function addPageBarlink(url, text) { var pc = document.getElementById('page_controls'); if(pc.length < 1) return var d = document.createElement('div'); var link = document.createElement('a'); link.href = url; link.appendChild(document.createTextNode(text)); var nuli = document.createElement('li'); nuli.id = 'control_purge'; nuli.appendChild(d); nuli.appendChild(link); pc.appendChild(nuli); } /* */