User:Kaldari/topalert.js

( function( $, mw ) { $alert = ' '; $alert += ' '; $alert += ' You have new messages. (view changes) '; $alert += ' '; $(document).ready(function { $( '.usermessage' ).hide; // just in case var newMsgRevisionId = mw.config.get( 'wgUserNewMsgRevisionId' ); if ( newMsgRevisionId ) { var userName = mw.config.get( 'wgUserName' ); var talkLink = '/wiki/User_talk:' + userName + '?redirect=no'; var diffLink = '/w/index.php?title=User_talk:' + userName + '&oldid=' + newMsgRevisionId + '&diff=cur'; $( 'body' ).append( $alert ); $( '#mw-echo-close-box' ).click( function( e ) {			$( '#mw-echo-sliding-alert' ).hide;			e.preventDefault;		} ); $( 'a#mw-echo-talk-link' ).attr( 'href', talkLink ); $( 'a#mw-echo-talk-diff-link' ).attr( 'href', diffLink ); $( '#mw-echo-sliding-alert' ).css( {			'position': 'fixed',			'top': '0.5em',			'z-index': 99,			'margin': '0 auto',			'width': '320px',			'left': 0,			'right': 0,			'padding': 0,			'background-color': '#FFD86E',			'-moz-border-radius': '5px',			'border-radius': '5px'		} ); $( '#mw-echo-alert-text' ).css( {			'margin': '0px 3em 0px 1.4em',			'font-size': '13px',			'font-weight': 'bold',			'font-family': 'sans-serif',			'line-height': '38px',			'white-space': 'nowrap'		} ); mw.config.set( 'echoNewMsgAlertDisplayed', true ); } } ); } )( jQuery, mediaWiki );