Merge "installer: Avoid <doclink/> hack for 'config-sidebar' rendering"
[lhc/web/wiklou.git] / resources / src / mediawiki.page.watch.ajax.js
index 2002b9f..f550a91 100644 (file)
@@ -14,7 +14,7 @@
  * @class mw.plugin.page.watch.ajax
  * @singleton
  */
-( function ( mw, $ ) {
+( function () {
        var watch,
                // The name of the page to watch or unwatch
                title = mw.config.get( 'wgRelevantPageName' );
                        $links = $links.filter( ':not( #bodyContent *, #content * )' );
                }
 
-               $links.click( function ( e ) {
+               $links.on( 'click', function ( e ) {
                        var mwTitle, action, api, $link;
 
                        mwTitle = mw.Title.newFromText( title );
 
                        $link = $( this );
 
+                       // eslint-disable-next-line no-jquery/no-class-state
                        if ( $link.hasClass( 'loading' ) ) {
                                return;
                        }
                                .done( function ( watchResponse ) {
                                        var message, otherAction = action === 'watch' ? 'unwatch' : 'watch';
 
-                                       if ( mwTitle.getNamespaceId() > 0 && mwTitle.getNamespaceId() % 2 === 1 ) {
+                                       if ( mwTitle.isTalkPage() ) {
                                                message = action === 'watch' ? 'addedwatchtext-talk' : 'removedwatchtext-talk';
                                        } else {
                                                message = action === 'watch' ? 'addedwatchtext' : 'removedwatchtext';
                } );
        } );
 
-}( mediaWiki, jQuery ) );
+}() );