fu: Close-up of Fu, bringing a scoop of water to her mouth (Default)
fu ([personal profile] fu) wrote in [site community profile] changelog2012-03-21 03:27 am

[dw-free] Send errors on failed comment expansion

[commit: http://hg.dwscoalition.org/dw-free/rev/0715ec261628]

http://bugs.dwscoalition.org/show_bug.cgi?id=3401

Show expansion errors as an overlay near the links, rather than an alert
box.

Patch by [personal profile] fu.

Files modified:
  • htdocs/js/jquery.threadexpander.js
--------------------------------------------------------------------------------
diff -r 2add8a22f90b -r 0715ec261628 htdocs/js/jquery.threadexpander.js
--- a/htdocs/js/jquery.threadexpander.js	Wed Mar 21 11:23:40 2012 +0800
+++ b/htdocs/js/jquery.threadexpander.js	Wed Mar 21 11:28:48 2012 +0800
@@ -45,8 +45,8 @@
   }
 
   // shows an error.  just uses alert() for now.
-  function showExpanderError(error) {
-    alert(error);
+  function showExpanderError(element,error) {
+    $(element).ajaxtip({namespace:"threadexpander", content: " ", persist: true }).ajaxtip("error", error);
   }
 
   // ajax expands the comments for the given talkid
@@ -73,7 +73,9 @@
             var updateCount = element.doJqExpand(LJ, data, talkid, isS1, unhide);
             // if we didn't update any comments, something must have gone wrong
             if (updateCount == 0) {
-              showExpanderError($.threadexpander.config.text.error_nomatches);
+              showExpanderError(element,$.threadexpander.config.text.error_nomatches);
+              img.remove();
+              element.removeClass("disabled").fadeTo("fast", 1.0);
             } else if (unhide) {
               element.unhideComments(LJ, talkid, isS1);
             }
@@ -93,7 +95,7 @@
             img.remove();
             element.removeClass("disabled");
             element.fadeTo("fast", 1.0);
-            showExpanderError($.threadexpander.config.text.error);
+            showExpanderError(element,$.threadexpander.config.text.error);
           }
       } );
   };
--------------------------------------------------------------------------------