User:Rgoodermote/purge.js

/* Almost universal purge button for Wikia. Adapted from http://www.wikia.com/index.php?title=User:Splarka/fastdelete.js

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', 'purge'); 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', 'purge'); 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', 'purge'); 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', 'purge'); 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_delete'; nuli.appendChild(d); nuli.appendChild(link); pc.appendChild(nuli); }