Bastien Sevajol преди 11 години
родител
ревизия
efc0dc89d5

+ 35 - 0
src/Muzich/CoreBundle/Resources/public/js/muzich.js Целия файл

@@ -636,6 +636,8 @@ $(document).ready(function(){
636 636
           if (response.count)
637 637
           {
638 638
             $('ul.elements').append(response.html);
639
+            refresh_social_buttons();
640
+            
639 641
             $('img.elements_more_loader').hide();
640 642
             recolorize_element_list();
641 643
             
@@ -686,6 +688,7 @@ $(document).ready(function(){
686 688
       );
687 689
     
688 690
     $('ul.elements').html(response.html);
691
+    refresh_social_buttons();
689 692
     
690 693
     if (response.count)
691 694
      {
@@ -1283,6 +1286,7 @@ $(document).ready(function(){
1283 1286
     {
1284 1287
       $('form[name="add"]').find('ul.error_list').remove();
1285 1288
       $('ul.elements').prepend(response.html);
1289
+      refresh_social_buttons();
1286 1290
       $('form[name="add"] input[type="text"]').val('');
1287 1291
       
1288 1292
       if ($('form[name="search"]').length)
@@ -1651,6 +1655,7 @@ $(document).ready(function(){
1651 1655
       );
1652 1656
       
1653 1657
       $('ul.elements').html(response.html);
1658
+      refresh_social_buttons();
1654 1659
       
1655 1660
       if (response.count)
1656 1661
        {
@@ -1857,6 +1862,7 @@ $(document).ready(function(){
1857 1862
           }
1858 1863
 
1859 1864
           $('ul.elements').prepend(response.html);
1865
+          refresh_social_buttons();
1860 1866
           recolorize_element_list();
1861 1867
         }
1862 1868
 
@@ -3384,8 +3390,37 @@ $(document).ready(function(){
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 3424
 function open_ajax_popin(url, callback, data)
3390 3425
 {
3391 3426
   if (!popin_opened)

+ 10 - 0
src/Muzich/CoreBundle/Resources/views/Layout/head_js.html.twig Целия файл

@@ -2,6 +2,16 @@
2 2
   {% set userecho = true %}
3 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 15
 {% javascripts
6 16
   'js/jquery-1.8.2.prod.js'
7 17
   'js/jquery-ui-1.10.1.custom.min.js'

+ 1 - 12
src/Muzich/CoreBundle/Resources/views/helper/facebookButton.html.twig Целия файл

@@ -3,16 +3,5 @@
3 3
 {% endif %}
4 4
 
5 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 7
 {% endspaceless %}

+ 1 - 12
src/Muzich/CoreBundle/Resources/views/helper/googlePlusButton.html.twig Целия файл

@@ -3,16 +3,5 @@
3 3
 {% endif %}
4 4
 
5 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 7
 {% endspaceless %}

+ 6 - 7
src/Muzich/CoreBundle/Resources/views/helper/twitterButton.html.twig Целия файл

@@ -5,18 +5,17 @@
5 5
 {% spaceless %}
6 6
  <a href="https://twitter.com/share" class="twitter-share-button"
7 7
 
8
-   data-text="{{message}}" 
8
+   data-text="{{ message }}" 
9 9
    data-url="{{url}}"
10
-   data-lang="{{locale}}"
10
+   data-lang="{{ locale }}"
11 11
 
12 12
    {% if via is not sameas(false) %}
13
-     data-via="{{via}}"
13
+     data-via="{{ via }}"
14 14
    {% endif %}
15 15
 
16 16
    {% if tag is not sameas(false) %}
17
-     data-hashtags="{{tag}}"
17
+     data-hashtags="{{ tag }}"
18 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 21
 {% endspaceless %}