Parcourir la source

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

bastien il y a 13 ans
Parent
révision
3a0ea5f40b
1 fichiers modifiés avec 12 ajouts et 6 suppressions
  1. 12 6
      web/bundles/muzichcore/js/muzich.js

+ 12 - 6
web/bundles/muzichcore/js/muzich.js Voir le fichier

385
     
385
     
386
     // Pour ne pas attendre la fin du chargement ajax:
386
     // Pour ne pas attendre la fin du chargement ajax:
387
     img = link.find('img');
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
     $.getJSON($(this).attr('href'), function(response) {
402
     $.getJSON($(this).attr('href'), function(response) {
398
       if (response.status == 'mustbeconnected')
403
       if (response.status == 'mustbeconnected')
399
       {
404
       {
404
       link.attr('href', response.link_new_url);
409
       link.attr('href', response.link_new_url);
405
       img.attr('src', response.img_new_src);
410
       img.attr('src', response.img_new_src);
406
       img.attr('title', response.img_new_title);
411
       img.attr('title', response.img_new_title);
412
+      link.removeClass('loading');
407
     });
413
     });
408
     return false;
414
     return false;
409
   });
415
   });