Making id uniq

This commit is contained in:
Amauri CHAMPEAUX 2014-09-27 13:45:19 +02:00
parent 91f4bb4f15
commit 1615ede70d
2 changed files with 17 additions and 12 deletions

View File

@ -382,14 +382,14 @@ var tarteaucitron = {
} }
} }
}, },
"engage": function (id) { "engage": function (id, r) {
"use strict"; "use strict";
var html = ''; var html = '';
html += '<div class="tac_activate">'; html += '<div class="tac_activate">';
html += ' <div class="tac_float">'; html += ' <div class="tac_float">';
html += ' <b>' + id + '</b> ' + tarteaucitron.lang.fallback + '<br/>'; html += ' <b>' + id + '</b> ' + tarteaucitron.lang.fallback + '<br/>';
html += ' <div class="tarteaucitronAllow" id="tacEngage' + id + '">'; html += ' <div class="tarteaucitronAllow" id="tacEngage' + id + r + '">';
html += ' ' + tarteaucitron.lang.allow; html += ' ' + tarteaucitron.lang.allow;
html += ' </div>'; html += ' </div>';
html += ' </div>'; html += ' </div>';

View File

@ -17,10 +17,11 @@ tarteaucitron.services.disqus = {
}, },
"fallback": function () { "fallback": function () {
"use strict"; "use strict";
var id = 'disqus'; var id = 'disqus',
r = Math.floor(Math.random() * 100000);
document.getElementById('disqus_thread').innerHTML = tarteaucitron.engage(id); document.getElementById('disqus_thread').innerHTML = tarteaucitron.engage(id);
document.getElementById('tacEngage' + id).onclick = function () { document.getElementById('tacEngage' + id + r).onclick = function () {
tarteaucitron.userInterface.respond(document.getElementById(id + 'Allowed'), true); tarteaucitron.userInterface.respond(document.getElementById(id + 'Allowed'), true);
}; };
} }
@ -49,12 +50,13 @@ tarteaucitron.services.sharethis = {
"fallback": function () { "fallback": function () {
"use strict"; "use strict";
var cookies = ['__unam'], var cookies = ['__unam'],
id = 'sharethis'; id = 'sharethis',
r = Math.floor(Math.random() * 100000);
tarteaucitron.cookie.purge(cookies); tarteaucitron.cookie.purge(cookies);
tarteaucitron.fallback(['tacSharethis'], tarteaucitron.engage(id)); tarteaucitron.fallback(['tacSharethis'], tarteaucitron.engage(id));
document.getElementById('tacEngage' + id).onclick = function () { document.getElementById('tacEngage' + id + r).onclick = function () {
tarteaucitron.userInterface.respond(document.getElementById(id + 'Allowed'), true); tarteaucitron.userInterface.respond(document.getElementById(id + 'Allowed'), true);
}; };
} }
@ -83,12 +85,13 @@ tarteaucitron.services.shareaholic = {
"fallback": function () { "fallback": function () {
"use strict"; "use strict";
var cookies = ['__utma', '__utmb', '__utmc', '__utmz'], var cookies = ['__utma', '__utmb', '__utmc', '__utmz'],
id = 'shareaholic'; id = 'shareaholic',
r = Math.floor(Math.random() * 100000);
tarteaucitron.cookie.purge(cookies); tarteaucitron.cookie.purge(cookies);
tarteaucitron.fallback(['shareaholic-canvas'], tarteaucitron.engage(id)); tarteaucitron.fallback(['shareaholic-canvas'], tarteaucitron.engage(id));
document.getElementById('tacEngage' + id).onclick = function () { document.getElementById('tacEngage' + id + r).onclick = function () {
tarteaucitron.userInterface.respond(document.getElementById(id + 'Allowed'), true); tarteaucitron.userInterface.respond(document.getElementById(id + 'Allowed'), true);
}; };
} }
@ -112,12 +115,13 @@ tarteaucitron.services.addthis = {
"fallback": function () { "fallback": function () {
"use strict"; "use strict";
var cookies = ['__atuvc'], var cookies = ['__atuvc'],
id = 'addthis'; id = 'addthis',
r = Math.floor(Math.random() * 100000);
tarteaucitron.cookie.purge(cookies); tarteaucitron.cookie.purge(cookies);
tarteaucitron.fallback(['addthis_sharing_toolbox'], tarteaucitron.engage(id)); tarteaucitron.fallback(['addthis_sharing_toolbox'], tarteaucitron.engage(id));
document.getElementById('tacEngage' + id).onclick = function () { document.getElementById('tacEngage' + id + r).onclick = function () {
tarteaucitron.userInterface.respond(document.getElementById(id + 'Allowed'), true); tarteaucitron.userInterface.respond(document.getElementById(id + 'Allowed'), true);
}; };
} }
@ -171,10 +175,11 @@ tarteaucitron.services.adsense = {
}, },
"fallback": function () { "fallback": function () {
"use strict"; "use strict";
var id = 'adsense'; var id = 'adsense',
r = Math.floor(Math.random() * 100000);
tarteaucitron.fallback(['adsbygoogle'], tarteaucitron.engage(id)); tarteaucitron.fallback(['adsbygoogle'], tarteaucitron.engage(id));
document.getElementById('tacEngage' + id).onclick = function () { document.getElementById('tacEngage' + id + r).onclick = function () {
tarteaucitron.userInterface.respond(document.getElementById(id + 'Allowed'), true); tarteaucitron.userInterface.respond(document.getElementById(id + 'Allowed'), true);
}; };
} }