MoerkJ/purge.js
From DramaWiki
< User:MoerkJNote: After saving, you may have to bypass your browser's cache to see the changes.
- Firefox / Safari: Hold Shift while clicking Reload, or press either Ctrl-F5 or Ctrl-R (⌘-R on a Mac)
- Google Chrome: Press Ctrl-Shift-R (⌘-Shift-R on a Mac)
- Internet Explorer: Hold Ctrl while clicking Refresh, or press Ctrl-F5
- Opera: Go to Menu → Settings (Opera → Preferences on a Mac) and then to Privacy & security → Clear browsing data → Cached images and files.
/*
* Adds a purge button to the tool menu
*/
function addPurgeButton()
{
var href = document.location.href;
if ( href.search( /^http:\/\/wiki\.d-addicts\.com\// ) == 0 ||
href.search( /^http:\/\/46\.165\.216\.86\/~wiki\/wiki\// ) == 0 )
{
var historyHref = document.getElementById( "ca-history" ).firstChild.href;
var div = document.getElementById( "p-cactions" );
var ul = div.getElementsByTagName( "ul" )[0];
var newLi = document.createElement( "li" );
var newA = document.createElement( "a" );
newA.setAttribute( "href" , historyHref.replace( "=history" , "=purge" ) );
var text = document.createTextNode( "Purge Cache" );
newA.appendChild( text );
newLi.appendChild( newA );
ul.appendChild( newLi );
}
}
window.addEventListener( "load" , addPurgeButton , false );