r55250 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r55249‎ | r55250 | r55251 >
Date:18:04, 18 August 2009
Author:werdna
Status:deferred (Comments)
Tags:
Comment:
LQT JS updates:
* Consider a second click on the reply button as a "cancel" operation. (TODO warning message)
* Slowly slide down to the textbox when JS-loading the reply form
Modified paths:
  • /trunk/extensions/LiquidThreads/lqt.js (modified) (history)

Diff [purge]

Index: trunk/extensions/LiquidThreads/lqt.js
@@ -1,4 +1,6 @@
22 var liquidThreads = {
 3+ currentReplyThread : null,
 4+
35 'handleReplyLink' : function(e) {
46 if (e.preventDefault)
57 e.preventDefault();
@@ -12,11 +14,18 @@
1315 var prefixLength = "lqt_thread_id_".length;
1416 var container = $j(target).closest('.lqt_thread')[0];
1517 var thread_id = container.id.substring( prefixLength );
 18+
 19+ if (thread_id == liquidThreads.currentReplyThread) {
 20+ liquidThreads.cancelEdit({});
 21+ return;
 22+ }
 23+
1624 var query = '&lqt_method=reply&lqt_operand='+thread_id;
1725
1826 var replyDiv = $j(container).find('.lqt-reply-form')[0];
1927
2028 liquidThreads.injectEditForm( query, replyDiv, e.preload );
 29+ liquidThreads.currentReplyThread = thread_id;
2130
2231 return false;
2332 },
@@ -29,6 +38,7 @@
3039 var container = $j('.lqt-new-thread' );
3140
3241 liquidThreads.injectEditForm( query, container );
 42+ liquidThreads.currentReplyThread = 0;
3343
3444 return false;
3545 },
@@ -175,8 +185,9 @@
176186 e.preventDefault();
177187 }
178188
179 - $j('.lqt-reply-form,.lqt-new-thread').not(e).slideUp('slow');
180 - $j('.lqt-reply-form,.lqt-new-thread').not(e).empty();
 189+ $j('.lqt-edit-form').not(e).slideUp('slow', function() { $j(this).empty(); } );
 190+
 191+ liquidThreads.currentReplyThread = null;
181192 }
182193 }
183194

Comments

#Comment by Simetrical (talk | contribs)   22:05, 20 August 2009

Why is a warning message needed? Just be sure to make a third click un-cancel.

#Comment by Werdna (talk | contribs)   22:06, 20 August 2009

Because it doesn't remember what you typed.

#Comment by Simetrical (talk | contribs)   22:28, 20 August 2009

So why don't you make it remember what you typed? Allowing undo is much better UI than a warning message for things like this.

Status & tagging log