Bastien Sevajol 10 лет назад
Родитель
Сommit
efc0dc89d5

+ 35 - 0
src/Muzich/CoreBundle/Resources/public/js/muzich.js Просмотреть файл

636
           if (response.count)
636
           if (response.count)
637
           {
637
           {
638
             $('ul.elements').append(response.html);
638
             $('ul.elements').append(response.html);
639
+            refresh_social_buttons();
640
+            
639
             $('img.elements_more_loader').hide();
641
             $('img.elements_more_loader').hide();
640
             recolorize_element_list();
642
             recolorize_element_list();
641
             
643
             
686
       );
688
       );
687
     
689
     
688
     $('ul.elements').html(response.html);
690
     $('ul.elements').html(response.html);
691
+    refresh_social_buttons();
689
     
692
     
690
     if (response.count)
693
     if (response.count)
691
      {
694
      {
1283
     {
1286
     {
1284
       $('form[name="add"]').find('ul.error_list').remove();
1287
       $('form[name="add"]').find('ul.error_list').remove();
1285
       $('ul.elements').prepend(response.html);
1288
       $('ul.elements').prepend(response.html);
1289
+      refresh_social_buttons();
1286
       $('form[name="add"] input[type="text"]').val('');
1290
       $('form[name="add"] input[type="text"]').val('');
1287
       
1291
       
1288
       if ($('form[name="search"]').length)
1292
       if ($('form[name="search"]').length)
1651
       );
1655
       );
1652
       
1656
       
1653
       $('ul.elements').html(response.html);
1657
       $('ul.elements').html(response.html);
1658
+      refresh_social_buttons();
1654
       
1659
       
1655
       if (response.count)
1660
       if (response.count)
1656
        {
1661
        {
1857
           }
1862
           }
1858
 
1863
 
1859
           $('ul.elements').prepend(response.html);
1864
           $('ul.elements').prepend(response.html);
1865
+          refresh_social_buttons();
1860
           recolorize_element_list();
1866
           recolorize_element_list();
1861
         }
1867
         }
1862
 
1868
 
3384
   });
3390
   });
3385
   
3391
   
3386
   
3392
   
3393
+  /*
3394
+   * SOCIAL BUTTONS
3395
+   * 
3396
+   */
3397
+  
3398
+  refresh_social_buttons();
3399
+  
3387
 });
3400
 });
3388
 
3401
 
3402
+var facebook_like_rendereds = new Array();
3403
+function refresh_social_buttons()
3404
+{
3405
+  proceed_facebook_like_buttons();
3406
+  gapi.plusone.go();
3407
+  twttr.widgets.load();
3408
+}
3409
+
3410
+function proceed_facebook_like_buttons()
3411
+{
3412
+  $('ul.elements li.element').each(function(){
3413
+    
3414
+    if ($.inArray($(this).get(0), facebook_like_rendereds) === -1)
3415
+    {
3416
+      FB.XFBML.parse($(this).get(0));
3417
+    }
3418
+    
3419
+    facebook_like_rendereds.push($(this).get(0));
3420
+  });
3421
+  
3422
+}
3423
+
3389
 function open_ajax_popin(url, callback, data)
3424
 function open_ajax_popin(url, callback, data)
