瀏覽代碼

Clic sur étoile favoris: Eviter le double clic (au niveau de l'image).

bastien 13 年之前
父節點
當前提交
3a0ea5f40b
共有 1 個文件被更改,包括 12 次插入6 次删除
  1. 12 6
      web/bundles/muzichcore/js/muzich.js

+ 12 - 6
web/bundles/muzichcore/js/muzich.js 查看文件

@@ -385,15 +385,20 @@ $(document).ready(function(){
385 385
     
386 386
     // Pour ne pas attendre la fin du chargement ajax:
387 387
     img = link.find('img');
388
-    if (img.attr('src') == '/bundles/muzichcore/img/favorite_bw.png')
388
+    if (!link.hasClass('loading'))
389 389
     {
390
-      img.attr('src', '/bundles/muzichcore/img/favorite.png');
391
-    }
392
-    else
393
-    {
394
-      img.attr('src', '/bundles/muzichcore/img/favorite_bw.png');
390
+      if (img.attr('src') == '/bundles/muzichcore/img/favorite_bw.png')
391
+      {
392
+        img.attr('src', '/bundles/muzichcore/img/favorite.png');
393
+      }
394
+      else
395
+      {
396
+        img.attr('src', '/bundles/muzichcore/img/favorite_bw.png');
397
+      }
395 398
     }
396 399
     
400
+    link.addClass('loading');
401
+    
397 402
     $.getJSON($(this).attr('href'), function(response) {
398 403
       if (response.status == 'mustbeconnected')
399 404
       {
@@ -404,6 +409,7 @@ $(document).ready(function(){
404 409
       link.attr('href', response.link_new_url);
405 410
       img.attr('src', response.img_new_src);
406 411
       img.attr('title', response.img_new_title);
412
+      link.removeClass('loading');
407 413
     });
408 414
     return false;
409 415
   });