MediaWiki:Common.js/watchlist.js
Ir para navegação
Ir para pesquisar
Nota: Após publicar, você pode ter que limpar o "cache" do seu navegador para ver as alterações.
- Firefox / Safari: Pressione Shift enquanto clica Recarregar, ou pressione Ctrl-F5 ou Ctrl-R (⌘-R no Mac)
- Google Chrome: Pressione Ctrl-Shift-R (⌘-Shift-R no Mac)
- Internet Explorer/Edge: PressioneCtrl enquanto clica Recarregar, ou Pressione Ctrl-F5
- Opera: Pressione Ctrl-F5.
/** Add dismiss buttons to watchlist-message * Allows multiple dismiss buttons on [[MediaWiki:Watchlist-details]] with bumpable cookie IDs. * Note: HTML is backwards compatible with old version, new version ignores old syntax, except for dismissed IDs. * @author: [[:en:User:Ruud Koot]] * @author: [[:en:User:MZMcBride]] * @author: [[:en:User:Merlissimo]] * @source: [[:de:MediaWiki:Common.js/watchlist.js]] ([[de:Special:PermaLink/66626366]]) */ /*jslint white: true, regexp: true */ /*global jQuery, mediaWiki */ ( function ( mw, $ ) { 'use strict'; var cookiePrefix = mw.config.get( 'wgCookiePrefix' ) + '-hidewatchlistmessage-'; function dismissWatchlistMessage (event) { event.preventDefault(); $( event.target ).closest( '.watchlist-message' ) .hide(); $.cookie( cookiePrefix + $( event.target ).data( 'cookieId' ), 'yes', { expires: 21, // 3 weeks path: '/' } ); } function addDismissButton() { mw.util.addCSS( '.watchlist-message > span { font-size: 0.6em; float:right; position: relative; padding-right: 4px; }' ); mw.util.$content .find( '.watchlist-message' ) .each(function(){ var $link, $button, $this = $(this), cookieId = parseInt( $this.attr( 'class' ) .replace( /.*cookie\-ID\_(\d*).*/ig, '$1' ), 10 ); if ( isNaN( cookieId ) ) { return true; } $link = $( '<a>' ) .text( 'esconder' ) .attr( { href: '#', title: 'Esconda esta mensagem' } ) .addClass( 'dismissButton' ) .data( 'cookieId', cookieId ) .click( dismissWatchlistMessage ); $button = $( '<span>' ) .append( '[' ) .append( $link ) .append( ']' ); $this .toggle( $.cookie( cookiePrefix + cookieId ) !== 'yes' ) .prepend( $button ); }); $( '#watchlist-message' ).show(); } $.when( mw.loader.using( [ 'jquery.cookie', 'mediawiki.util', 'mediawiki.page.startup' ] ), $.ready ).then( addDismissButton ); }( mediaWiki, jQuery ) );