tarteaucitron.js 76 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639
  1. /*jslint browser: true, evil: true */
  2. var scripts = document.getElementsByTagName('script'),
  3. thisScript = null;
  4. for (var i = 0, il = scripts.length; i < il; ++i) {
  5. if ( scripts[i].getAttribute('src').indexOf('tarteaucitron') >= 0) {
  6. // should always find this script
  7. thisScript = scripts[i];
  8. break;
  9. }
  10. // should never happen
  11. throw new Error("Error: tarteaucitron.js script not found");
  12. }
  13. // define correct path for files inclusion
  14. var path = thisScript.src.split('?')[0],
  15. tarteaucitronForceCDN = (tarteaucitronForceCDN === undefined) ? '' : tarteaucitronForceCDN,
  16. cdn = (tarteaucitronForceCDN === '') ? path.split('/').slice(0, -1).join('/') + '/' : tarteaucitronForceCDN,
  17. alreadyLaunch = (alreadyLaunch === undefined) ? 0 : alreadyLaunch,
  18. tarteaucitronForceLanguage = (tarteaucitronForceLanguage === undefined) ? '' : tarteaucitronForceLanguage,
  19. tarteaucitronForceExpire = (tarteaucitronForceExpire === undefined) ? '' : tarteaucitronForceExpire,
  20. tarteaucitronCustomText = (tarteaucitronCustomText === undefined) ? '' : tarteaucitronCustomText,
  21. // tarteaucitronExpireInDay: true for day(s) value - false for hour(s) value
  22. tarteaucitronExpireInDay = (tarteaucitronExpireInDay === undefined || typeof tarteaucitronExpireInDay !== "boolean") ? true : tarteaucitronExpireInDay,
  23. timeExpire = 31536000000,
  24. tarteaucitronProLoadServices,
  25. tarteaucitronNoAdBlocker = false;
  26. var tarteaucitron = {
  27. "version": 20200114,
  28. "cdn": cdn,
  29. "user": {},
  30. "lang": {},
  31. "services": {},
  32. "added": [],
  33. "idprocessed": [],
  34. "state": [],
  35. "launch": [],
  36. "parameters": {},
  37. "isAjax": false,
  38. "reloadThePage": false,
  39. "events": {
  40. "init": function () {},
  41. "load": function () {},
  42. },
  43. "init": function (params) {
  44. "use strict";
  45. var origOpen;
  46. tarteaucitron.parameters = params;
  47. if (alreadyLaunch === 0) {
  48. alreadyLaunch = 1;
  49. if (window.addEventListener) {
  50. window.addEventListener("load", function () {
  51. tarteaucitron.load();
  52. tarteaucitron.fallback(['tarteaucitronOpenPanel'], function (elem) {
  53. elem.addEventListener("click", function (event) {
  54. tarteaucitron.userInterface.openPanel();
  55. event.preventDefault();
  56. }, false);
  57. }, true);
  58. }, false);
  59. window.addEventListener("scroll", function () {
  60. var scrollPos = window.pageYOffset || document.documentElement.scrollTop,
  61. heightPosition;
  62. if (document.getElementById('tarteaucitronAlertBig') !== null && !tarteaucitron.highPrivacy) {
  63. if (document.getElementById('tarteaucitronAlertBig').style.display === 'block') {
  64. heightPosition = document.getElementById('tarteaucitronAlertBig').offsetHeight + 'px';
  65. if (scrollPos > (screen.height * 2)) {
  66. tarteaucitron.userInterface.respondAll(true);
  67. } else if (scrollPos > (screen.height / 2)) {
  68. document.getElementById('tarteaucitronDisclaimerAlert').innerHTML = '<strong>' + tarteaucitron.lang.alertBigScroll + '</strong> ' + tarteaucitron.lang.alertBig;
  69. }
  70. if (tarteaucitron.orientation === 'top') {
  71. document.getElementById('tarteaucitronPercentage').style.top = heightPosition;
  72. } else {
  73. document.getElementById('tarteaucitronPercentage').style.bottom = heightPosition;
  74. }
  75. document.getElementById('tarteaucitronPercentage').style.width = ((100 / (screen.height * 2)) * scrollPos) + '%';
  76. }
  77. }
  78. }, false);
  79. window.addEventListener("keydown", function (evt) {
  80. if (evt.keyCode === 27) {
  81. tarteaucitron.userInterface.closePanel();
  82. }
  83. }, false);
  84. window.addEventListener("hashchange", function () {
  85. if (document.location.hash === tarteaucitron.hashtag && tarteaucitron.hashtag !== '') {
  86. tarteaucitron.userInterface.openPanel();
  87. }
  88. }, false);
  89. window.addEventListener("resize", function () {
  90. if (document.getElementById('tarteaucitron') !== null) {
  91. if (document.getElementById('tarteaucitron').style.display === 'block') {
  92. tarteaucitron.userInterface.jsSizing('main');
  93. }
  94. }
  95. if (document.getElementById('tarteaucitronCookiesListContainer') !== null) {
  96. if (document.getElementById('tarteaucitronCookiesListContainer').style.display === 'block') {
  97. tarteaucitron.userInterface.jsSizing('cookie');
  98. }
  99. }
  100. }, false);
  101. } else {
  102. window.attachEvent("onload", function () {
  103. tarteaucitron.load();
  104. tarteaucitron.fallback(['tarteaucitronOpenPanel'], function (elem) {
  105. elem.attachEvent("onclick", function (event) {
  106. tarteaucitron.userInterface.openPanel();
  107. event.preventDefault();
  108. });
  109. }, true);
  110. });
  111. window.attachEvent("onscroll", function () {
  112. var scrollPos = window.pageYOffset || document.documentElement.scrollTop,
  113. heightPosition;
  114. if (document.getElementById('tarteaucitronAlertBig') !== null && !tarteaucitron.highPrivacy) {
  115. if (document.getElementById('tarteaucitronAlertBig').style.display === 'block') {
  116. heightPosition = document.getElementById('tarteaucitronAlertBig').offsetHeight + 'px';
  117. if (scrollPos > (screen.height * 2)) {
  118. tarteaucitron.userInterface.respondAll(true);
  119. } else if (scrollPos > (screen.height / 2)) {
  120. document.getElementById('tarteaucitronDisclaimerAlert').innerHTML = '<strong>' + tarteaucitron.lang.alertBigScroll + '</strong> ' + tarteaucitron.lang.alertBig;
  121. }
  122. if (tarteaucitron.orientation === 'top') {
  123. document.getElementById('tarteaucitronPercentage').style.top = heightPosition;
  124. } else {
  125. document.getElementById('tarteaucitronPercentage').style.bottom = heightPosition;
  126. }
  127. document.getElementById('tarteaucitronPercentage').style.width = ((100 / (screen.height * 2)) * scrollPos) + '%';
  128. }
  129. }
  130. });
  131. window.attachEvent("onkeydown", function (evt) {
  132. if (evt.keyCode === 27) {
  133. tarteaucitron.userInterface.closePanel();
  134. }
  135. if ( evt.keyCode === 9 && focusableEls.indexOf(evt.target) >= 0) {
  136. if ( evt.shiftKey ) /* shift + tab */ {
  137. if (document.activeElement === firstFocusableEl) {
  138. lastFocusableEl.focus();
  139. evt.preventDefault();
  140. }
  141. } else /* tab */ {
  142. if (document.activeElement === lastFocusableEl) {
  143. firstFocusableEl.focus();
  144. evt.preventDefault();
  145. }
  146. }
  147. }
  148. });
  149. window.attachEvent("onhashchange", function () {
  150. if (document.location.hash === tarteaucitron.hashtag && tarteaucitron.hashtag !== '') {
  151. tarteaucitron.userInterface.openPanel();
  152. }
  153. });
  154. window.attachEvent("onresize", function () {
  155. if (document.getElementById('tarteaucitron') !== null) {
  156. if (document.getElementById('tarteaucitron').style.display === 'block') {
  157. tarteaucitron.userInterface.jsSizing('main');
  158. }
  159. }
  160. if (document.getElementById('tarteaucitronCookiesListContainer') !== null) {
  161. if (document.getElementById('tarteaucitronCookiesListContainer').style.display === 'block') {
  162. tarteaucitron.userInterface.jsSizing('cookie');
  163. }
  164. }
  165. });
  166. }
  167. if (typeof XMLHttpRequest !== 'undefined') {
  168. origOpen = XMLHttpRequest.prototype.open;
  169. XMLHttpRequest.prototype.open = function () {
  170. if (window.addEventListener) {
  171. this.addEventListener("load", function () {
  172. if (typeof tarteaucitronProLoadServices === 'function') {
  173. tarteaucitronProLoadServices();
  174. }
  175. }, false);
  176. } else if (typeof this.attachEvent !== 'undefined') {
  177. this.attachEvent("onload", function () {
  178. if (typeof tarteaucitronProLoadServices === 'function') {
  179. tarteaucitronProLoadServices();
  180. }
  181. });
  182. } else {
  183. if (typeof tarteaucitronProLoadServices === 'function') {
  184. setTimeout(tarteaucitronProLoadServices, 1000);
  185. }
  186. }
  187. try {
  188. origOpen.apply(this, arguments);
  189. } catch (err) {}
  190. };
  191. }
  192. }
  193. if(tarteaucitron.events.init) {
  194. tarteaucitron.events.init();
  195. }
  196. },
  197. "load": function () {
  198. "use strict";
  199. var cdn = tarteaucitron.cdn,
  200. language = tarteaucitron.getLanguage(),
  201. pathToLang = cdn + 'lang/tarteaucitron.' + language + '.js?v=' + tarteaucitron.version,
  202. pathToServices = cdn + 'tarteaucitron.services.js?v=' + tarteaucitron.version,
  203. linkElement = document.createElement('link'),
  204. defaults = {
  205. "adblocker": false,
  206. "hashtag": '#tarteaucitron',
  207. "cookieName": 'tarteaucitron',
  208. "highPrivacy": true,
  209. "orientation": "middle",
  210. "removeCredit": false,
  211. "showAlertSmall": true,
  212. "cookieslist": true,
  213. "handleBrowserDNTRequest": false,
  214. "AcceptAllCta" : true,
  215. "moreInfoLink": true,
  216. "privacyUrl": "",
  217. "useExternalCss": false,
  218. "useExternalJs": false
  219. },
  220. params = tarteaucitron.parameters;
  221. // Don't show the middle bar if we are on the privacy policy page
  222. if (window.location.href == tarteaucitron.parameters.privacyUrl && tarteaucitron.parameters.orientation == "middle") {
  223. tarteaucitron.parameters.orientation = "bottom";
  224. }
  225. // Step -1
  226. if (typeof tarteaucitronCustomPremium !== 'undefined') {
  227. tarteaucitronCustomPremium();
  228. }
  229. // Step 0: get params
  230. if (params !== undefined) {
  231. for (var k in defaults) {
  232. if(!tarteaucitron.parameters.hasOwnProperty(k)) {
  233. tarteaucitron.parameters[k] = defaults[k];
  234. }
  235. }
  236. }
  237. // global
  238. tarteaucitron.orientation = tarteaucitron.parameters.orientation;
  239. tarteaucitron.hashtag = tarteaucitron.parameters.hashtag;
  240. tarteaucitron.highPrivacy = tarteaucitron.parameters.highPrivacy;
  241. tarteaucitron.handleBrowserDNTRequest = tarteaucitron.parameters.handleBrowserDNTRequest;
  242. // Step 1: load css
  243. if ( !tarteaucitron.parameters.useExternalCss ) {
  244. linkElement.rel = 'stylesheet';
  245. linkElement.type = 'text/css';
  246. linkElement.href = cdn + 'css/tarteaucitron.css?v=' + tarteaucitron.version;
  247. document.getElementsByTagName('head')[0].appendChild(linkElement);
  248. }
  249. // Step 2: load language and services
  250. tarteaucitron.addScript(pathToLang, '', function () {
  251. if(tarteaucitronCustomText !== ''){
  252. tarteaucitron.lang = tarteaucitron.AddOrUpdate(tarteaucitron.lang, tarteaucitronCustomText);
  253. }
  254. tarteaucitron.addScript(pathToServices, '', function () {
  255. // css for new middle bar
  256. if (tarteaucitron.orientation === 'middle') {
  257. var customThemeMiddle = document.createElement('style'),
  258. cssRuleMiddle = 'div#tarteaucitronRoot.tarteaucitronBeforeVisible:before {content: \'\';position: fixed;width: 100%;height: 100%;background: white;top: 0;left: 0;z-index: 999;opacity: 0.5;}div#tarteaucitronAlertBig:before {content: \'' + tarteaucitron.lang.middleBarHead + '\';font-size: 50px;}body #tarteaucitronRoot div#tarteaucitronAlertBig {width: 60%;min-width: 285px;height: auto;margin: auto;left: 50%;top: 50%;transform: translate(-50%, -50%);box-shadow: 0 0 9000px #000;border-radius: 20px;padding: 50px 0;}span#tarteaucitronDisclaimerAlert {padding: 0 30px;}#tarteaucitronRoot span#tarteaucitronDisclaimerAlert {margin: 50px 0;display: block;text-align: center;font-size: 21px;}';
  259. customThemeMiddle.type = 'text/css';
  260. if (customThemeMiddle.styleSheet) {
  261. customThemeMiddle.styleSheet.cssText = cssRuleMiddle;
  262. } else {
  263. customThemeMiddle.appendChild(document.createTextNode(cssRuleMiddle));
  264. }
  265. document.getElementsByTagName('head')[0].appendChild(customThemeMiddle);
  266. }
  267. var body = document.body,
  268. div = document.createElement('div'),
  269. html = '',
  270. index,
  271. orientation = 'Top',
  272. cat = ['ads', 'analytic', 'api', 'comment', 'social', 'support', 'video', 'other'],
  273. i;
  274. cat = cat.sort(function (a, b) {
  275. if (tarteaucitron.lang[a].title > tarteaucitron.lang[b].title) { return 1; }
  276. if (tarteaucitron.lang[a].title < tarteaucitron.lang[b].title) { return -1; }
  277. return 0;
  278. });
  279. // Step 3: prepare the html
  280. html += '<div id="tarteaucitronPremium"></div>';
  281. html += '<button type="button" id="tarteaucitronBack" onclick="tarteaucitron.userInterface.closePanel();" aria-label="' + tarteaucitron.lang.close + '"></button>';
  282. html += '<div id="tarteaucitron" role="dialog" aria-labelledby="dialogTitle">';
  283. html += ' <button type="button" id="tarteaucitronClosePanel" onclick="tarteaucitron.userInterface.closePanel();">';
  284. html += ' ' + tarteaucitron.lang.close;
  285. html += ' </button>';
  286. html += ' <div id="tarteaucitronServices">';
  287. html += ' <div class="tarteaucitronLine tarteaucitronMainLine" id="tarteaucitronMainLineOffset">';
  288. html += ' <span class="tarteaucitronH1" role="heading" aria-level="1" id="dialogTitle">'+ tarteaucitron.lang.title + '</span>';
  289. html += ' <div id="tarteaucitronInfo">';
  290. html += ' ' + tarteaucitron.lang.disclaimer;
  291. if (tarteaucitron.parameters.privacyUrl !== "") {
  292. html += ' <br/><br/>';
  293. html += ' <button type="button" id="tarteaucitronPrivacyUrlDialog" onclick="document.location = tarteaucitron.parameters.privacyUrl">';
  294. html += ' ' + tarteaucitron.lang.privacyUrl;
  295. html += ' </button>';
  296. }
  297. html += ' </div>';
  298. html += ' <div class="tarteaucitronName">';
  299. html += ' <span class="tarteaucitronH2" role="heading" aria-level="2">' + tarteaucitron.lang.all + '</span>';
  300. html += ' </div>';
  301. html += ' <div class="tarteaucitronAsk" id="tarteaucitronScrollbarAdjust">';
  302. html += ' <button type="button" id="tarteaucitronAllAllowed" class="tarteaucitronAllow" onclick="tarteaucitron.userInterface.respondAll(true);">';
  303. html += ' &#10003; ' + tarteaucitron.lang.allowAll;
  304. html += ' </button> ';
  305. html += ' <button type="button" id="tarteaucitronAllDenied" class="tarteaucitronDeny" onclick="tarteaucitron.userInterface.respondAll(false);">';
  306. html += ' &#10007; ' + tarteaucitron.lang.denyAll;
  307. html += ' </button>';
  308. html += ' </div>';
  309. html += ' </div>';
  310. html += ' <div class="tarteaucitronBorder">';
  311. html += ' <div class="clear"></div><ul>';
  312. for (i = 0; i < cat.length; i += 1) {
  313. html += ' <li id="tarteaucitronServicesTitle_' + cat[i] + '" class="tarteaucitronHidden">';
  314. html += ' <div class="tarteaucitronTitle">';
  315. html += ' <button type="button" onclick="tarteaucitron.userInterface.toggle(\'tarteaucitronDetails' + cat[i] + '\', \'tarteaucitronInfoBox\');return false">&#10011; ' + tarteaucitron.lang[cat[i]].title + '</button>';
  316. html += ' </div>';
  317. html += ' <div id="tarteaucitronDetails' + cat[i] + '" class="tarteaucitronDetails tarteaucitronInfoBox">';
  318. html += ' ' + tarteaucitron.lang[cat[i]].details;
  319. html += ' </div>';
  320. html += ' <ul id="tarteaucitronServices_' + cat[i] + '"></ul></li>';
  321. }
  322. html += ' <li id="tarteaucitronNoServicesTitle" class="tarteaucitronLine">' + tarteaucitron.lang.noServices + '</li>';
  323. html += ' </ul>';
  324. html += ' <div class="tarteaucitronHidden" id="tarteaucitronScrollbarChild" style="height:20px;display:block"></div>';
  325. if (tarteaucitron.parameters.removeCredit === false) {
  326. html += ' <a class="tarteaucitronSelfLink" href="https://opt-out.ferank.eu/" rel="nofollow noreferrer noopener" target="_blank" title="tarteaucitron ' + tarteaucitron.lang.newWindow + '">🍋 ' + tarteaucitron.lang.credit + '</a>';
  327. }
  328. html += ' </div>';
  329. html += ' </div>';
  330. html += '</div>';
  331. if (tarteaucitron.parameters.orientation === 'bottom') {
  332. orientation = 'Bottom';
  333. }
  334. if (tarteaucitron.parameters.highPrivacy && !tarteaucitron.parameters.AcceptAllCta) {
  335. html += '<div id="tarteaucitronAlertBig" class="tarteaucitronAlertBig' + orientation + '">';
  336. //html += '<div class="tarteaucitronAlertBigWrapper">';
  337. html += ' <span id="tarteaucitronDisclaimerAlert">';
  338. html += ' ' + tarteaucitron.lang.alertBigPrivacy;
  339. html += ' </span>';
  340. //html += ' <span class="tarteaucitronAlertBigBtnWrapper">';
  341. html += ' <button type="button" id="tarteaucitronPersonalize" onclick="tarteaucitron.userInterface.openPanel();">';
  342. html += ' ' + tarteaucitron.lang.personalize;
  343. html += ' </button>';
  344. if (tarteaucitron.parameters.privacyUrl !== "") {
  345. html += ' <button type="button" id="tarteaucitronPrivacyUrl" onclick="document.location = tarteaucitron.parameters.privacyUrl">';
  346. html += ' ' + tarteaucitron.lang.privacyUrl;
  347. html += ' </button>';
  348. }
  349. //html += ' </span>';
  350. //html += '</div>';
  351. html += '</div>';
  352. } else {
  353. html += '<div id="tarteaucitronAlertBig" class="tarteaucitronAlertBig' + orientation + '">';
  354. //html += '<div class="tarteaucitronAlertBigWrapper">';
  355. html += ' <span id="tarteaucitronDisclaimerAlert">';
  356. if (tarteaucitron.parameters.highPrivacy) {
  357. html += ' ' + tarteaucitron.lang.alertBigPrivacy;
  358. } else {
  359. html += ' ' + tarteaucitron.lang.alertBigClick + ' ' + tarteaucitron.lang.alertBig;
  360. }
  361. html += ' </span>';
  362. //html += ' <span class="tarteaucitronAlertBigBtnWrapper">';
  363. html += ' <button type="button" id="tarteaucitronPersonalize" onclick="tarteaucitron.userInterface.respondAll(true);">';
  364. html += ' &#10003; ' + tarteaucitron.lang.acceptAll;
  365. html += ' </button>';
  366. if (tarteaucitron.parameters.orientation === 'middle') {
  367. html += ' <button type="button" class="tarteaucitronCTAButton tarteaucitronDeny" onclick="tarteaucitron.userInterface.respondAll(false);">';
  368. html += ' &#10007; ' + tarteaucitron.lang.denyAll;
  369. html += ' </button>';
  370. html += ' <br/><br/>';
  371. }
  372. html += ' <button type="button" id="tarteaucitronCloseAlert" onclick="tarteaucitron.userInterface.openPanel();">';
  373. html += ' ' + tarteaucitron.lang.personalize;
  374. html += ' </button>';
  375. if (tarteaucitron.parameters.privacyUrl !== "") {
  376. html += ' <button type="button" id="tarteaucitronPrivacyUrl" onclick="document.location = tarteaucitron.parameters.privacyUrl">';
  377. html += ' ' + tarteaucitron.lang.privacyUrl;
  378. html += ' </button>';
  379. }
  380. //html += ' </span>';
  381. //html += '</div>';
  382. html += '</div>';
  383. html += '<div id="tarteaucitronPercentage"></div>';
  384. }
  385. if (tarteaucitron.parameters.showAlertSmall === true) {
  386. html += '<div id="tarteaucitronAlertSmall" class="tarteaucitronAlertSmall' + orientation + '">';
  387. html += ' <button type="button" id="tarteaucitronManager" onclick="tarteaucitron.userInterface.openPanel();">';
  388. html += ' ' + tarteaucitron.lang.alertSmall;
  389. html += ' <span id="tarteaucitronDot">';
  390. html += ' <span id="tarteaucitronDotGreen"></span>';
  391. html += ' <span id="tarteaucitronDotYellow"></span>';
  392. html += ' <span id="tarteaucitronDotRed"></span>';
  393. html += ' </span>';
  394. if (tarteaucitron.parameters.cookieslist === true) {
  395. html += ' </button><!-- @whitespace';
  396. html += ' --><button type="button" id="tarteaucitronCookiesNumber" onclick="tarteaucitron.userInterface.toggleCookiesList();">0</button>';
  397. html += ' <div id="tarteaucitronCookiesListContainer">';
  398. html += ' <button type="button" id="tarteaucitronClosePanelCookie" onclick="tarteaucitron.userInterface.closePanel();">';
  399. html += ' ' + tarteaucitron.lang.close;
  400. html += ' </button>';
  401. html += ' <div class="tarteaucitronCookiesListMain" id="tarteaucitronCookiesTitle">';
  402. html += ' <span class="tarteaucitronH2" role="heading" aria-level="2" id="tarteaucitronCookiesNumberBis">0 cookie</span>';
  403. html += ' </div>';
  404. html += ' <div id="tarteaucitronCookiesList"></div>';
  405. html += ' </div>';
  406. } else {
  407. html += ' </div>';
  408. }
  409. html += '</div>';
  410. }
  411. tarteaucitron.addScript(tarteaucitron.cdn + 'advertising.js?v=' + tarteaucitron.version, '', function () {
  412. if (tarteaucitronNoAdBlocker === true || tarteaucitron.parameters.adblocker === false) {
  413. // create a wrapper container at the same level than tarteaucitron so we can add an aria-hidden when tarteaucitron is opened
  414. /*var wrapper = document.createElement('div');
  415. wrapper.id = "contentWrapper";
  416. while (document.body.firstChild)
  417. {
  418. wrapper.appendChild(document.body.firstChild);
  419. }
  420. // Append the wrapper to the body
  421. document.body.appendChild(wrapper);*/
  422. div.id = 'tarteaucitronRoot';
  423. body.appendChild(div, body);
  424. div.innerHTML = html;
  425. //ie compatibility
  426. var tacRootAvailableEvent;
  427. if(typeof(Event) === 'function') {
  428. tacRootAvailableEvent = new Event("tac.root_available");
  429. }else{
  430. tacRootAvailableEvent = document.createEvent('Event');
  431. tacRootAvailableEvent.initEvent("tac.root_available", true, true);
  432. }
  433. //end ie compatibility
  434. window.dispatchEvent(tacRootAvailableEvent);
  435. if (tarteaucitron.job !== undefined) {
  436. tarteaucitron.job = tarteaucitron.cleanArray(tarteaucitron.job);
  437. for (index = 0; index < tarteaucitron.job.length; index += 1) {
  438. tarteaucitron.addService(tarteaucitron.job[index]);
  439. }
  440. } else {
  441. tarteaucitron.job = []
  442. }
  443. tarteaucitron.isAjax = true;
  444. tarteaucitron.job.push = function (id) {
  445. // ie <9 hack
  446. if (typeof tarteaucitron.job.indexOf === 'undefined') {
  447. tarteaucitron.job.indexOf = function (obj, start) {
  448. var i,
  449. j = this.length;
  450. for (i = (start || 0); i < j; i += 1) {
  451. if (this[i] === obj) { return i; }
  452. }
  453. return -1;
  454. };
  455. }
  456. if (tarteaucitron.job.indexOf(id) === -1) {
  457. Array.prototype.push.call(this, id);
  458. }
  459. tarteaucitron.launch[id] = false;
  460. tarteaucitron.addService(id);
  461. };
  462. if (document.location.hash === tarteaucitron.hashtag && tarteaucitron.hashtag !== '') {
  463. tarteaucitron.userInterface.openPanel();
  464. }
  465. tarteaucitron.cookie.number();
  466. setInterval(tarteaucitron.cookie.number, 60000);
  467. }
  468. }, tarteaucitron.parameters.adblocker);
  469. if (tarteaucitron.parameters.adblocker === true) {
  470. setTimeout(function () {
  471. if (tarteaucitronNoAdBlocker === false) {
  472. html = '<div id="tarteaucitronAlertBig" class="tarteaucitronAlertBig' + orientation + '" style="display:block" role="alert" aria-live="polite">';
  473. html += ' <p id="tarteaucitronDisclaimerAlert">';
  474. html += ' ' + tarteaucitron.lang.adblock + '<br/>';
  475. html += ' <strong>' + tarteaucitron.lang.adblock_call + '</strong>';
  476. html += ' </p>';
  477. html += ' <button type="button" class="tarteaucitronCTAButton" onclick="location.reload();">';
  478. html += ' ' + tarteaucitron.lang.reload;
  479. html += ' </button>';
  480. html += '</div>';
  481. html += '<div id="tarteaucitronPremium"></div>';
  482. div.id = 'tarteaucitronRoot';
  483. body.appendChild(div, body);
  484. div.innerHTML = html;
  485. }
  486. }, 1500);
  487. }
  488. });
  489. });
  490. if(tarteaucitron.events.load) {
  491. tarteaucitron.events.load();
  492. }
  493. },
  494. "addService": function (serviceId) {
  495. "use strict";
  496. var html = '',
  497. s = tarteaucitron.services,
  498. service = s[serviceId],
  499. cookie = tarteaucitron.cookie.read(),
  500. hostname = document.location.hostname,
  501. hostRef = document.referrer.split('/')[2],
  502. isNavigating = (hostRef === hostname && window.location.href !== tarteaucitron.parameters.privacyUrl),
  503. isAutostart = (!service.needConsent),
  504. isWaiting = (cookie.indexOf(service.key + '=wait') >= 0),
  505. isDenied = (cookie.indexOf(service.key + '=false') >= 0),
  506. isAllowed = (cookie.indexOf(service.key + '=true') >= 0),
  507. isResponded = (cookie.indexOf(service.key + '=false') >= 0 || cookie.indexOf(service.key + '=true') >= 0),
  508. isDNTRequested = (navigator.doNotTrack === "1" || navigator.doNotTrack === "yes" || navigator.msDoNotTrack === "1" || window.doNotTrack === "1");
  509. if (tarteaucitron.added[service.key] !== true) {
  510. tarteaucitron.added[service.key] = true;
  511. html += '<li id="' + service.key + 'Line" class="tarteaucitronLine">';
  512. html += ' <div class="tarteaucitronName">';
  513. html += ' <span class="tarteaucitronH3" role="heading" aria-level="3">' + service.name + '</span>';
  514. html += ' <span id="tacCL' + service.key + '" class="tarteaucitronListCookies"></span><br/>';
  515. if (tarteaucitron.parameters.moreInfoLink == true) {
  516. var link = 'https://opt-out.ferank.eu/service/' + service.key + '/';
  517. if (service.readmoreLink !== undefined && service.readmoreLink !== '') {
  518. link = service.readmoreLink;
  519. }
  520. if (tarteaucitron.parameters.readmoreLink !== undefined && tarteaucitron.parameters.readmoreLink !== '') {
  521. link = tarteaucitron.parameters.readmoreLink;
  522. }
  523. html += ' <a href="' + link + '" target="_blank" rel="noreferrer noopener" title="'+ tarteaucitron.lang.cookieDetail + ' ' + service.name + ' ' + tarteaucitron.lang.ourSite + ' ' + tarteaucitron.lang.newWindow +'">';
  524. html += ' ' + tarteaucitron.lang.more;
  525. html += ' </a>';
  526. html += ' - ';
  527. html += ' <a href="' + service.uri + '" target="_blank" rel="noreferrer noopener" title="' + service.name + ' ' + tarteaucitron.lang.newWindow + '">';
  528. html += ' ' + tarteaucitron.lang.source;
  529. html += ' </a>';
  530. }
  531. html += ' </div>';
  532. html += ' <div class="tarteaucitronAsk">';
  533. html += ' <button type="button" id="' + service.key + 'Allowed" class="tarteaucitronAllow" onclick="tarteaucitron.userInterface.respond(this, true);">';
  534. html += ' &#10003; ' + tarteaucitron.lang.allow;
  535. html += ' </button> ';
  536. html += ' <button type="button" id="' + service.key + 'Denied" class="tarteaucitronDeny" onclick="tarteaucitron.userInterface.respond(this, false);">';
  537. html += ' &#10007; ' + tarteaucitron.lang.deny;
  538. html += ' </button>';
  539. html += ' </div>';
  540. html += '</li>';
  541. tarteaucitron.userInterface.css('tarteaucitronServicesTitle_' + service.type, 'display', 'block');
  542. if (document.getElementById('tarteaucitronServices_' + service.type) !== null) {
  543. document.getElementById('tarteaucitronServices_' + service.type).innerHTML += html;
  544. }
  545. tarteaucitron.userInterface.css('tarteaucitronNoServicesTitle', 'display', 'none');
  546. tarteaucitron.userInterface.order(service.type);
  547. }
  548. tarteaucitron.pro('!' + service.key + '=' + isAllowed);
  549. // allow by default for non EU
  550. if (isResponded === false && tarteaucitron.user.bypass === true) {
  551. isAllowed = true;
  552. tarteaucitron.cookie.create(service.key, true);
  553. }
  554. if ((!isResponded && (isAutostart || (isNavigating && isWaiting)) && !tarteaucitron.highPrivacy) || isAllowed) {
  555. if (!isAllowed) {
  556. tarteaucitron.cookie.create(service.key, true);
  557. }
  558. if (tarteaucitron.launch[service.key] !== true) {
  559. tarteaucitron.launch[service.key] = true;
  560. service.js();
  561. tarteaucitron.sendEvent(service.key + '_loaded');
  562. }
  563. tarteaucitron.state[service.key] = true;
  564. tarteaucitron.userInterface.color(service.key, true);
  565. } else if (isDenied) {
  566. if (typeof service.fallback === 'function') {
  567. service.fallback();
  568. }
  569. tarteaucitron.state[service.key] = false;
  570. tarteaucitron.userInterface.color(service.key, false);
  571. } else if (!isResponded && isDNTRequested && tarteaucitron.handleBrowserDNTRequest) {
  572. tarteaucitron.cookie.create(service.key, 'false');
  573. if (typeof service.fallback === 'function') {
  574. service.fallback();
  575. }
  576. tarteaucitron.state[service.key] = false;
  577. tarteaucitron.userInterface.color(service.key, false);
  578. } else if (!isResponded) {
  579. tarteaucitron.cookie.create(service.key, 'wait');
  580. if (typeof service.fallback === 'function') {
  581. service.fallback();
  582. }
  583. tarteaucitron.userInterface.color(service.key, 'wait');
  584. tarteaucitron.userInterface.openAlert();
  585. }
  586. tarteaucitron.cookie.checkCount(service.key);
  587. tarteaucitron.sendEvent(service.key + '_added')
  588. },
  589. "sendEvent" : function(event_key) {
  590. if(event_key !== undefined) {
  591. //ie compatibility
  592. var send_event_item;
  593. if(typeof(Event) === 'function') {
  594. send_event_item = new Event(event_key);
  595. }else{
  596. send_event_item = document.createEvent('Event');
  597. send_event_item.initEvent(event_key, true, true);
  598. }
  599. //end ie compatibility
  600. document.dispatchEvent(send_event_item);
  601. }
  602. },
  603. "cleanArray": function cleanArray(arr) {
  604. "use strict";
  605. var i,
  606. len = arr.length,
  607. out = [],
  608. obj = {},
  609. s = tarteaucitron.services;
  610. for (i = 0; i < len; i += 1) {
  611. if (!obj[arr[i]]) {
  612. obj[arr[i]] = {};
  613. if (tarteaucitron.services[arr[i]] !== undefined) {
  614. out.push(arr[i]);
  615. }
  616. }
  617. }
  618. out = out.sort(function (a, b) {
  619. if (s[a].type + s[a].key > s[b].type + s[b].key) { return 1; }
  620. if (s[a].type + s[a].key < s[b].type + s[b].key) { return -1; }
  621. return 0;
  622. });
  623. return out;
  624. },
  625. "userInterface": {
  626. "css": function (id, property, value) {
  627. "use strict";
  628. if (document.getElementById(id) !== null) {
  629. document.getElementById(id).style[property] = value;
  630. }
  631. },
  632. "addClass": function (id, className) {
  633. "use strict";
  634. if (document.getElementById(id) !== null) {
  635. document.getElementById(id).classList.add(className);
  636. }
  637. },
  638. "removeClass": function (id, className) {
  639. "use strict";
  640. if (document.getElementById(id) !== null) {
  641. document.getElementById(id).classList.remove(className);
  642. }
  643. },
  644. "respondAll": function (status) {
  645. "use strict";
  646. var s = tarteaucitron.services,
  647. service,
  648. key,
  649. index = 0;
  650. for (index = 0; index < tarteaucitron.job.length; index += 1) {
  651. service = s[tarteaucitron.job[index]];
  652. key = service.key;
  653. if (tarteaucitron.state[key] !== status) {
  654. if (status === false && tarteaucitron.launch[key] === true) {
  655. tarteaucitron.reloadThePage = true;
  656. }
  657. if (tarteaucitron.launch[key] !== true && status === true) {
  658. tarteaucitron.pro('!' + key + '=engage');
  659. tarteaucitron.launch[key] = true;
  660. tarteaucitron.services[key].js();
  661. }
  662. tarteaucitron.state[key] = status;
  663. tarteaucitron.cookie.create(key, status);
  664. tarteaucitron.userInterface.color(key, status);
  665. }
  666. }
  667. },
  668. "respond": function (el, status) {
  669. "use strict";
  670. var key = el.id.replace(new RegExp("(Eng[0-9]+|Allow|Deni)ed", "g"), '');
  671. // return if same state
  672. if (tarteaucitron.state[key] === status) {
  673. return;
  674. }
  675. if (status === false && tarteaucitron.launch[key] === true) {
  676. tarteaucitron.reloadThePage = true;
  677. }
  678. // if not already launched... launch the service
  679. if (status === true) {
  680. if (tarteaucitron.launch[key] !== true) {
  681. tarteaucitron.pro('!' + key + '=engage');
  682. tarteaucitron.launch[key] = true;
  683. tarteaucitron.sendEvent(key + '_loaded');
  684. tarteaucitron.services[key].js();
  685. }
  686. }
  687. tarteaucitron.state[key] = status;
  688. tarteaucitron.cookie.create(key, status);
  689. tarteaucitron.userInterface.color(key, status);
  690. },
  691. "color": function (key, status) {
  692. "use strict";
  693. var c = 'tarteaucitron',
  694. nbDenied = 0,
  695. nbPending = 0,
  696. nbAllowed = 0,
  697. sum = tarteaucitron.job.length,
  698. index;
  699. if (status === true) {
  700. document.getElementById(key + 'Line').classList.add('tarteaucitronIsAllowed');
  701. document.getElementById(key + 'Line').classList.remove('tarteaucitronIsDenied');
  702. } else if (status === false) {
  703. document.getElementById(key + 'Line').classList.remove('tarteaucitronIsAllowed');
  704. document.getElementById(key + 'Line').classList.add('tarteaucitronIsDenied');
  705. }
  706. // check if all services are allowed
  707. for (index = 0; index < sum; index += 1) {
  708. if (tarteaucitron.state[tarteaucitron.job[index]] === false) {
  709. nbDenied += 1;
  710. } else if (tarteaucitron.state[tarteaucitron.job[index]] === undefined) {
  711. nbPending += 1;
  712. } else if (tarteaucitron.state[tarteaucitron.job[index]] === true) {
  713. nbAllowed += 1;
  714. }
  715. }
  716. tarteaucitron.userInterface.css(c + 'DotGreen', 'width', ((100 / sum) * nbAllowed) + '%');
  717. tarteaucitron.userInterface.css(c + 'DotYellow', 'width', ((100 / sum) * nbPending) + '%');
  718. tarteaucitron.userInterface.css(c + 'DotRed', 'width', ((100 / sum) * nbDenied) + '%');
  719. if (nbDenied === 0 && nbPending === 0) {
  720. tarteaucitron.userInterface.removeClass(c + 'AllDenied', c + 'IsSelected');
  721. tarteaucitron.userInterface.addClass(c + 'AllAllowed', c + 'IsSelected');
  722. tarteaucitron.userInterface.addClass(c + 'MainLineOffset', c + 'IsAllowed');
  723. tarteaucitron.userInterface.removeClass(c + 'MainLineOffset', c + 'IsDenied');
  724. } else if (nbAllowed === 0 && nbPending === 0) {
  725. tarteaucitron.userInterface.removeClass(c + 'AllAllowed', c + 'IsSelected');
  726. tarteaucitron.userInterface.addClass(c + 'AllDenied', c + 'IsSelected');
  727. tarteaucitron.userInterface.removeClass(c + 'MainLineOffset', c + 'IsAllowed');
  728. tarteaucitron.userInterface.addClass(c + 'MainLineOffset', c + 'IsDenied');
  729. } else {
  730. tarteaucitron.userInterface.removeClass(c + 'AllAllowed', c + 'IsSelected');
  731. tarteaucitron.userInterface.removeClass(c + 'AllDenied', c + 'IsSelected');
  732. tarteaucitron.userInterface.removeClass(c + 'MainLineOffset', c + 'IsAllowed');
  733. tarteaucitron.userInterface.removeClass(c + 'MainLineOffset', c + 'IsDenied');
  734. }
  735. // close the alert if all service have been reviewed
  736. if (nbPending === 0) {
  737. tarteaucitron.userInterface.closeAlert();
  738. }
  739. if (tarteaucitron.services[key].cookies.length > 0 && status === false) {
  740. tarteaucitron.cookie.purge(tarteaucitron.services[key].cookies);
  741. }
  742. if (status === true) {
  743. if (document.getElementById('tacCL' + key) !== null) {
  744. document.getElementById('tacCL' + key).innerHTML = '...';
  745. }
  746. setTimeout(function () {
  747. tarteaucitron.cookie.checkCount(key);
  748. }, 2500);
  749. } else {
  750. tarteaucitron.cookie.checkCount(key);
  751. }
  752. },
  753. "openPanel": function () {
  754. "use strict";
  755. tarteaucitron.userInterface.css('tarteaucitron', 'display', 'block');
  756. tarteaucitron.userInterface.css('tarteaucitronBack', 'display', 'block');
  757. tarteaucitron.userInterface.css('tarteaucitronCookiesListContainer', 'display', 'none');
  758. document.getElementById('tarteaucitronClosePanel').focus();
  759. document.getElementsByTagName('body')[0].classList.add('modal-open');
  760. tarteaucitron.userInterface.focusTrap();
  761. tarteaucitron.userInterface.jsSizing('main');
  762. //ie compatibility
  763. var tacOpenPanelEvent;
  764. if(typeof(Event) === 'function') {
  765. tacOpenPanelEvent = new Event("tac.open_panel");
  766. }else{
  767. tacOpenPanelEvent = document.createEvent('Event');
  768. tacOpenPanelEvent.initEvent("tac.open_panel", true, true);
  769. }
  770. //end ie compatibility
  771. window.dispatchEvent(tacOpenPanelEvent);
  772. },
  773. "closePanel": function () {
  774. "use strict";
  775. if (document.location.hash === tarteaucitron.hashtag) {
  776. if (window.history) {
  777. window.history.replaceState('', document.title, window.location.pathname + window.location.search);
  778. } else {
  779. document.location.hash = '';
  780. }
  781. }
  782. tarteaucitron.userInterface.css('tarteaucitron', 'display', 'none');
  783. tarteaucitron.userInterface.css('tarteaucitronCookiesListContainer', 'display', 'none');
  784. tarteaucitron.fallback(['tarteaucitronInfoBox'], function (elem) {
  785. elem.style.display = 'none';
  786. }, true);
  787. if (tarteaucitron.reloadThePage === true) {
  788. window.location.reload();
  789. } else {
  790. tarteaucitron.userInterface.css('tarteaucitronBack', 'display', 'none');
  791. }
  792. if (document.getElementById('tarteaucitronCloseAlert') !== null) {
  793. document.getElementById('tarteaucitronCloseAlert').focus();
  794. }
  795. document.getElementsByTagName('body')[0].classList.remove('modal-open');
  796. //ie compatibility
  797. var tacClosePanelEvent;
  798. if(typeof(Event) === 'function') {
  799. tacClosePanelEvent = new Event("tac.close_panel");
  800. }else{
  801. tacClosePanelEvent = document.createEvent('Event');
  802. tacClosePanelEvent.initEvent("tac.close_panel", true, true);
  803. }
  804. //end ie compatibility
  805. window.dispatchEvent(tacClosePanelEvent);
  806. },
  807. "focusTrap": function() {
  808. "use strict";
  809. var focusableEls,
  810. firstFocusableEl,
  811. lastFocusableEl,
  812. filtered;
  813. focusableEls = document.getElementById('tarteaucitron').querySelectorAll('a[href], button');
  814. filtered = [];
  815. // get only visible items
  816. for (var i = 0, max = focusableEls.length; i < max; i++) {
  817. if (focusableEls[i].offsetHeight > 0) {
  818. filtered.push(focusableEls[i]);
  819. }
  820. }
  821. firstFocusableEl = filtered[0];
  822. lastFocusableEl = filtered[filtered.length - 1];
  823. //loop focus inside tarteaucitron
  824. document.getElementById('tarteaucitron').addEventListener("keydown", function (evt) {
  825. if ( evt.key === 'Tab' || evt.keyCode === 9 ) {
  826. if ( evt.shiftKey ) /* shift + tab */ {
  827. if (document.activeElement === firstFocusableEl) {
  828. lastFocusableEl.focus();
  829. evt.preventDefault();
  830. }
  831. } else /* tab */ {
  832. if (document.activeElement === lastFocusableEl) {
  833. firstFocusableEl.focus();
  834. evt.preventDefault();
  835. }
  836. }
  837. }
  838. })
  839. },
  840. "openAlert": function () {
  841. "use strict";
  842. var c = 'tarteaucitron';
  843. tarteaucitron.userInterface.css(c + 'Percentage', 'display', 'block');
  844. tarteaucitron.userInterface.css(c + 'AlertSmall', 'display', 'none');
  845. tarteaucitron.userInterface.css(c + 'AlertBig', 'display', 'block');
  846. tarteaucitron.userInterface.addClass(c + 'Root', 'tarteaucitronBeforeVisible');
  847. //ie compatibility
  848. var tacOpenAlertEvent;
  849. if(typeof(Event) === 'function') {
  850. tacOpenAlertEvent = new Event("tac.open_alert");
  851. }else{
  852. tacOpenAlertEvent = document.createEvent('Event');
  853. tacOpenAlertEvent.initEvent("tac.open_alert", true, true);
  854. }
  855. //end ie compatibility
  856. window.dispatchEvent(tacOpenAlertEvent);
  857. },
  858. "closeAlert": function () {
  859. "use strict";
  860. var c = 'tarteaucitron';
  861. tarteaucitron.userInterface.css(c + 'Percentage', 'display', 'none');
  862. tarteaucitron.userInterface.css(c + 'AlertSmall', 'display', 'block');
  863. tarteaucitron.userInterface.css(c + 'AlertBig', 'display', 'none');
  864. tarteaucitron.userInterface.removeClass(c + 'Root', 'tarteaucitronBeforeVisible');
  865. tarteaucitron.userInterface.jsSizing('box');
  866. //ie compatibility
  867. var tacCloseAlertEvent;
  868. if(typeof(Event) === 'function') {
  869. tacCloseAlertEvent = new Event("tac.close_alert");
  870. }else{
  871. tacCloseAlertEvent = document.createEvent('Event');
  872. tacCloseAlertEvent.initEvent("tac.close_alert", true, true);
  873. }
  874. //end ie compatibility
  875. window.dispatchEvent(tacCloseAlertEvent);
  876. },
  877. "toggleCookiesList": function () {
  878. "use strict";
  879. var div = document.getElementById('tarteaucitronCookiesListContainer');
  880. if (div === null) {
  881. return;
  882. }
  883. if (div.style.display !== 'block') {
  884. tarteaucitron.cookie.number();
  885. div.style.display = 'block';
  886. tarteaucitron.userInterface.jsSizing('cookie');
  887. tarteaucitron.userInterface.css('tarteaucitron', 'display', 'none');
  888. tarteaucitron.userInterface.css('tarteaucitronBack', 'display', 'block');
  889. tarteaucitron.fallback(['tarteaucitronInfoBox'], function (elem) {
  890. elem.style.display = 'none';
  891. }, true);
  892. } else {
  893. div.style.display = 'none';
  894. tarteaucitron.userInterface.css('tarteaucitron', 'display', 'none');
  895. tarteaucitron.userInterface.css('tarteaucitronBack', 'display', 'none');
  896. }
  897. },
  898. "toggle": function (id, closeClass) {
  899. "use strict";
  900. var div = document.getElementById(id);
  901. if (div === null) {
  902. return;
  903. }
  904. if (closeClass !== undefined) {
  905. tarteaucitron.fallback([closeClass], function (elem) {
  906. if (elem.id !== id) {
  907. elem.style.display = 'none';
  908. }
  909. }, true);
  910. }
  911. if (div.style.display !== 'block') {
  912. div.style.display = 'block';
  913. } else {
  914. div.style.display = 'none';
  915. }
  916. },
  917. "order": function (id) {
  918. "use strict";
  919. var main = document.getElementById('tarteaucitronServices_' + id),
  920. allDivs,
  921. store = [],
  922. i;
  923. if (main === null) {
  924. return;
  925. }
  926. allDivs = main.childNodes;
  927. if (typeof Array.prototype.map === 'function' && typeof Enumerable === 'undefined') {
  928. Array.prototype.map.call(main.children, Object).sort(function (a, b) {
  929. //var mainChildren = Array.from(main.children);
  930. //mainChildren.sort(function (a, b) {
  931. if (tarteaucitron.services[a.id.replace(/Line/g, '')].name > tarteaucitron.services[b.id.replace(/Line/g, '')].name) { return 1; }
  932. if (tarteaucitron.services[a.id.replace(/Line/g, '')].name < tarteaucitron.services[b.id.replace(/Line/g, '')].name) { return -1; }
  933. return 0;
  934. }).forEach(function (element) {
  935. main.appendChild(element);
  936. });
  937. }
  938. },
  939. "jsSizing": function (type) {
  940. "use strict";
  941. var scrollbarMarginRight = 10,
  942. scrollbarWidthParent,
  943. scrollbarWidthChild,
  944. servicesHeight,
  945. e = window,
  946. a = 'inner',
  947. windowInnerHeight = window.innerHeight || document.documentElement.clientHeight || document.body.clientHeight,
  948. mainTop,
  949. mainHeight,
  950. closeButtonHeight,
  951. headerHeight,
  952. cookiesListHeight,
  953. cookiesCloseHeight,
  954. cookiesTitleHeight,
  955. paddingBox,
  956. alertSmallHeight,
  957. cookiesNumberHeight;
  958. if (type === 'box') {
  959. if (document.getElementById('tarteaucitronAlertSmall') !== null && document.getElementById('tarteaucitronCookiesNumber') !== null) {
  960. // reset
  961. tarteaucitron.userInterface.css('tarteaucitronCookiesNumber', 'padding', '0px 10px');
  962. // calculate
  963. alertSmallHeight = document.getElementById('tarteaucitronAlertSmall').offsetHeight;
  964. cookiesNumberHeight = document.getElementById('tarteaucitronCookiesNumber').offsetHeight;
  965. paddingBox = (alertSmallHeight - cookiesNumberHeight) / 2;
  966. // apply
  967. tarteaucitron.userInterface.css('tarteaucitronCookiesNumber', 'padding', paddingBox + 'px 10px');
  968. }
  969. } else if (type === 'main') {
  970. // get the real window width for media query
  971. if (window.innerWidth === undefined) {
  972. a = 'client';
  973. e = document.documentElement || document.body;
  974. }
  975. // height of the services list container
  976. if (document.getElementById('tarteaucitron') !== null && document.getElementById('tarteaucitronClosePanel') !== null && document.getElementById('tarteaucitronMainLineOffset') !== null) {
  977. // reset
  978. tarteaucitron.userInterface.css('tarteaucitronServices', 'height', 'auto');
  979. // calculate
  980. mainHeight = document.getElementById('tarteaucitron').offsetHeight;
  981. closeButtonHeight = document.getElementById('tarteaucitronClosePanel').offsetHeight;
  982. // apply
  983. servicesHeight = (mainHeight - closeButtonHeight + 2);
  984. tarteaucitron.userInterface.css('tarteaucitronServices', 'height', servicesHeight + 'px');
  985. tarteaucitron.userInterface.css('tarteaucitronServices', 'overflow-x', 'auto');
  986. }
  987. // align the main allow/deny button depending on scrollbar width
  988. if (document.getElementById('tarteaucitronServices') !== null && document.getElementById('tarteaucitronScrollbarChild') !== null) {
  989. // media query
  990. if (e[a + 'Width'] <= 479) {
  991. tarteaucitron.userInterface.css('tarteaucitronScrollbarAdjust', 'marginLeft', '11px');
  992. } else if (e[a + 'Width'] <= 767) {
  993. scrollbarMarginRight = 12;
  994. }
  995. scrollbarWidthParent = document.getElementById('tarteaucitronServices').offsetWidth;
  996. scrollbarWidthChild = document.getElementById('tarteaucitronScrollbarChild').offsetWidth;
  997. tarteaucitron.userInterface.css('tarteaucitronScrollbarAdjust', 'marginRight', ((scrollbarWidthParent - scrollbarWidthChild) + scrollbarMarginRight) + 'px');
  998. }
  999. // center the main panel
  1000. if (document.getElementById('tarteaucitron') !== null) {
  1001. // media query
  1002. if (e[a + 'Width'] <= 767) {
  1003. mainTop = 0;
  1004. } else {
  1005. mainTop = ((windowInnerHeight - document.getElementById('tarteaucitron').offsetHeight) / 2) - 21;
  1006. }
  1007. if (document.getElementById('tarteaucitronMainLineOffset') !== null) {
  1008. if (document.getElementById('tarteaucitron').offsetHeight < (windowInnerHeight / 2)) {
  1009. mainTop -= document.getElementById('tarteaucitronMainLineOffset').offsetHeight;
  1010. }
  1011. }
  1012. // correct
  1013. if (mainTop < 0) {
  1014. mainTop = 0;
  1015. }
  1016. // apply
  1017. tarteaucitron.userInterface.css('tarteaucitron', 'top', mainTop + 'px');
  1018. }
  1019. } else if (type === 'cookie') {
  1020. // put cookies list at bottom
  1021. if (document.getElementById('tarteaucitronAlertSmall') !== null) {
  1022. tarteaucitron.userInterface.css('tarteaucitronCookiesListContainer', 'bottom', (document.getElementById('tarteaucitronAlertSmall').offsetHeight) + 'px');
  1023. }
  1024. // height of cookies list
  1025. if (document.getElementById('tarteaucitronCookiesListContainer') !== null) {
  1026. // reset
  1027. tarteaucitron.userInterface.css('tarteaucitronCookiesList', 'height', 'auto');
  1028. // calculate
  1029. cookiesListHeight = document.getElementById('tarteaucitronCookiesListContainer').offsetHeight;
  1030. cookiesCloseHeight = document.getElementById('tarteaucitronClosePanelCookie').offsetHeight;
  1031. cookiesTitleHeight = document.getElementById('tarteaucitronCookiesTitle').offsetHeight;
  1032. // apply
  1033. tarteaucitron.userInterface.css('tarteaucitronCookiesList', 'height', (cookiesListHeight - cookiesCloseHeight - cookiesTitleHeight - 2) + 'px');
  1034. }
  1035. }
  1036. }
  1037. },
  1038. "cookie": {
  1039. "owner": {},
  1040. "create": function (key, status) {
  1041. "use strict";
  1042. if (tarteaucitronForceExpire !== '') {
  1043. // The number of day(s)/hour(s) can't be higher than 1 year
  1044. if ((tarteaucitronExpireInDay && tarteaucitronForceExpire < 365) || (!tarteaucitronExpireInDay && tarteaucitronForceExpire < 8760)) {
  1045. if (tarteaucitronExpireInDay) {
  1046. // Multiplication to tranform the number of days to milliseconds
  1047. timeExpire = tarteaucitronForceExpire * 86400000;
  1048. } else {
  1049. // Multiplication to tranform the number of hours to milliseconds
  1050. timeExpire = tarteaucitronForceExpire * 3600000;
  1051. }
  1052. }
  1053. }
  1054. var d = new Date(),
  1055. time = d.getTime(),
  1056. expireTime = time + timeExpire, // 365 days
  1057. regex = new RegExp("!" + key + "=(wait|true|false)", "g"),
  1058. cookie = tarteaucitron.cookie.read().replace(regex, ""),
  1059. value = tarteaucitron.parameters.cookieName + '=' + cookie + '!' + key + '=' + status,
  1060. domain = (tarteaucitron.parameters.cookieDomain !== undefined && tarteaucitron.parameters.cookieDomain !== '') ? 'domain=' + tarteaucitron.parameters.cookieDomain + ';' : '';
  1061. d.setTime(expireTime);
  1062. document.cookie = value + '; expires=' + d.toGMTString() + '; path=/;' + domain;
  1063. },
  1064. "read": function () {
  1065. "use strict";
  1066. var nameEQ = tarteaucitron.parameters.cookieName + "=",
  1067. ca = document.cookie.split(';'),
  1068. i,
  1069. c;
  1070. for (i = 0; i < ca.length; i += 1) {
  1071. c = ca[i];
  1072. while (c.charAt(0) === ' ') {
  1073. c = c.substring(1, c.length);
  1074. }
  1075. if (c.indexOf(nameEQ) === 0) {
  1076. return c.substring(nameEQ.length, c.length);
  1077. }
  1078. }
  1079. return '';
  1080. },
  1081. "purge": function (arr) {
  1082. "use strict";
  1083. var i;
  1084. for (i = 0; i < arr.length; i += 1) {
  1085. document.cookie = arr[i] + '=; expires=Thu, 01 Jan 2000 00:00:00 GMT; path=/;';
  1086. document.cookie = arr[i] + '=; expires=Thu, 01 Jan 2000 00:00:00 GMT; path=/; domain=.' + location.hostname + ';';
  1087. document.cookie = arr[i] + '=; expires=Thu, 01 Jan 2000 00:00:00 GMT; path=/; domain=.' + location.hostname.split('.').slice(-2).join('.') + ';';
  1088. }
  1089. },
  1090. "checkCount": function (key) {
  1091. "use strict";
  1092. var arr = tarteaucitron.services[key].cookies,
  1093. nb = arr.length,
  1094. nbCurrent = 0,
  1095. html = '',
  1096. i,
  1097. status = document.cookie.indexOf(key + '=true');
  1098. if (status >= 0 && nb === 0) {
  1099. html += tarteaucitron.lang.useNoCookie;
  1100. } else if (status >= 0) {
  1101. for (i = 0; i < nb; i += 1) {
  1102. if (document.cookie.indexOf(arr[i] + '=') !== -1) {
  1103. nbCurrent += 1;
  1104. if (tarteaucitron.cookie.owner[arr[i]] === undefined) {
  1105. tarteaucitron.cookie.owner[arr[i]] = [];
  1106. }
  1107. if (tarteaucitron.cookie.crossIndexOf(tarteaucitron.cookie.owner[arr[i]], tarteaucitron.services[key].name) === false) {
  1108. tarteaucitron.cookie.owner[arr[i]].push(tarteaucitron.services[key].name);
  1109. }
  1110. }
  1111. }
  1112. if (nbCurrent > 0) {
  1113. html += tarteaucitron.lang.useCookieCurrent + ' ' + nbCurrent + ' cookie';
  1114. if (nbCurrent > 1) {
  1115. html += 's';
  1116. }
  1117. html += '.';
  1118. } else {
  1119. html += tarteaucitron.lang.useNoCookie;
  1120. }
  1121. } else if (nb === 0) {
  1122. html = tarteaucitron.lang.noCookie;
  1123. } else {
  1124. html += tarteaucitron.lang.useCookie + ' ' + nb + ' cookie';
  1125. if (nb > 1) {
  1126. html += 's';
  1127. }
  1128. html += '.';
  1129. }
  1130. if (document.getElementById('tacCL' + key) !== null) {
  1131. document.getElementById('tacCL' + key).innerHTML = html;
  1132. }
  1133. },
  1134. "crossIndexOf": function (arr, match) {
  1135. "use strict";
  1136. var i;
  1137. for (i = 0; i < arr.length; i += 1) {
  1138. if (arr[i] === match) {
  1139. return true;
  1140. }
  1141. }
  1142. return false;
  1143. },
  1144. "number": function () {
  1145. "use strict";
  1146. var cookies = document.cookie.split(';'),
  1147. nb = (document.cookie !== '') ? cookies.length : 0,
  1148. html = '',
  1149. i,
  1150. name,
  1151. namea,
  1152. nameb,
  1153. c,
  1154. d,
  1155. s = (nb > 1) ? 's' : '',
  1156. savedname,
  1157. regex = /^https?\:\/\/([^\/?#]+)(?:[\/?#]|$)/i,
  1158. regexedDomain = (tarteaucitron.cdn.match(regex) !== null) ? tarteaucitron.cdn.match(regex)[1] : tarteaucitron.cdn,
  1159. host = (tarteaucitron.domain !== undefined) ? tarteaucitron.domain : regexedDomain;
  1160. cookies = cookies.sort(function (a, b) {
  1161. namea = a.split('=', 1).toString().replace(/ /g, '');
  1162. nameb = b.split('=', 1).toString().replace(/ /g, '');
  1163. c = (tarteaucitron.cookie.owner[namea] !== undefined) ? tarteaucitron.cookie.owner[namea] : '0';
  1164. d = (tarteaucitron.cookie.owner[nameb] !== undefined) ? tarteaucitron.cookie.owner[nameb] : '0';
  1165. if (c + a > d + b) { return 1; }
  1166. if (c + a < d + b) { return -1; }
  1167. return 0;
  1168. });
  1169. if (document.cookie !== '') {
  1170. for (i = 0; i < nb; i += 1) {
  1171. name = cookies[i].split('=', 1).toString().replace(/ /g, '');
  1172. if (tarteaucitron.cookie.owner[name] !== undefined && tarteaucitron.cookie.owner[name].join(' // ') !== savedname) {
  1173. savedname = tarteaucitron.cookie.owner[name].join(' // ');
  1174. html += '<div class="tarteaucitronHidden">';
  1175. html += ' <span class="tarteaucitronTitle tarteaucitronH3" role="heading" aria-level="3">';
  1176. html += ' ' + tarteaucitron.cookie.owner[name].join(' // ');
  1177. html += ' </span>';
  1178. html += '</div><ul class="cookie-list">';
  1179. } else if (tarteaucitron.cookie.owner[name] === undefined && host !== savedname) {
  1180. savedname = host;
  1181. html += '<div class="tarteaucitronHidden">';
  1182. html += ' <span class="tarteaucitronTitle tarteaucitronH3" role="heading" aria-level="3">';
  1183. html += ' ' + host;
  1184. html += ' </span>';
  1185. html += '</div><ul class="cookie-list">';
  1186. }
  1187. html += '<li class="tarteaucitronCookiesListMain">';
  1188. html += ' <div class="tarteaucitronCookiesListLeft"><button type="button" onclick="tarteaucitron.cookie.purge([\'' + cookies[i].split('=', 1) + '\']);tarteaucitron.cookie.number();tarteaucitron.userInterface.jsSizing(\'cookie\');return false"><strong>&times;</strong></button> <strong>' + name + '</strong>';
  1189. html += ' </div>';
  1190. html += ' <div class="tarteaucitronCookiesListRight">' + cookies[i].split('=').slice(1).join('=') + '</div>';
  1191. html += '</li>';
  1192. }
  1193. html += '</ul>';
  1194. } else {
  1195. html += '<div class="tarteaucitronCookiesListMain">';
  1196. html += ' <div class="tarteaucitronCookiesListLeft"><strong>-</strong></div>';
  1197. html += ' <div class="tarteaucitronCookiesListRight"></div>';
  1198. html += '</div>';
  1199. }
  1200. html += '<div class="tarteaucitronHidden" style="height:20px;display:block"></div>';
  1201. if (document.getElementById('tarteaucitronCookiesList') !== null) {
  1202. document.getElementById('tarteaucitronCookiesList').innerHTML = html;
  1203. }
  1204. if (document.getElementById('tarteaucitronCookiesNumber') !== null) {
  1205. document.getElementById('tarteaucitronCookiesNumber').innerHTML = nb;
  1206. }
  1207. if (document.getElementById('tarteaucitronCookiesNumberBis') !== null) {
  1208. document.getElementById('tarteaucitronCookiesNumberBis').innerHTML = nb + ' cookie' + s;
  1209. }
  1210. for (i = 0; i < tarteaucitron.job.length; i += 1) {
  1211. tarteaucitron.cookie.checkCount(tarteaucitron.job[i]);
  1212. }
  1213. }
  1214. },
  1215. "getLanguage": function () {
  1216. "use strict";
  1217. var availableLanguages = 'cs,de,en,es,fr,it,nl,pl,pt,ru,el,ro,bg,ja,cn,da',
  1218. defaultLanguage = 'en';
  1219. if (tarteaucitronForceLanguage !== '') {
  1220. if (availableLanguages.indexOf(tarteaucitronForceLanguage) !== -1) {
  1221. return tarteaucitronForceLanguage;
  1222. }
  1223. }
  1224. if (!navigator) { return 'en'; }
  1225. var lang = navigator.language || navigator.browserLanguage ||
  1226. navigator.systemLanguage || navigator.userLang || null,
  1227. userLanguage = lang ? lang.substr(0, 2) : null;
  1228. if (availableLanguages.indexOf(userLanguage) === -1) {
  1229. return defaultLanguage;
  1230. }
  1231. return userLanguage;
  1232. },
  1233. "getLocale": function () {
  1234. "use strict";
  1235. if (!navigator) { return 'en_US'; }
  1236. var lang = navigator.language || navigator.browserLanguage ||
  1237. navigator.systemLanguage || navigator.userLang || null,
  1238. userLanguage = lang ? lang.substr(0, 2) : null;
  1239. if (userLanguage === 'fr') {
  1240. return 'fr_FR';
  1241. } else if (userLanguage === 'en') {
  1242. return 'en_US';
  1243. } else if (userLanguage === 'de') {
  1244. return 'de_DE';
  1245. } else if (userLanguage === 'es') {
  1246. return 'es_ES';
  1247. } else if (userLanguage === 'it') {
  1248. return 'it_IT';
  1249. } else if (userLanguage === 'pt') {
  1250. return 'pt_PT';
  1251. } else if (userLanguage === 'nl') {
  1252. return 'nl_NL';
  1253. } else if (userLanguage === 'el') {
  1254. return 'el_EL';
  1255. } else {
  1256. return 'en_US';
  1257. }
  1258. },
  1259. "addScript": function (url, id, callback, execute, attrName, attrVal) {
  1260. "use strict";
  1261. var script,
  1262. done = false;
  1263. if (execute === false) {
  1264. if (typeof callback === 'function') {
  1265. callback();
  1266. }
  1267. } else {
  1268. script = document.createElement('script');
  1269. script.type = 'text/javascript';
  1270. script.id = (id !== undefined) ? id : '';
  1271. script.async = true;
  1272. script.src = url;
  1273. if (attrName !== undefined && attrVal !== undefined) {
  1274. script.setAttribute(attrName, attrVal);
  1275. }
  1276. if (typeof callback === 'function') {
  1277. if ( !tarteaucitron.parameters.useExternalJs ) {
  1278. script.onreadystatechange = script.onload = function () {
  1279. var state = script.readyState;
  1280. if (!done && (!state || /loaded|complete/.test(state))) {
  1281. done = true;
  1282. callback();
  1283. }
  1284. };
  1285. } else {
  1286. callback();
  1287. }
  1288. }
  1289. if ( !tarteaucitron.parameters.useExternalJs ) {
  1290. document.getElementsByTagName('head')[0].appendChild(script);
  1291. }
  1292. }
  1293. },
  1294. "makeAsync": {
  1295. "antiGhost": 0,
  1296. "buffer": '',
  1297. "init": function (url, id) {
  1298. "use strict";
  1299. var savedWrite = document.write,
  1300. savedWriteln = document.writeln;
  1301. document.write = function (content) {
  1302. tarteaucitron.makeAsync.buffer += content;
  1303. };
  1304. document.writeln = function (content) {
  1305. tarteaucitron.makeAsync.buffer += content.concat("\n");
  1306. };
  1307. setTimeout(function () {
  1308. document.write = savedWrite;
  1309. document.writeln = savedWriteln;
  1310. }, 20000);
  1311. tarteaucitron.makeAsync.getAndParse(url, id);
  1312. },
  1313. "getAndParse": function (url, id) {
  1314. "use strict";
  1315. if (tarteaucitron.makeAsync.antiGhost > 9) {
  1316. tarteaucitron.makeAsync.antiGhost = 0;
  1317. return;
  1318. }
  1319. tarteaucitron.makeAsync.antiGhost += 1;
  1320. tarteaucitron.addScript(url, '', function () {
  1321. if (document.getElementById(id) !== null) {
  1322. document.getElementById(id).innerHTML += "<span style='display:none'>&nbsp;</span>" + tarteaucitron.makeAsync.buffer;
  1323. tarteaucitron.makeAsync.buffer = '';
  1324. tarteaucitron.makeAsync.execJS(id);
  1325. }
  1326. });
  1327. },
  1328. "execJS": function (id) {
  1329. /* not strict because third party scripts may have errors */
  1330. var i,
  1331. scripts,
  1332. childId,
  1333. type;
  1334. if (document.getElementById(id) === null) {
  1335. return;
  1336. }
  1337. scripts = document.getElementById(id).getElementsByTagName('script');
  1338. for (i = 0; i < scripts.length; i += 1) {
  1339. type = (scripts[i].getAttribute('type') !== null) ? scripts[i].getAttribute('type') : '';
  1340. if (type === '') {
  1341. type = (scripts[i].getAttribute('language') !== null) ? scripts[i].getAttribute('language') : '';
  1342. }
  1343. if (scripts[i].getAttribute('src') !== null && scripts[i].getAttribute('src') !== '') {
  1344. childId = id + Math.floor(Math.random() * 99999999999);
  1345. document.getElementById(id).innerHTML += '<div id="' + childId + '"></div>';
  1346. tarteaucitron.makeAsync.getAndParse(scripts[i].getAttribute('src'), childId);
  1347. } else if (type.indexOf('javascript') !== -1 || type === '') {
  1348. eval(scripts[i].innerHTML);
  1349. }
  1350. }
  1351. }
  1352. },
  1353. "fallback": function (matchClass, content, noInner) {
  1354. "use strict";
  1355. var elems = document.getElementsByTagName('*'),
  1356. i,
  1357. index = 0;
  1358. for (i in elems) {
  1359. if (elems[i] !== undefined) {
  1360. for (index = 0; index < matchClass.length; index += 1) {
  1361. if ((' ' + elems[i].className + ' ')
  1362. .indexOf(' ' + matchClass[index] + ' ') > -1) {
  1363. if (typeof content === 'function') {
  1364. if (noInner === true) {
  1365. content(elems[i]);
  1366. } else {
  1367. elems[i].innerHTML = content(elems[i]);
  1368. }
  1369. } else {
  1370. elems[i].innerHTML = content;
  1371. }
  1372. }
  1373. }
  1374. }
  1375. }
  1376. },
  1377. "engage": function (id) {
  1378. "use strict";
  1379. var html = '',
  1380. r = Math.floor(Math.random() * 100000),
  1381. engage = tarteaucitron.services[id].name + ' ' + tarteaucitron.lang.fallback;
  1382. if (tarteaucitron.lang['engage-' + id] !== undefined) {
  1383. engage = tarteaucitron.lang['engage-' + id];
  1384. }
  1385. html += '<div class="tac_activate">';
  1386. html += ' <div class="tac_float">';
  1387. html += ' ' + engage;
  1388. html += ' <button type="button" class="tarteaucitronAllow" id="Eng' + r + 'ed' + id + '" onclick="tarteaucitron.userInterface.respond(this, true);">';
  1389. html += ' &#10003; ' + tarteaucitron.lang.allow;
  1390. html += ' </button>';
  1391. html += ' </div>';
  1392. html += '</div>';
  1393. return html;
  1394. },
  1395. "extend": function (a, b) {
  1396. "use strict";
  1397. var prop;
  1398. for (prop in b) {
  1399. if (b.hasOwnProperty(prop)) {
  1400. a[prop] = b[prop];
  1401. }
  1402. }
  1403. },
  1404. "proTemp": '',
  1405. "proTimer": function () {
  1406. "use strict";
  1407. setTimeout(tarteaucitron.proPing, 500);
  1408. },
  1409. "pro": function (list) {
  1410. "use strict";
  1411. tarteaucitron.proTemp += list;
  1412. clearTimeout(tarteaucitron.proTimer);
  1413. tarteaucitron.proTimer = setTimeout(tarteaucitron.proPing, 500);
  1414. },
  1415. "proPing": function () {
  1416. "use strict";
  1417. if (tarteaucitron.uuid !== '' && tarteaucitron.uuid !== undefined && tarteaucitron.proTemp !== '') {
  1418. var div = document.getElementById('tarteaucitronPremium'),
  1419. timestamp = new Date().getTime(),
  1420. url = 'https://opt-out.ferank.eu/log/?';
  1421. if (div === null) {
  1422. return;
  1423. }
  1424. url += 'account=' + tarteaucitron.uuid + '&';
  1425. url += 'domain=' + tarteaucitron.domain + '&';
  1426. url += 'status=' + encodeURIComponent(tarteaucitron.proTemp) + '&';
  1427. url += '_time=' + timestamp;
  1428. div.innerHTML = '<img src="' + url + '" style="display:none" />';
  1429. tarteaucitron.proTemp = '';
  1430. }
  1431. tarteaucitron.cookie.number();
  1432. },
  1433. "AddOrUpdate" : function(source, custom){
  1434. /**
  1435. Utility function to Add or update the fields of obj1 with the ones in obj2
  1436. */
  1437. for(key in custom){
  1438. if(custom[key] instanceof Object){
  1439. source[key] = tarteaucitron.AddOrUpdate(source[key], custom[key]);
  1440. }else{
  1441. source[key] = custom[key];
  1442. }
  1443. }
  1444. return source;
  1445. },
  1446. "getElemWidth": function(elem) {
  1447. return elem.getAttribute('width') || elem.clientWidth;
  1448. },
  1449. "getElemHeight": function(elem) {
  1450. return elem.getAttribute('height') || elem.clientHeight;
  1451. }
  1452. };