3390
 {
3425
 {
3391
   if (!popin_opened)
3426
   if (!popin_opened)

+ 10 - 0
src/Muzich/CoreBundle/Resources/views/Layout/head_js.html.twig Просмотреть файл

2
   {% set userecho = true %}
2
   {% set userecho = true %}
3
 {% endif %}
3
 {% endif %}
4
 
4
 
5
+
6
+<script type="text/javascript" src="//apis.google.com/js/plusone.js">
7
+  {parsetags: 'explicit'}
8
+</script>
9
+
10
+<script type="text/javascript" src="//connect.facebook.net/fr_FR/all.js#xfbml=1"></script>
11
+
12
+<script type="text/javascript" src="//platform.twitter.com/widgets.js"></script>
13
+
14
+
5
 {% javascripts
15
 {% javascripts
6
   'js/jquery-1.8.2.prod.js'
16
   'js/jquery-1.8.2.prod.js'
7
   'js/jquery-ui-1.10.1.custom.min.js'
17
   'js/jquery-ui-1.10.1.custom.min.js'

+ 1 - 12
src/Muzich/CoreBundle/Resources/views/helper/facebookButton.html.twig Просмотреть файл

3
 {% endif %}
3
 {% endif %}
4
 
4
 
5
 {% spaceless %}
5
 {% spaceless %}
6
- {# initialize facebook SDK #}
7
- <div id="fb-root"></div>
8
- <script>$(document).ready(function() {  (function(d, s, id) {
9
-   var js, fjs = d.getElementsByTagName(s)[0];
10
-   if (d.getElementById(id)) return;
11
-   js = d.createElement(s); js.id = id;
12
-   js.src = "//connect.facebook.net/{{locale}}/all.js#xfbml=1";
13
-   fjs.parentNode.insertBefore(js, fjs);
14
- }(document, 'script', 'facebook-jssdk'));  });</script>
15
-
16
- <div class="fb-like" data-href="{{url}}" data-send="{{send}}" data-layout="{{layout}}" data-width="{{width}}" data-show-faces="{{showFaces}}"></div>
17
-
6
+   <div class="fb-like" data-href="{{ url }}" data-send="{{ send }}" data-layout="{{ layout }}" data-width="{{ width }}" data-show-faces="{{ showFaces }}"></div>
18
 {% endspaceless %}
7
 {% endspaceless %}

+ 1 - 12
src/Muzich/CoreBundle/Resources/views/helper/googlePlusButton.html.twig Просмотреть файл

3
 {% endif %}
3
 {% endif %}
4
 
4
 
5
 {% spaceless %}
5
 {% spaceless %}
6
- <div class="g-plusone" data-size="{{size}}" data-annotation="{{annotation}}" data-width="{{width}}" data-href="{{url}}"></div>
7
-
8
- <script type="text/javascript">
9
-   window.___gcfg = {lang: '{{locale}}'};
10
-
11
-   (function() {
12
-     var po = document.createElement('script'); po.type = 'text/javascript'; po.async = true;
13
-     po.src = 'https://apis.google.com/js/plusone.js';
14
-     var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(po, s);
15
-   })();
16
- </script>
17
-
6
+  <g:plusone href="{{ url }}" size="medium"></g:plusone>
18
 {% endspaceless %}
7
 {% endspaceless %}

+ 6 - 7
src/Muzich/CoreBundle/Resources/views/helper/twitterButton.html.twig Просмотреть файл

5
 {% spaceless %}
5
 {% spaceless %}
6
  <a href="https://twitter.com/share" class="twitter-share-button"
6
  <a href="https://twitter.com/share" class="twitter-share-button"
7
 
7
 
8
-   data-text="{{message}}" 
8
+   data-text="{{ message }}" 
9
    data-url="{{url}}"
9
    data-url="{{url}}"
10
-   data-lang="{{locale}}"
10
+   data-lang="{{ locale }}"
11
 
11
 
12
    {% if via is not sameas(false) %}
12
    {% if via is not sameas(false) %}
13
-     data-via="{{via}}"
13
+     data-via="{{ via }}"
14
    {% endif %}
14
    {% endif %}
15
 
15
 
16
    {% if tag is not sameas(false) %}
16
    {% if tag is not sameas(false) %}
17
-     data-hashtags="{{tag}}"
17
+     data-hashtags="{{ tag }}"
18
    {% endif %}
18
    {% endif %}
19
- >{{text}}</a>
20
-
21
- <script>!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0];if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src="//platform.twitter.com/widgets.js";fjs.parentNode.insertBefore(js,fjs);}}(document,"script","twitter-wjs");</script>
19
+     
20
+ >{{ text }}</a>
22
 {% endspaceless %}
21
 {% endspaceless %}