浏览代码

Re-order services

Amauri CHAMPEAUX 10 年之前
父节点
当前提交
506b3e0446
共有 1 个文件被更改,包括 99 次插入98 次删除
  1. 99 98
      tarteaucitron.services.js

+ 99 - 98
tarteaucitron.services.js

@@ -1,112 +1,70 @@
 /*global tarteaucitron, ga, Shareaholic, stLight*/
 
-// disqus
-tarteaucitron.services.disqus = {
-    "key": "disqus",
-    "type": "social",
-    "name": "Disqus",
-    "uri": "https://help.disqus.com/customer/portal/articles/466259-privacy-policy",
-    "needConsent": true,
-    "js": function () {
-        "use strict";
-        if (tarteaucitron.user.disqusShortname === undefined) {
-            return;
-        }
-        tarteaucitron.addScript('//' + tarteaucitron.user.disqusShortname + '.disqus.com/embed.js');
-        tarteaucitron.addScript('//' + tarteaucitron.user.disqusShortname + '.disqus.com/count.js');
-    },
-    "fallback": function () {
-        "use strict";
-        var id = 'disqus';
-        
-        if (document.getElementById('disqus_thread')) {
-            document.getElementById('disqus_thread').innerHTML = tarteaucitron.engage(id);
-        }
-    }
-};
-
-// shareathis
-tarteaucitron.services.sharethis = {
-    "key": "sharethis",
+// addthis
+tarteaucitron.services.addthis = {
+    "key": "addthis",
     "type": "social",
-    "name": "ShareThis",
-    "uri": "http://www.sharethis.com/legal/privacy/",
+    "name": "AddThis",
+    "uri": "http://www.addthis.com/privacy/privacy-policy#publisher-visitors",
     "needConsent": true,
     "js": function () {
         "use strict";
-        if (tarteaucitron.user.sharethisPublisher === undefined) {
+        if (tarteaucitron.user.addthisPubId === undefined) {
             return;
         }
-        var switchTo5x = true,
-            uri = ('https:' === document.location.protocol ? 'https://ws' : 'http://w') + '.sharethis.com/button/buttons.js';
-        
-        tarteaucitron.fallback(['tacSharethis'], '');
-        tarteaucitron.addScript(uri, '', function () {
-            stLight.options({publisher: tarteaucitron.user.sharethisPublisher, doNotHash: false, doNotCopy: false, hashAddressBar: false});
-        });
+        tarteaucitron.fallback(['addthis_sharing_toolbox'], '');
+        tarteaucitron.addScript('//s7.addthis.com/js/300/addthis_widget.js#pubid=' + tarteaucitron.user.addthisPubId);
     },
     "fallback": function () {
         "use strict";
-        var cookies = ['__unam'],
-            id = 'sharethis';
+        var cookies = ['__atuvc'],
+            id = 'addthis';
         
         tarteaucitron.cookie.purge(cookies);
-        tarteaucitron.fallback(['tacSharethis'], tarteaucitron.engage(id));
+        tarteaucitron.fallback(['addthis_sharing_toolbox'], tarteaucitron.engage(id));
     }
 };
 
-// shareaholic
-tarteaucitron.services.shareaholic = {
-    "key": "shareaholic",
+// disqus
+tarteaucitron.services.disqus = {
+    "key": "disqus",
     "type": "social",
-    "name": "Shareaholic",
-    "uri": "https://shareaholic.com/privacy/choices",
+    "name": "Disqus",
+    "uri": "https://help.disqus.com/customer/portal/articles/466259-privacy-policy",
     "needConsent": true,
     "js": function () {
         "use strict";
-        if (tarteaucitron.user.shareaholicSiteId === undefined) {
+        if (tarteaucitron.user.disqusShortname === undefined) {
             return;
         }
-        
-        tarteaucitron.fallback(['shareaholic-canvas'], '');
-        tarteaucitron.addScript('//dsms0mj1bbhn4.cloudfront.net/assets/pub/shareaholic.js', '', function () {
-            try {
-                Shareaholic.init(tarteaucitron.user.shareaholicSiteId);
-            } catch (e) {}
-        });
+        tarteaucitron.addScript('//' + tarteaucitron.user.disqusShortname + '.disqus.com/embed.js');
+        tarteaucitron.addScript('//' + tarteaucitron.user.disqusShortname + '.disqus.com/count.js');
     },
     "fallback": function () {
         "use strict";
-        var cookies = ['__utma', '__utmb', '__utmc', '__utmz'],
-            id = 'shareaholic';
+        var id = 'disqus';
         
-        tarteaucitron.cookie.purge(cookies);
-        tarteaucitron.fallback(['shareaholic-canvas'], tarteaucitron.engage(id));
+        if (document.getElementById('disqus_thread')) {
+            document.getElementById('disqus_thread').innerHTML = tarteaucitron.engage(id);
+        }
     }
 };
 
-// addthis
-tarteaucitron.services.addthis = {
-    "key": "addthis",
+// facebook
+tarteaucitron.services.facebook = {
+    "key": "facebook",
     "type": "social",
-    "name": "AddThis",
-    "uri": "http://www.addthis.com/privacy/privacy-policy#publisher-visitors",
+    "name": "Facebook",
+    "uri": "https://www.facebook.com/help/cookies/",
     "needConsent": true,
     "js": function () {
         "use strict";
-        if (tarteaucitron.user.addthisPubId === undefined) {
-            return;
-        }
-        tarteaucitron.fallback(['addthis_sharing_toolbox'], '');
-        tarteaucitron.addScript('//s7.addthis.com/js/300/addthis_widget.js#pubid=' + tarteaucitron.user.addthisPubId);
+        tarteaucitron.fallback(['fb-like'], '');
+        tarteaucitron.addScript('//connect.facebook.net/fr_FR/sdk.js#xfbml=1&version=v2.0', 'facebook-jssdk');
     },
     "fallback": function () {
         "use strict";
-        var cookies = ['__atuvc'],
-            id = 'addthis';
-        
-        tarteaucitron.cookie.purge(cookies);
-        tarteaucitron.fallback(['addthis_sharing_toolbox'], tarteaucitron.engage(id));
+        tarteaucitron.fallback(['fb-post', 'fb-follow', 'fb-comments', 'fb-activity', 'fb-like-box', 'fb-send', 'fb-share-button', 'fb-like'], '<a href="https://www.facebook.com/sharer/sharer.php?u=' + encodeURIComponent(document.location) + '" target="_blank" class="tac_share tac_share_facebook">Facebook</a>');
     }
 };
 
@@ -127,21 +85,20 @@ tarteaucitron.services.ferank = {
     }
 };
 
-// facebook
-tarteaucitron.services.facebook = {
-    "key": "facebook",
+// google+
+tarteaucitron.services.gplus = {
+    "key": "gplus",
     "type": "social",
-    "name": "Facebook",
-    "uri": "https://www.facebook.com/help/cookies/",
+    "name": "Google+",
+    "uri": "http://www.google.fr/intl/policies/privacy/",
     "needConsent": true,
     "js": function () {
         "use strict";
-        tarteaucitron.fallback(['fb-like'], '');
-        tarteaucitron.addScript('//connect.facebook.net/fr_FR/sdk.js#xfbml=1&version=v2.0', 'facebook-jssdk');
+        tarteaucitron.addScript('https://apis.google.com/js/platform.js');
     },
     "fallback": function () {
         "use strict";
-        tarteaucitron.fallback(['fb-post', 'fb-follow', 'fb-comments', 'fb-activity', 'fb-like-box', 'fb-send', 'fb-share-button', 'fb-like'], '<a href="https://www.facebook.com/sharer/sharer.php?u=' + encodeURIComponent(document.location) + '" target="_blank" class="tac_share tac_share_facebook">Facebook</a>');
+        tarteaucitron.fallback(['g-page', 'g-plus', 'g-plusone'], '<a href="https://plus.google.com/share?url=' + encodeURIComponent(document.location) + '" target="_blank" class="tac_share tac_share_googlep">Google+</a>');
     }
 };
 
@@ -195,23 +152,6 @@ tarteaucitron.services.analytics = {
     }
 };
 
-// google+
-tarteaucitron.services.gplus = {
-    "key": "gplus",
-    "type": "social",
-    "name": "Google+",
-    "uri": "http://www.google.fr/intl/policies/privacy/",
-    "needConsent": true,
-    "js": function () {
-        "use strict";
-        tarteaucitron.addScript('https://apis.google.com/js/platform.js');
-    },
-    "fallback": function () {
-        "use strict";
-        tarteaucitron.fallback(['g-page', 'g-plus', 'g-plusone'], '<a href="https://plus.google.com/share?url=' + encodeURIComponent(document.location) + '" target="_blank" class="tac_share tac_share_googlep">Google+</a>');
-    }
-};
-
 // linkedin
 tarteaucitron.services.linkedin = {
     "key": "linkedin",
@@ -243,6 +183,67 @@ tarteaucitron.services.pinterest = {
     }
 };
 
+
+// shareaholic
+tarteaucitron.services.shareaholic = {
+    "key": "shareaholic",
+    "type": "social",
+    "name": "Shareaholic",
+    "uri": "https://shareaholic.com/privacy/choices",
+    "needConsent": true,
+    "js": function () {
+        "use strict";
+        if (tarteaucitron.user.shareaholicSiteId === undefined) {
+            return;
+        }
+        
+        tarteaucitron.fallback(['shareaholic-canvas'], '');
+        tarteaucitron.addScript('//dsms0mj1bbhn4.cloudfront.net/assets/pub/shareaholic.js', '', function () {
+            try {
+                Shareaholic.init(tarteaucitron.user.shareaholicSiteId);
+            } catch (e) {}
+        });
+    },
+    "fallback": function () {
+        "use strict";
+        var cookies = ['__utma', '__utmb', '__utmc', '__utmz'],
+            id = 'shareaholic';
+        
+        tarteaucitron.cookie.purge(cookies);
+        tarteaucitron.fallback(['shareaholic-canvas'], tarteaucitron.engage(id));
+    }
+};
+
+// sharethis
+tarteaucitron.services.sharethis = {
+    "key": "sharethis",
+    "type": "social",
+    "name": "ShareThis",
+    "uri": "http://www.sharethis.com/legal/privacy/",
+    "needConsent": true,
+    "js": function () {
+        "use strict";
+        if (tarteaucitron.user.sharethisPublisher === undefined) {
+            return;
+        }
+        var switchTo5x = true,
+            uri = ('https:' === document.location.protocol ? 'https://ws' : 'http://w') + '.sharethis.com/button/buttons.js';
+        
+        tarteaucitron.fallback(['tacSharethis'], '');
+        tarteaucitron.addScript(uri, '', function () {
+            stLight.options({publisher: tarteaucitron.user.sharethisPublisher, doNotHash: false, doNotCopy: false, hashAddressBar: false});
+        });
+    },
+    "fallback": function () {
+        "use strict";
+        var cookies = ['__unam'],
+            id = 'sharethis';
+        
+        tarteaucitron.cookie.purge(cookies);
+        tarteaucitron.fallback(['tacSharethis'], tarteaucitron.engage(id));
+    }
+};
+
 // twitter
 tarteaucitron.services.twitter = {
     "key": "twitter",