Add Allow button directly in the service container

This commit is contained in:
Amauri CHAMPEAUX 2014-09-25 19:50:38 +02:00
parent da3c9f943c
commit 22d3005fbd
5 changed files with 108 additions and 5 deletions

View File

@ -156,7 +156,8 @@
} }
#tarteaucitron .tarteaucitronLine .tarteaucitronAsk .tarteaucitronAllow, #tarteaucitron .tarteaucitronLine .tarteaucitronAsk .tarteaucitronAllow,
#tarteaucitron .tarteaucitronLine .tarteaucitronAsk .tarteaucitronDeny { #tarteaucitron .tarteaucitronLine .tarteaucitronAsk .tarteaucitronDeny,
.tac_activate .tarteaucitronAllow {
background: gray; background: gray;
color: #fff; color: #fff;
cursor: pointer; cursor: pointer;
@ -167,7 +168,6 @@
width: auto; width: auto;
} }
/*** /***
* Big alert * Big alert
*/ */
@ -236,6 +236,46 @@
width: 10px; width: 10px;
} }
/***
* Fallback activate link
*/
.tac_activate {
background: #333;
display: block;
height: 100%;
min-height: 100px;
position: relative;
width: 100%;
}
.tac_activate .tac_float {
background: #333;
bottom: 0;
box-sizing: border-box;
color: #fff;
font-family: verdana;
font-size: 14px;
height: 80px;
left: 0;
line-height: initial;
margin: auto;
padding: 10px 0;
position: absolute;
right: 0;
text-align: center;
top: 0;
}
.tac_activate .tac_float b {
color: #fff !important;
}
.tac_activate .tac_float .tarteaucitronAllow {
background-color: #1B870B;
margin-top: 10px;
}
/*** /***
* Fallback links for social networks * Fallback links for social networks
*/ */

View File

@ -10,6 +10,8 @@ tarteaucitron.lang = {
"deny": "Deny", "deny": "Deny",
"more": "Read more", "more": "Read more",
"source": "View the official website", "source": "View the official website",
"fallback": "is disabled.",
"ads": { "ads": {
"title": "Advertising network", "title": "Advertising network",

View File

@ -10,6 +10,8 @@ tarteaucitron.lang = {
"deny": "Interdire", "deny": "Interdire",
"more": "En savoir plus", "more": "En savoir plus",
"source": "Voir le site officiel", "source": "Voir le site officiel",
"fallback": "est désactivé.",
"ads": { "ads": {
"title": "Régies publicitaires", "title": "Régies publicitaires",

View File

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

View File

@ -14,6 +14,15 @@ tarteaucitron.services.disqus = {
} }
tarteaucitron.addScript('//' + tarteaucitron.user.disqusShortname + '.disqus.com/embed.js'); tarteaucitron.addScript('//' + tarteaucitron.user.disqusShortname + '.disqus.com/embed.js');
tarteaucitron.addScript('//' + tarteaucitron.user.disqusShortname + '.disqus.com/count.js'); tarteaucitron.addScript('//' + tarteaucitron.user.disqusShortname + '.disqus.com/count.js');
},
"fallback": function () {
"use strict";
var id = 'disqus';
document.getElementById('disqus_thread').innerHTML = tarteaucitron.engage(id);
document.getElementById('tacEngage' + id).onclick = function () {
tarteaucitron.userInterface.respond(document.getElementById(id + 'Allowed'), true);
};
} }
}; };
@ -31,14 +40,23 @@ tarteaucitron.services.sharethis = {
} }
var switchTo5x = true, var switchTo5x = true,
uri = ('https:' === document.location.protocol ? 'https://ws' : 'http://w') + '.sharethis.com/button/buttons.js'; uri = ('https:' === document.location.protocol ? 'https://ws' : 'http://w') + '.sharethis.com/button/buttons.js';
tarteaucitron.fallback(['tacSharethis'], '');
tarteaucitron.addScript(uri, '', function () { tarteaucitron.addScript(uri, '', function () {
stLight.options({publisher: tarteaucitron.user.sharethisPublisher, doNotHash: false, doNotCopy: false, hashAddressBar: false}); stLight.options({publisher: tarteaucitron.user.sharethisPublisher, doNotHash: false, doNotCopy: false, hashAddressBar: false});
}); });
}, },
"fallback": function () { "fallback": function () {
"use strict"; "use strict";
var cookies = ['__unam']; var cookies = ['__unam'],
id = 'sharethis';
tarteaucitron.cookie.purge(cookies); tarteaucitron.cookie.purge(cookies);
tarteaucitron.fallback(['tacSharethis'], tarteaucitron.engage(id));
document.getElementById('tacEngage' + id).onclick = function () {
tarteaucitron.userInterface.respond(document.getElementById(id + 'Allowed'), true);
};
} }
}; };
@ -54,6 +72,8 @@ tarteaucitron.services.shareaholic = {
if (tarteaucitron.user.shareaholicSiteId === undefined) { if (tarteaucitron.user.shareaholicSiteId === undefined) {
return; return;
} }
tarteaucitron.fallback(['shareaholic-canvas'], '');
tarteaucitron.addScript('//dsms0mj1bbhn4.cloudfront.net/assets/pub/shareaholic.js', '', function () { tarteaucitron.addScript('//dsms0mj1bbhn4.cloudfront.net/assets/pub/shareaholic.js', '', function () {
try { try {
Shareaholic.init(tarteaucitron.user.shareaholicSiteId); Shareaholic.init(tarteaucitron.user.shareaholicSiteId);
@ -62,8 +82,15 @@ 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';
tarteaucitron.cookie.purge(cookies); tarteaucitron.cookie.purge(cookies);
tarteaucitron.fallback(['shareaholic-canvas'], tarteaucitron.engage(id));
document.getElementById('tacEngage' + id).onclick = function () {
tarteaucitron.userInterface.respond(document.getElementById(id + 'Allowed'), true);
};
} }
}; };
@ -79,12 +106,20 @@ tarteaucitron.services.addthis = {
if (tarteaucitron.user.addthisPubId === undefined) { if (tarteaucitron.user.addthisPubId === undefined) {
return; return;
} }
tarteaucitron.fallback(['addthis_sharing_toolbox'], '');
tarteaucitron.addScript('//s7.addthis.com/js/300/addthis_widget.js#pubid=' + tarteaucitron.user.addthisPubId); tarteaucitron.addScript('//s7.addthis.com/js/300/addthis_widget.js#pubid=' + tarteaucitron.user.addthisPubId);
}, },
"fallback": function () { "fallback": function () {
"use strict"; "use strict";
var cookies = ['__atuvc']; var cookies = ['__atuvc'],
id = 'addthis';
tarteaucitron.cookie.purge(cookies); tarteaucitron.cookie.purge(cookies);
tarteaucitron.fallback(['addthis_sharing_toolbox'], tarteaucitron.engage(id));
document.getElementById('tacEngage' + id).onclick = function () {
tarteaucitron.userInterface.respond(document.getElementById(id + 'Allowed'), true);
};
} }
}; };
@ -133,6 +168,15 @@ tarteaucitron.services.adsense = {
"js": function () { "js": function () {
"use strict"; "use strict";
tarteaucitron.addScript('//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js'); tarteaucitron.addScript('//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js');
},
"fallback": function () {
"use strict";
var id = 'adsense';
tarteaucitron.fallback(['adsbygoogle'], tarteaucitron.engage(id));
document.getElementById('tacEngage' + id).onclick = function () {
tarteaucitron.userInterface.respond(document.getElementById(id + 'Allowed'), true);
};
} }
}; };