Adding a gray area...

This commit is contained in:
Amauri CHAMPEAUX 2014-10-25 21:09:31 +02:00
parent ed13808eb5
commit 3684c37ab7
2 changed files with 25 additions and 3 deletions

View File

@ -6,8 +6,9 @@ var scripts = document.getElementsByTagName('script'),
cdn = path.split('/').slice(0, -1).join('/') + '/';
var tarteaucitron = {
"showAlertSmall": true, // show the small banner on bottom right ?
"autoOpen": false, // auto open the panel with #tarteaucitron hash ?
"showAlertSmall": true, // show the small banner on bottom right?
"autoOpen": false, // auto open the panel with #tarteaucitron hash?
"grayArea": false, // activate the features of the gray area?
"cdn": cdn,
"user": {},
"lang": {},
@ -184,7 +185,9 @@ var tarteaucitron = {
tarteaucitron.state[service.key] = false;
tarteaucitron.userInterface.color(service.key, false);
} else if (!isResponded) {
if (typeof service.fallback === 'function') {
if (typeof service.grayJs === 'function' && tarteaucitron.grayArea === true) {
service.grayJs();
} else if (typeof service.fallback === 'function') {
service.fallback();
}
}

View File

@ -145,6 +145,25 @@ tarteaucitron.services.analytics = {
}
});
},
"grayJs": function () {
"use strict";
window.GoogleAnalyticsObject = 'ga';
window.ga = window.ga || function () {
window.ga.q = window.ga.q || [];
window.ga.q.push(arguments);
};
window.ga.l = new Date();
tarteaucitron.addScript('//www.google-analytics.com/analytics.js', '', function () {
ga('create', tarteaucitron.user.analyticsUa, {'cookieExpires': 86400});
ga('set', 'anonymizeIp', true);
ga('set', 'forceSSL', true);
ga('send', 'pageview');
if (typeof tarteaucitron.user.analyticsMore === 'function') {
tarteaucitron.user.analyticsMore();
}
});
},
"fallback": function () {
"use strict";
var cookies = ['_ga', '_gat', '__utma', '__utmb', '__utmc', '__utmt', '__utmz'];