Nischayn22 has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/51834


Change subject: Watching and Unwatching made 'Change Subject' disappear.
......................................................................

Watching and Unwatching made 'Change Subject' disappear.

instead of doing a .load() we try to cleverly build the html in client
side itself.

bug 45618

Change-Id: I78788348bf6b61cbb9e47ed3d2a2855c3ed54541
---
M lqt.js
1 file changed, 7 insertions(+), 5 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/LiquidThreads 
refs/changes/34/51834/1

diff --git a/lqt.js b/lqt.js
index dfa164a..77955ac 100644
--- a/lqt.js
+++ b/lqt.js
@@ -790,15 +790,17 @@
                // Check if we're watching or unwatching.
                var action = '';
                if ( button.hasClass( 'lqt-command-watch' ) ) {
-                       button.removeClass( 'lqt-command-watch' );
+                       button.removeClass( 'lqt-command-watch' ).addClass( 
'lqt-command-unwatch' );
+                       button.find( 'a' ).attr( 'href', button.find( 'a' 
).attr( 'href' ).replace( 'watch', 'unwatch' ) ).html( mw.msg( 'unwatch' ) );
                        action = 'watch';
                } else if ( button.hasClass( 'lqt-command-unwatch' ) ) {
-                       button.removeClass( 'lqt-command-unwatch' );
+                       button.removeClass( 'lqt-command-unwatch' ).addClass( 
'lqt-command-watch' );
                        action = 'unwatch';
+                       button.find( 'a' ).attr( 'href', button.find( 'a' 
).attr( 'href' ).replace( 'unwatch', 'watch' ) ).html( mw.msg( 'watch' ) );
                }
 
                // Replace the watch link with a spinner
-               button.empty().addClass( 'mw-small-spinner' );
+               button.hide().after( $( '<li/>' ).addClass( 'mw-small-spinner' 
) );
 
                // Do the AJAX call.
                var apiParams = {
@@ -814,8 +816,8 @@
 
                $.post( mw.util.wikiScript( 'api' ), apiParams,
                        function () {
-                               threadLevelCommands.load( 
window.location.href+' '+
-                                               
'#'+threadLevelCommands.attr('id')+' > *' );
+                               button.show();
+                               threadLevelCommands.find( '.mw-small-spinner' 
).remove();
                        }, 'json' );
 
                e.preventDefault();

-- 
To view, visit https://gerrit.wikimedia.org/r/51834
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I78788348bf6b61cbb9e47ed3d2a2855c3ed54541
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/LiquidThreads
Gerrit-Branch: master
Gerrit-Owner: Nischayn22 <nischay...@gmail.com>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to