Merge "Fix ParserOutput::getText 'unwrap' flag for end-of-doc comment"
[lhc/web/wiklou.git] / resources / src / mediawiki.special / mediawiki.special.unwatchedPages.js
index a2c2228..34c8bbd 100644 (file)
@@ -7,7 +7,7 @@
                        var promise,
                                api = new mw.Api(),
                                $link = $( this ),
-                               $subjectLink = $link.parents( 'li' ).children( 'a' ).eq( 0 ),
+                               $subjectLink = $link.closest( 'li' ).children( 'a' ).eq( 0 ),
                                title = mw.util.getParamValue( 'title', $link.attr( 'href' ) );
                        // nice format
                        title = mw.Title.newFromText( title ).toText();
@@ -19,6 +19,9 @@
                        }
                        $link.data( 'mwDisabled', true ).addClass( 'mw-watch-link-disabled' );
 
+                       // Preload the notification module for mw.notify
+                       mw.loader.load( 'mediawiki.notification' );
+
                        // Use the class to determine whether to watch or unwatch
                        if ( !$subjectLink.hasClass( 'mw-watched-item' ) ) {
                                $link.text( mw.msg( 'watching' ) );
@@ -28,7 +31,7 @@
                                        mw.notify( mw.msg( 'addedwatchtext-short', title ) );
                                } ).fail( function () {
                                        $link.text( mw.msg( 'watch' ) );
-                                       mw.notify( mw.msg( 'watcherrortext', title ) );
+                                       mw.notify( mw.msg( 'watcherrortext', title ), { type: 'error' } );
                                } );
                        } else {
                                $link.text( mw.msg( 'unwatching' ) );
@@ -38,7 +41,7 @@
                                        mw.notify( mw.msg( 'removedwatchtext-short', title ) );
                                } ).fail( function () {
                                        $link.text( mw.msg( 'unwatch' ) );
-                                       mw.notify( mw.msg( 'watcherrortext', title ) );
+                                       mw.notify( mw.msg( 'watcherrortext', title ), { type: 'error' } );
                                } );
                        }