Jump to content

User:Shack/monobook.js

From Wikipedia, the free encyclopedia
Note: After saving, you have to bypass your browser's cache to see the changes. Google Chrome, Firefox, Microsoft Edge and Safari: Hold down the ⇧ Shift key and click the Reload toolbar button. For details and instructions about other browsers, see Wikipedia:Bypass your cache.
// [[User:Lupin/popups.js]] - please include this line 
importScript('User:Lupin/popups.js');

/**
 * 增加「強制刷新」按鈕
 */
$(function(){
        var ca_history = document.getElementById( "ca-history" );
        if ( ca_history && document.location.href.indexOf(mw.config.get('wgServer')+mw.config.get('wgArticlePath').replace("$1","")) == 0 ){
                var newA = document.createElement( "a" );
                newA.setAttribute( "href" , ca_history.firstChild.href.replace( "=history" , "=purge" ) );
                newA.appendChild( document.createTextNode( "強制刷新" ) );
                var newLi = document.createElement( "li" );
                newLi.appendChild( newA );
                var ul = ca_history.parentNode;
                ul.appendChild( newLi );
        }
});