MediaWiki:Gadget-ocultarrefs.js: diferenças entre revisões
Conteúdo apagado Conteúdo adicionado
Atualização do gadget. |
m [conflito entre edições] Simplificação; Correção do posicionamento do link; Suporte aos 4 skins (vector, monobook, cologneblue e modern) |
||
Linha 1: | Linha 1: | ||
var ocultarReferencias = { |
|||
/** |
|||
⚫ | |||
* Hide references of pages |
|||
e.preventDefault(); |
|||
⚫ | |||
⚫ | |||
* @author [[w:pt:user:!Silent]] |
|||
}, |
|||
* @date 03/ago/2014 |
|||
install: function() { |
|||
*/ |
|||
$( mw.util.addPortletLink( |
|||
/* jshint laxbreak: true */ |
|||
⚫ | |||
/* global mediaWiki, jQuery */ |
|||
'p-views' : |
|||
mw.config.get( 'skin' ) === 'cologneblue' ? |
|||
'p-pageoptions' : |
|||
'p-cactions', |
|||
⚫ | |||
'Ocultar refs' |
|||
) ).click( ocultarReferencias.run ); |
|||
⚫ | |||
⚫ | |||
// Hook up installation function |
|||
⚫ | |||
⚫ | |||
'use strict'; |
|||
$( ocultarReferencias.install ); |
|||
mw.messages.set( { |
|||
'hideRefs-show': 'Mostrar', |
|||
'hideRefs-hide': 'Esconder', |
|||
'hideRefs-references': 'referências' |
|||
⚫ | |||
function hideRefs() { |
|||
$( '#ca-history' ).after( |
|||
$( mw.util.addPortletLink( 'p-cactions', '#', mw.messages.get( 'hideRefs-hide' ) + ' ' + mw.messages.get( 'hideRefs-references' ) ) ).click( function() { |
|||
⚫ | |||
$( this ).find( 'a' ).text( |
|||
mw.messages.get( 'hideRefs-' + ( |
|||
$( '.reference' ).css( 'display' ) === 'inline' |
|||
? 'hide' |
|||
: 'show' |
|||
⚫ | |||
) + ' ' + mw.messages.get( 'hideRefs-references' ) |
|||
); |
|||
} ) |
|||
); |
|||
$( '#ca-history' ).next().append( |
|||
$( '<span></span>' ).append( $( $( '#ca-history' ).next().find( 'a' ) ) ) |
|||
); |
|||
} |
} |
||
⚫ | |||
⚫ | |||
) { |
|||
$( hideRefs ); |
|||
} |
|||
}( mediaWiki, jQuery ) ); |
Revisão das 22h53min de 3 de agosto de 2014
var ocultarReferencias = {
run: function( e ) {
e.preventDefault();
$( 'sup.reference' ).hide();
},
install: function() {
$( mw.util.addPortletLink(
mw.config.get( 'skin' ) === 'vector' ?
'p-views' :
mw.config.get( 'skin' ) === 'cologneblue' ?
'p-pageoptions' :
'p-cactions',
'#',
'Ocultar refs'
) ).click( ocultarReferencias.run );
}
};
// Hook up installation function
if ( mw.config.get( 'wgAction' ) !== 'edit' && mw.config.get( 'wgCanonicalNamespace' ) !== 'Special' ) {
$( ocultarReferencias.install );
}