Jump to content

User:Coin945/vector.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.
importScript('User:TheDJ/sharebox.js');
importScript('User:Yair rand/ReferenceTooltips.js'); importStylesheet('User:Yair rand/ReferenceTooltips.css');


/**
 * Unwatch from watchlist ([[bugzilla:424]])
 * Unwatchlink per item on watchlist (adds " | unwatch" for each entry)
 * Rewritten by Krinkle (2011-01-31)
 *
 * @source: www.mediawiki.org/wiki/Snippets/Unwatch_from_watchlist
 * @rev: 1
 */
function addUnwatchlink(){
        // Only on Watchlist and not in the /edit or /raw mod
        if ( mw.config.get( 'wgCanonicalSpecialPageName' ) !== 'Watchlist' || window.location.href.indexOf( '/edit' ) > 0 || window.location.href.indexOf( '/raw' ) > 0 ) {
                return false;
        }
        // Get the links        
        var $wlHistLinks = $( '#content' ).find( 'ul.special > li > a[href$="action=history"]');
        $.each( $wlHistLinks, function() {
                var     $el = $( this ), // Cache the result instead of calling $() again
                        $unwatch = $el.clone()
                                .text( 'unwatch' )
                                .attr( 'href', function( i, val ) {
                                        return val.replace( 'action=history', 'action=unwatch' );
                                } );
                $el.after( $unwatch ).after( ' | ' );
        });
}
$(document).ready( addUnwatchlink );
importScript('User:Salix alba/Citoid.js');
importScript('User:Shubinator/DYKcheck.js'); //DYKcheck tool