otherAction = action === 'watch' ? 'unwatch' : 'watch';
accesskeyTip = $link.attr( 'title' ).match( mw.util.tooltipAccessKeyRegexp );
$li = $link.closest( 'li' );
+
/**
* Trigger a 'watchpage' event for this List item.
* Announce the otherAction value as the first param.
* Used to monitor the state of watch link.
* TODO: Revise when system wide hooks are implemented
*/
- if( state === undefined ) {
+ if ( state === undefined ) {
$li.trigger( 'watchpage.mw', otherAction );
}
// Expose local methods
mw.page.watch = {
- 'updateWatchLink': updateWatchLink
+ updateWatchLink: updateWatchLink
};
$( document ).ready( function () {
otherAction = action === 'watch' ? 'unwatch' : 'watch';
$li = $link.closest( 'li' );
- mw.util.jsMessage( watchResponse.message, 'ajaxwatch' );
+ mw.notify( $.parseHTML( watchResponse.message ), {
+ tag: 'watch-self'
+ } );
// Set link to opposite
updateWatchLink( $link, otherAction );
if ( watchResponse.watched !== undefined ) {
$( '#wpWatchthis' ).prop( 'checked', true );
} else {
- $( '#wpWatchthis' ).removeProp( 'checked' );
+ $( '#wpWatchthis' ).prop( 'checked', false );
}
},
// Error
function () {
- var cleanTitle, html, link;
+ var cleanTitle, msg, link;
// Reset link to non-loading mode
updateWatchLink( $link, action );
title: cleanTitle
}, cleanTitle
);
- html = mw.msg( 'watcherrortext', link );
+ msg = mw.messsage( 'watcherrortext', link );
// Report to user about the error
- mw.util.jsMessage( html, 'ajaxwatch' );
+ mw.notify( msg, { tag: 'watch-self' } );
}
);
- });
- });
+ } );
+ } );
}( mediaWiki, jQuery ) );