Merge "rdbms: clarfiy some comments about commitMasterChanges() methods"
[lhc/web/wiklou.git] / resources / src / mediawiki.page.watch.ajax.js
index 5b41876..f7fbeef 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' );
 
                actionPaths = mw.config.get( 'wgActionPaths' );
                for ( key in actionPaths ) {
-                       if ( actionPaths.hasOwnProperty( key ) ) {
-                               parts = actionPaths[ key ].split( '$1' );
-                               parts = parts.map( mw.RegExp.escape );
-                               m = new RegExp( parts.join( '(.+)' ) ).exec( url );
-                               if ( m && m[ 1 ] ) {
-                                       return key;
-                               }
-
+                       parts = actionPaths[ key ].split( '$1' );
+                       parts = parts.map( mw.RegExp.escape );
+                       m = new RegExp( parts.join( '(.+)' ) ).exec( url );
+                       if ( m && m[ 1 ] ) {
+                               return key;
                        }
                }
 
                                .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 ) );
+}() );