From b375eebd7586ec75852b90957c68e147c30cc27d Mon Sep 17 00:00:00 2001 From: Amauri CHAMPEAUX Date: Wed, 11 Mar 2015 19:49:57 +0100 Subject: [PATCH] Add Twitter Cards --- README.md | 1 + tarteaucitron.js | 2 +- tarteaucitron.services.js | 57 ++++++++++++++++++++++++++++++++++++++- 3 files changed, 58 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index e2f37d4..026353d 100644 --- a/README.md +++ b/README.md @@ -63,6 +63,7 @@ Bonus: * Shareaholic * ShareThis * Twitter + * Twitter Cards * Support * UserVoice diff --git a/tarteaucitron.js b/tarteaucitron.js index 098742b..1a39763 100644 --- a/tarteaucitron.js +++ b/tarteaucitron.js @@ -10,7 +10,7 @@ var scripts = document.getElementsByTagName('script'), tarteaucitronNoAdBlocker = false; var tarteaucitron = { - "version": 204.5, + "version": 204.6, "cdn": cdn, "user": {}, "lang": {}, diff --git a/tarteaucitron.services.js b/tarteaucitron.services.js index 076e58c..b96a6b0 100644 --- a/tarteaucitron.services.js +++ b/tarteaucitron.services.js @@ -1,4 +1,4 @@ -/*global tarteaucitron, ga, Shareaholic, stLight, clicky, top, google, Typekit, FB, ferankReady, IN, stButtons*/ +/*global tarteaucitron, ga, Shareaholic, stLight, clicky, top, google, Typekit, FB, ferankReady, IN, stButtons, twttr*/ /*jslint regexp: true, nomen: true*/ // addthis @@ -905,6 +905,61 @@ tarteaucitron.services.twitter = { } }; +// twitter embed +tarteaucitron.services.twitterembed = { + "key": "twitterembed", + "type": "social", + "name": "Twitter Cards", + "uri": "https://support.twitter.com/articles/20170514", + "needConsent": true, + "cookies": [], + "js": function () { + "use strict"; + var uniqIds = [], + i, + e, + html; + + tarteaucitron.fallback(['twitterembed-canvas'], function (x) { + var uniqId = '_' + Math.random().toString(36).substr(2, 9); + uniqIds.push(uniqId); + html = '