tarteaucitron.services.js 9.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283
  1. /*global tarteaucitron, ga, Shareaholic, stLight*/
  2. // disqus
  3. tarteaucitron.services.disqus = {
  4. "key": "disqus",
  5. "type": "social",
  6. "name": "Disqus",
  7. "uri": "https://help.disqus.com/customer/portal/articles/466259-privacy-policy",
  8. "needConsent": true,
  9. "js": function () {
  10. "use strict";
  11. if (tarteaucitron.user.disqusShortname === undefined) {
  12. return;
  13. }
  14. tarteaucitron.addScript('//' + tarteaucitron.user.disqusShortname + '.disqus.com/embed.js');
  15. tarteaucitron.addScript('//' + tarteaucitron.user.disqusShortname + '.disqus.com/count.js');
  16. },
  17. "fallback": function () {
  18. "use strict";
  19. var id = 'disqus',
  20. r = Math.floor(Math.random() * 100000);
  21. document.getElementById('disqus_thread').innerHTML = tarteaucitron.engage(id);
  22. document.getElementById('tacEngage' + id + r).onclick = function () {
  23. tarteaucitron.userInterface.respond(document.getElementById(id + 'Allowed'), true);
  24. };
  25. }
  26. };
  27. // shareathis
  28. tarteaucitron.services.sharethis = {
  29. "key": "sharethis",
  30. "type": "social",
  31. "name": "ShareThis",
  32. "uri": "http://www.sharethis.com/legal/privacy/",
  33. "needConsent": true,
  34. "js": function () {
  35. "use strict";
  36. if (tarteaucitron.user.sharethisPublisher === undefined) {
  37. return;
  38. }
  39. var switchTo5x = true,
  40. uri = ('https:' === document.location.protocol ? 'https://ws' : 'http://w') + '.sharethis.com/button/buttons.js';
  41. tarteaucitron.fallback(['tacSharethis'], '');
  42. tarteaucitron.addScript(uri, '', function () {
  43. stLight.options({publisher: tarteaucitron.user.sharethisPublisher, doNotHash: false, doNotCopy: false, hashAddressBar: false});
  44. });
  45. },
  46. "fallback": function () {
  47. "use strict";
  48. var cookies = ['__unam'],
  49. id = 'sharethis',
  50. r = Math.floor(Math.random() * 100000);
  51. tarteaucitron.cookie.purge(cookies);
  52. tarteaucitron.fallback(['tacSharethis'], tarteaucitron.engage(id));
  53. document.getElementById('tacEngage' + id + r).onclick = function () {
  54. tarteaucitron.userInterface.respond(document.getElementById(id + 'Allowed'), true);
  55. };
  56. }
  57. };
  58. // shareaholic
  59. tarteaucitron.services.shareaholic = {
  60. "key": "shareaholic",
  61. "type": "social",
  62. "name": "Shareaholic",
  63. "uri": "https://shareaholic.com/privacy/choices",
  64. "needConsent": true,
  65. "js": function () {
  66. "use strict";
  67. if (tarteaucitron.user.shareaholicSiteId === undefined) {
  68. return;
  69. }
  70. tarteaucitron.fallback(['shareaholic-canvas'], '');
  71. tarteaucitron.addScript('//dsms0mj1bbhn4.cloudfront.net/assets/pub/shareaholic.js', '', function () {
  72. try {
  73. Shareaholic.init(tarteaucitron.user.shareaholicSiteId);
  74. } catch (e) {}
  75. });
  76. },
  77. "fallback": function () {
  78. "use strict";
  79. var cookies = ['__utma', '__utmb', '__utmc', '__utmz'],
  80. id = 'shareaholic',
  81. r = Math.floor(Math.random() * 100000);
  82. tarteaucitron.cookie.purge(cookies);
  83. tarteaucitron.fallback(['shareaholic-canvas'], tarteaucitron.engage(id));
  84. document.getElementById('tacEngage' + id + r).onclick = function () {
  85. tarteaucitron.userInterface.respond(document.getElementById(id + 'Allowed'), true);
  86. };
  87. }
  88. };
  89. // addthis
  90. tarteaucitron.services.addthis = {
  91. "key": "addthis",
  92. "type": "social",
  93. "name": "AddThis",
  94. "uri": "http://www.addthis.com/privacy/privacy-policy#publisher-visitors",
  95. "needConsent": true,
  96. "js": function () {
  97. "use strict";
  98. if (tarteaucitron.user.addthisPubId === undefined) {
  99. return;
  100. }
  101. tarteaucitron.fallback(['addthis_sharing_toolbox'], '');
  102. tarteaucitron.addScript('//s7.addthis.com/js/300/addthis_widget.js#pubid=' + tarteaucitron.user.addthisPubId);
  103. },
  104. "fallback": function () {
  105. "use strict";
  106. var cookies = ['__atuvc'],
  107. id = 'addthis',
  108. r = Math.floor(Math.random() * 100000);
  109. tarteaucitron.cookie.purge(cookies);
  110. tarteaucitron.fallback(['addthis_sharing_toolbox'], tarteaucitron.engage(id));
  111. document.getElementById('tacEngage' + id + r).onclick = function () {
  112. tarteaucitron.userInterface.respond(document.getElementById(id + 'Allowed'), true);
  113. };
  114. }
  115. };
  116. // ferank
  117. tarteaucitron.services.ferank = {
  118. "key": "ferank",
  119. "type": "analytics",
  120. "name": "FERank",
  121. "uri": "https://www.ferank.fr/respect-vie-privee/#mesureaudience",
  122. "needConsent": false,
  123. "js": function () {
  124. "use strict";
  125. tarteaucitron.addScript('//static.ferank.fr/pixel.js', '', function () {
  126. if (typeof tarteaucitron.user.ferankMore === 'function') {
  127. tarteaucitron.user.ferankMore();
  128. }
  129. });
  130. }
  131. };
  132. // facebook
  133. tarteaucitron.services.facebook = {
  134. "key": "facebook",
  135. "type": "social",
  136. "name": "Facebook",
  137. "uri": "https://www.facebook.com/help/cookies/",
  138. "needConsent": true,
  139. "js": function () {
  140. "use strict";
  141. tarteaucitron.fallback(['fb-like'], '');
  142. tarteaucitron.addScript('//connect.facebook.net/fr_FR/sdk.js#xfbml=1&version=v2.0', 'facebook-jssdk');
  143. },
  144. "fallback": function () {
  145. "use strict";
  146. 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>');
  147. }
  148. };
  149. // google adsense
  150. tarteaucitron.services.adsense = {
  151. "key": "adsense",
  152. "type": "ads",
  153. "name": "Adsense (Google)",
  154. "uri": "http://www.google.com/ads/preferences/",
  155. "needConsent": true,
  156. "js": function () {
  157. "use strict";
  158. tarteaucitron.addScript('//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js');
  159. },
  160. "fallback": function () {
  161. "use strict";
  162. var id = 'adsense',
  163. r = Math.floor(Math.random() * 100000);
  164. tarteaucitron.fallback(['adsbygoogle'], tarteaucitron.engage(id));
  165. document.getElementById('tacEngage' + id + r).onclick = function () {
  166. tarteaucitron.userInterface.respond(document.getElementById(id + 'Allowed'), true);
  167. };
  168. }
  169. };
  170. // google analytics
  171. tarteaucitron.services.analytics = {
  172. "key": "analytics",
  173. "type": "analytics",
  174. "name": "Analytics (Google)",
  175. "uri": "https://support.google.com/analytics/answer/6004245",
  176. "needConsent": true,
  177. "js": function () {
  178. "use strict";
  179. window.GoogleAnalyticsObject = 'ga';
  180. window.ga = window.ga || function () {
  181. window.ga.q = window.ga.q || [];
  182. window.ga.q.push(arguments);
  183. };
  184. window.ga.l = new Date();
  185. tarteaucitron.addScript('//www.google-analytics.com/analytics.js', '', function () {
  186. ga('create', tarteaucitron.user.analyticsUa, {'cookieExpires': 34128000});
  187. ga('send', 'pageview');
  188. if (typeof tarteaucitron.user.analyticsMore === 'function') {
  189. tarteaucitron.user.analyticsMore();
  190. }
  191. });
  192. },
  193. "fallback": function () {
  194. "use strict";
  195. var cookies = ['_ga', '_gat', '__utma', '__utmb', '__utmc', '__utmz'];
  196. tarteaucitron.cookie.purge(cookies);
  197. }
  198. };
  199. // google+
  200. tarteaucitron.services.gplus = {
  201. "key": "gplus",
  202. "type": "social",
  203. "name": "Google+",
  204. "uri": "http://www.google.fr/intl/policies/privacy/",
  205. "needConsent": true,
  206. "js": function () {
  207. "use strict";
  208. tarteaucitron.addScript('https://apis.google.com/js/platform.js');
  209. },
  210. "fallback": function () {
  211. "use strict";
  212. 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>');
  213. }
  214. };
  215. // linkedin
  216. tarteaucitron.services.linkedin = {
  217. "key": "linkedin",
  218. "type": "social",
  219. "name": "Linkedin",
  220. "uri": "https://www.linkedin.com/legal/cookie_policy",
  221. "needConsent": true,
  222. "js": function () {
  223. "use strict";
  224. tarteaucitron.fallback(['tacLinkedin'], '');
  225. tarteaucitron.addScript('//platform.linkedin.com/in.js');
  226. },
  227. "fallback": function () {
  228. "use strict";
  229. tarteaucitron.fallback(['tacLinkedin'], '<a href="http://www.linkedin.com/shareArticle?mini=true&url=' + encodeURIComponent(document.location) + '" target="_blank" class="tac_share tac_share_linkedin">Linkedin</a>');
  230. }
  231. };
  232. // pinterest
  233. tarteaucitron.services.pinterest = {
  234. "key": "pinterest",
  235. "type": "social",
  236. "name": "Pinterest",
  237. "uri": "https://about.pinterest.com/privacy-policy",
  238. "needConsent": true,
  239. "js": function () {
  240. "use strict";
  241. tarteaucitron.addScript('//assets.pinterest.com/js/pinit.js');
  242. }
  243. };
  244. // twitter
  245. tarteaucitron.services.twitter = {
  246. "key": "twitter",
  247. "type": "social",
  248. "name": "Twitter",
  249. "uri": "https://support.twitter.com/articles/20170514",
  250. "needConsent": true,
  251. "js": function () {
  252. "use strict";
  253. tarteaucitron.fallback(['tacTwitter'], '');
  254. tarteaucitron.addScript('//platform.twitter.com/widgets.js', 'twitter-wjs');
  255. },
  256. "fallback": function () {
  257. "use strict";
  258. tarteaucitron.fallback(['tacTwitter'], '<a href="https://twitter.com/intent/tweet?text=' + encodeURIComponent(document.title) + '%20' + encodeURIComponent(document.location) + '" target="_blank" class="tac_share tac_share_twitter">Twitter</a>');
  259. }
  260. };