MediaWiki:Gadget-ProjectNotification.js
Nota: Depois de publicar, poderá ter de contornar a 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: Pressione Ctrl enquanto clica Recarregar, ou pressione Ctrl-F5
- Opera: Pressione Ctrl-F5.
function getProjectNotification( data ) {
var html = data[0].parse && data[0].parse.text['*'];
if ( html ) {
mw.hook( 'wikipage.content' ).fire(
$( '#mw-content-text' ).prepend( html )
);
}
}
if ( mw.config.get( 'wgTitle' ) === mw.config.get( 'wgUserName' ) && $.inArray( mw.config.get('wgAction'), [ 'view', 'purge', 'submit' ] ) !== -1 ) {
$.when(
$.getJSON( mw.util.wikiScript( 'api' ), {
format: 'json',
action: 'parse',
text: '{{Lembretes}}',
title: mw.config.get( 'wgPageName' )
} ),
$.ready
).then( getProjectNotification );
}