Knowledge (XXG)

User:Rparle/scripts/purgebutton

Source 📝

33:/* * Add 'Purge' button to list: */ function addPurgeButton() { var href = document.location.href; if ( href.search( /^http:\/\/en\.wikipedia\.org\/wiki\// ) == 0 && document.getElementById( "ca-history" ) ) { var historyHref = document.getElementById( "ca-history" ).firstChild.href; var div = document.getElementById( "p-cactions" ); var ul = div.getElementsByTagName( "ul" ); 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 ); 48:/^http:\/\/en\.wikipedia\.org\/wiki\//, which will match for article pages. It looks for a 'History' button and creates a new button, with the text 'Purge Cache', with the same URL as the 'History' button. The only change is in replacing 40:
of a page, so that it will be regenerated. This is sometimes necessary when changes are made to a template contained in the page. The function works by comparing the
27: 36:
This function adds a 'Purge Cache' button beside the 'History' button on every article. The button is used to purge Knowledge (XXG)'s
56:. The new button is appended to the end of the link list so that it appears along with the 'History', 'Edit' and 'Move' buttons. 63: 71: 82: 45: 67: 17: 78: 37: 60: 41: 85:. That version works on most (all?) wikimedia projects. 59:This function uses the standard functions of the 8: 77:This function has been convered to a 7: 28:User:Rparle/monobook.js/purgebutton 24: 1: 66:. It has been tested only on 44:of the current page to the 99: 79:Greasemonkey user script 64:Document Object Model 46:regular expression 90: 98: 97: 93: 92: 91: 89: 88: 87: 68:Mozilla Firefox 34: 22: 21: 20: 12: 11: 5: 96: 94: 50:action=history 32: 23: 15: 14: 13: 10: 9: 6: 4: 3: 2: 95: 86: 84: 83:Thetorpedodog 80: 75: 73: 69: 65: 62: 57: 55: 51: 47: 43: 39: 31: 29: 19: 76: 58: 54:action=purge 53: 49: 35: 25: 18:User:Rparle 72:Safari 3 52:with 38:cache 26:From 16:< 70:and 61:HTML 81:by 42:URL 74:. 30::

Index

User:Rparle
User:Rparle/monobook.js/purgebutton
cache
URL
regular expression
HTML
Document Object Model
Mozilla Firefox
Safari 3
Greasemonkey user script
Thetorpedodog

Text is available under the Creative Commons Attribution-ShareAlike License. Additional terms may apply.