MediaWiki:Gadget-bluealertfade.js
From Infogalactic: the planetary knowledge core
Note: After saving, you may have to bypass your browser's cache to see the changes.
- Firefox / Safari: Hold Shift while clicking Reload, or press either Ctrl-F5 or Ctrl-R (⌘-R on a Mac)
- Google Chrome: Press Ctrl-Shift-R (⌘-Shift-R on a Mac)
- Internet Explorer: Hold Ctrl while clicking Refresh, or press Ctrl-F5
- Opera: Go to Menu → Settings (Opera → Preferences on a Mac) and then to Privacy & security → Clear browsing data → Cached images and files.
( function( $, mw ) {
$alert = '<div id="mw-echo-blue-pokey"><img src="//upload.wikimedia.org/wikipedia/commons/a/ae/BluePokeyNorth.png"/></div>';
$alert += '<div id="mw-echo-alert">';
$alert += '<div id="mw-echo-alert-text" style="margin: 0px 5px 0px 5px;">You have new talk page messages.</div>';
$alert += '</div>';
$(document).ready(function() {
$( '.usermessage' ).hide();
var newMsgRevisionId = mw.config.get( 'wgUserNewMsgRevisionId' );
if ( newMsgRevisionId ) {
var userName = mw.config.get( 'wgUserName' );
var talkLink = '/wiki/User_talk:' + userName + '?redirect=no';
$( '#pt-mytalk' ).css( {'position': 'relative'} );
$( '#pt-mytalk' ).append( $alert );
var alertWdith = $( '#mw-echo-alert' ).outerWidth();
var newLeft = 0 - ( alertWdith / 2 ) - 5;
$( '#mw-echo-alert' ).css( { 'left': newLeft } );
$( '#mw-echo-alert' ).click( function( e ) {
location.href = talkLink;
e.preventDefault();
} );
$( '#mw-echo-alert' ).hover( function() {
$( '#mw-echo-alert' ).css( { 'background-color': '#3172da' } );
$( '#mw-echo-blue-pokey img' ).attr( 'src', '//upload.wikimedia.org/wikipedia/commons/9/9e/BluePokeyNorthHover.png' );
},
function() {
$( '#mw-echo-alert' ).css( { 'background-color': '#517ABB' } );
$( '#mw-echo-blue-pokey img' ).attr( 'src', '//upload.wikimedia.org/wikipedia/commons/a/ae/BluePokeyNorth.png' );
} );
$( '#mw-echo-alert, #mw-echo-blue-pokey' ).delay( 4000 ).fadeOut( 'slow' );
}
} );
} )( jQuery, mediaWiki );