diff --git a/tarteaucitron.js b/tarteaucitron.js index 850fdd9..1658877 100644 --- a/tarteaucitron.js +++ b/tarteaucitron.js @@ -203,7 +203,7 @@ var tarteaucitron = { }, "respond": function (el, status) { "use strict"; - var key = el.id.replace(new RegExp("(Allow|Deni)ed", "g"), ''); + var key = el.id.replace(new RegExp("(Eng[0-9]+|Allow|Deni)ed", "g"), ''); // return if same state if (tarteaucitron.state[key] === status) { @@ -382,14 +382,15 @@ var tarteaucitron = { } } }, - "engage": function (id, r) { + "engage": function (id) { "use strict"; - var html = ''; - + var html = '', + r = Math.floor(Math.random() * 100000); + html += '
'; html += '
'; html += ' ' + id + ' ' + tarteaucitron.lang.fallback + '
'; - html += '
'; + html += '
'; html += ' ' + tarteaucitron.lang.allow; html += '
'; html += '
'; diff --git a/tarteaucitron.services.js b/tarteaucitron.services.js index ef65c47..399534a 100644 --- a/tarteaucitron.services.js +++ b/tarteaucitron.services.js @@ -54,13 +54,9 @@ tarteaucitron.services.disqus = { }, "fallback": function () { "use strict"; - var id = 'disqus', - r = Math.floor(Math.random() * 100000); + var id = 'disqus'; - document.getElementById('disqus_thread').innerHTML = tarteaucitron.engage(id, r); - document.getElementById('tacEngage' + id + r).onclick = function () { - tarteaucitron.userInterface.respond(document.getElementById(id + 'Allowed'), true); - }; + document.getElementById('disqus_thread').innerHTML = tarteaucitron.engage(id); } }; @@ -87,15 +83,10 @@ tarteaucitron.services.sharethis = { "fallback": function () { "use strict"; var cookies = ['__unam'], - id = 'sharethis', - r = Math.floor(Math.random() * 100000); + id = 'sharethis'; tarteaucitron.cookie.purge(cookies); - - tarteaucitron.fallback(['tacSharethis'], tarteaucitron.engage(id, r)); - document.getElementById('tacEngage' + id + r).onclick = function () { - tarteaucitron.userInterface.respond(document.getElementById(id + 'Allowed'), true); - }; + tarteaucitron.fallback(['tacSharethis'], tarteaucitron.engage(id)); } }; @@ -122,15 +113,10 @@ tarteaucitron.services.shareaholic = { "fallback": function () { "use strict"; var cookies = ['__utma', '__utmb', '__utmc', '__utmz'], - id = 'shareaholic', - r = Math.floor(Math.random() * 100000); + id = 'shareaholic'; tarteaucitron.cookie.purge(cookies); - - tarteaucitron.fallback(['shareaholic-canvas'], tarteaucitron.engage(id, r)); - document.getElementById('tacEngage' + id + r).onclick = function () { - tarteaucitron.userInterface.respond(document.getElementById(id + 'Allowed'), true); - }; + tarteaucitron.fallback(['shareaholic-canvas'], tarteaucitron.engage(id)); } }; @@ -152,15 +138,10 @@ tarteaucitron.services.addthis = { "fallback": function () { "use strict"; var cookies = ['__atuvc'], - id = 'addthis', - r = Math.floor(Math.random() * 100000); + id = 'addthis'; tarteaucitron.cookie.purge(cookies); - - tarteaucitron.fallback(['addthis_sharing_toolbox'], tarteaucitron.engage(id, r)); - document.getElementById('tacEngage' + id + r).onclick = function () { - tarteaucitron.userInterface.respond(document.getElementById(id + 'Allowed'), true); - }; + tarteaucitron.fallback(['addthis_sharing_toolbox'], tarteaucitron.engage(id)); } }; @@ -212,13 +193,9 @@ tarteaucitron.services.adsense = { }, "fallback": function () { "use strict"; - var id = 'adsense', - r = Math.floor(Math.random() * 100000); + var id = 'adsense'; - tarteaucitron.fallback(['adsbygoogle'], tarteaucitron.engage(id, r)); - document.getElementById('tacEngage' + id + r).onclick = function () { - tarteaucitron.userInterface.respond(document.getElementById(id + 'Allowed'), true); - }; + tarteaucitron.fallback(['adsbygoogle'], tarteaucitron.engage(id)); } };