Browse Source

fix social buttons for autoplay

Bastien Sevajol 11 years ago
parent
commit
04a76a88f1

+ 1 - 0
src/Muzich/CoreBundle/Resources/public/js/autoplay.js View File

81
       if (response.status == 'success')
81
       if (response.status == 'success')
82
       {
82
       {
83
         $('li#autoplay_element_container').html(response.data);
83
         $('li#autoplay_element_container').html(response.data);
84
+        refresh_social_buttons(true);
84
       }
85
       }
85
       else
86
       else
86
       {
87
       {

+ 11 - 6
src/Muzich/CoreBundle/Resources/public/js/muzich.js View File

3400
 });
3400
 });
3401
 
3401
 
3402
 var facebook_like_rendereds = new Array();
3402
 var facebook_like_rendereds = new Array();
3403
-function refresh_social_buttons()
3403
+var facebook_like_rendereds_autoplay = new Array();
3404
+
3405
+function refresh_social_buttons(autoplay)
3404
 {
3406
 {
3405
-  proceed_facebook_like_buttons();
3407
+  proceed_facebook_like_buttons(autoplay);
3406
   gapi.plusone.go();
3408
   gapi.plusone.go();
3407
   twttr.widgets.load();
3409
   twttr.widgets.load();
3408
 }
3410
 }
3409
 
3411
 
3410
-function proceed_facebook_like_buttons()
3412
+function proceed_facebook_like_buttons(autoplay)
3411
 {
3413
 {
3412
-  $('ul.elements li.element').each(function(){
3414
+  $('ul.elements li.element, ul#autoplay_element li.element').each(function(){
3413
     
3415
     
3414
-    if ($.inArray($(this).get(0), facebook_like_rendereds) === -1)
3416
+    if ( ($.inArray($(this).get(0), facebook_like_rendereds) === -1 && !autoplay) || ($.inArray($(this).get(0), facebook_like_rendereds_autoplay) === -1 && autoplay))
3415
     {
3417
     {
3416
       FB.XFBML.parse($(this).get(0));
3418
       FB.XFBML.parse($(this).get(0));
3417
     }
3419
     }
3418
     
3420
     
3419
-    facebook_like_rendereds.push($(this).get(0));
3421
+    if (!autoplay)
3422
+      facebook_like_rendereds.push($(this).get(0));
3423
+    if (autoplay)
3424
+      facebook_like_rendereds_autoplay.push($(this).get(0));
3420
   });
3425
   });
3421
   
3426
   
3422
 }
3427
 }