tarteaucitron.js 75 KB

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