tarteaucitron.js 75 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623
  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": 20200114,
  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">';
  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. if (tarteaucitron.parameters.orientation === 'middle') {
  353. html += ' <button type="button" class="tarteaucitronCTAButton tarteaucitronDeny" onclick="tarteaucitron.userInterface.respondAll(false);">';
  354. html += ' &#10007; ' + tarteaucitron.lang.denyAll;
  355. html += ' </button>';
  356. html += ' <br/><br/>';
  357. }
  358. html += ' <button type="button" id="tarteaucitronCloseAlert" onclick="tarteaucitron.userInterface.openPanel();">';
  359. html += ' ' + tarteaucitron.lang.personalize;
  360. html += ' </button>';
  361. if (tarteaucitron.parameters.privacyUrl !== "") {
  362. html += ' <button type="button" id="tarteaucitronPrivacyUrl" onclick="document.location = tarteaucitron.parameters.privacyUrl">';
  363. html += ' ' + tarteaucitron.lang.privacyUrl;
  364. html += ' </button>';
  365. }
  366. //html += ' </span>';
  367. //html += '</div>';
  368. html += '</div>';
  369. html += '<div id="tarteaucitronPercentage"></div>';
  370. }
  371. if (tarteaucitron.parameters.showAlertSmall === true) {
  372. html += '<div id="tarteaucitronAlertSmall" class="tarteaucitronAlertSmall' + orientation + '">';
  373. html += ' <button type="button" id="tarteaucitronManager" onclick="tarteaucitron.userInterface.openPanel();">';
  374. html += ' ' + tarteaucitron.lang.alertSmall;
  375. html += ' <span id="tarteaucitronDot">';
  376. html += ' <span id="tarteaucitronDotGreen"></span>';
  377. html += ' <span id="tarteaucitronDotYellow"></span>';
  378. html += ' <span id="tarteaucitronDotRed"></span>';
  379. html += ' </span>';
  380. if (tarteaucitron.parameters.cookieslist === true) {
  381. html += ' </button><!-- @whitespace';
  382. html += ' --><button type="button" id="tarteaucitronCookiesNumber" onclick="tarteaucitron.userInterface.toggleCookiesList();">0</button>';
  383. html += ' <div id="tarteaucitronCookiesListContainer">';
  384. html += ' <button type="button" id="tarteaucitronClosePanelCookie" onclick="tarteaucitron.userInterface.closePanel();">';
  385. html += ' ' + tarteaucitron.lang.close;
  386. html += ' </button>';
  387. html += ' <div class="tarteaucitronCookiesListMain" id="tarteaucitronCookiesTitle">';
  388. html += ' <span class="tarteaucitronH2" role="heading" aria-level="2" id="tarteaucitronCookiesNumberBis">0 cookie</span>';
  389. html += ' </div>';
  390. html += ' <div id="tarteaucitronCookiesList"></div>';
  391. html += ' </div>';
  392. } else {
  393. html += ' </div>';
  394. }
  395. html += '</div>';
  396. }
  397. tarteaucitron.addScript(tarteaucitron.cdn + 'advertising.js?v=' + tarteaucitron.version, '', function () {
  398. if (tarteaucitronNoAdBlocker === true || tarteaucitron.parameters.adblocker === false) {
  399. // create a wrapper container at the same level than tarteaucitron so we can add an aria-hidden when tarteaucitron is opened
  400. /*var wrapper = document.createElement('div');
  401. wrapper.id = "contentWrapper";
  402. while (document.body.firstChild)
  403. {
  404. wrapper.appendChild(document.body.firstChild);
  405. }
  406. // Append the wrapper to the body
  407. document.body.appendChild(wrapper);*/
  408. div.id = 'tarteaucitronRoot';
  409. body.appendChild(div, body);
  410. div.innerHTML = html;
  411. //ie compatibility
  412. var tacRootAvailableEvent;
  413. if(typeof(Event) === 'function') {
  414. tacRootAvailableEvent = new Event("tac.root_available");
  415. }else{
  416. tacRootAvailableEvent = document.createEvent('Event');
  417. tacRootAvailableEvent.initEvent("tac.root_available", true, true);
  418. }
  419. //end ie compatibility
  420. window.dispatchEvent(tacRootAvailableEvent);
  421. if (tarteaucitron.job !== undefined) {
  422. tarteaucitron.job = tarteaucitron.cleanArray(tarteaucitron.job);
  423. for (index = 0; index < tarteaucitron.job.length; index += 1) {
  424. tarteaucitron.addService(tarteaucitron.job[index]);
  425. }
  426. } else {
  427. tarteaucitron.job = []
  428. }
  429. tarteaucitron.isAjax = true;
  430. tarteaucitron.job.push = function (id) {
  431. // ie <9 hack
  432. if (typeof tarteaucitron.job.indexOf === 'undefined') {
  433. tarteaucitron.job.indexOf = function (obj, start) {
  434. var i,
  435. j = this.length;
  436. for (i = (start || 0); i < j; i += 1) {
  437. if (this[i] === obj) { return i; }
  438. }
  439. return -1;
  440. };
  441. }
  442. if (tarteaucitron.job.indexOf(id) === -1) {
  443. Array.prototype.push.call(this, id);
  444. }
  445. tarteaucitron.launch[id] = false;
  446. tarteaucitron.addService(id);
  447. };
  448. if (document.location.hash === tarteaucitron.hashtag && tarteaucitron.hashtag !== '') {
  449. tarteaucitron.userInterface.openPanel();
  450. }
  451. tarteaucitron.cookie.number();
  452. setInterval(tarteaucitron.cookie.number, 60000);
  453. }
  454. }, tarteaucitron.parameters.adblocker);
  455. if (tarteaucitron.parameters.adblocker === true) {
  456. setTimeout(function () {
  457. if (tarteaucitronNoAdBlocker === false) {
  458. html = '<div id="tarteaucitronAlertBig" class="tarteaucitronAlertBig' + orientation + '" style="display:block" role="alert" aria-live="polite">';
  459. html += ' <p id="tarteaucitronDisclaimerAlert">';
  460. html += ' ' + tarteaucitron.lang.adblock + '<br/>';
  461. html += ' <strong>' + tarteaucitron.lang.adblock_call + '</strong>';
  462. html += ' </p>';
  463. html += ' <button type="button" class="tarteaucitronCTAButton" onclick="location.reload();">';
  464. html += ' ' + tarteaucitron.lang.reload;
  465. html += ' </button>';
  466. html += '</div>';
  467. html += '<div id="tarteaucitronPremium"></div>';
  468. div.id = 'tarteaucitronRoot';
  469. body.appendChild(div, body);
  470. div.innerHTML = html;
  471. }
  472. }, 1500);
  473. }
  474. });
  475. });
  476. if(tarteaucitron.events.load) {
  477. tarteaucitron.events.load();
  478. }
  479. },
  480. "addService": function (serviceId) {
  481. "use strict";
  482. var html = '',
  483. s = tarteaucitron.services,
  484. service = s[serviceId],
  485. cookie = tarteaucitron.cookie.read(),
  486. hostname = document.location.hostname,
  487. hostRef = document.referrer.split('/')[2],
  488. isNavigating = (hostRef === hostname && window.location.href !== tarteaucitron.parameters.privacyUrl),
  489. isAutostart = (!service.needConsent),
  490. isWaiting = (cookie.indexOf(service.key + '=wait') >= 0),
  491. isDenied = (cookie.indexOf(service.key + '=false') >= 0),
  492. isAllowed = (cookie.indexOf(service.key + '=true') >= 0),
  493. isResponded = (cookie.indexOf(service.key + '=false') >= 0 || cookie.indexOf(service.key + '=true') >= 0),
  494. isDNTRequested = (navigator.doNotTrack === "1" || navigator.doNotTrack === "yes" || navigator.msDoNotTrack === "1" || window.doNotTrack === "1");
  495. if (tarteaucitron.added[service.key] !== true) {
  496. tarteaucitron.added[service.key] = true;
  497. html += '<li id="' + service.key + 'Line" class="tarteaucitronLine">';
  498. html += ' <div class="tarteaucitronName">';
  499. html += ' <span class="tarteaucitronH3" role="heading" aria-level="3">' + service.name + '</span>';
  500. html += ' <span id="tacCL' + service.key + '" class="tarteaucitronListCookies"></span><br/>';
  501. if (tarteaucitron.parameters.moreInfoLink == true) {
  502. var link = 'https://opt-out.ferank.eu/service/' + service.key + '/';
  503. if (service.readmoreLink !== undefined && service.readmoreLink !== '') {
  504. link = service.readmoreLink;
  505. }
  506. if (tarteaucitron.parameters.readmoreLink !== undefined && tarteaucitron.parameters.readmoreLink !== '') {
  507. link = tarteaucitron.parameters.readmoreLink;
  508. }
  509. html += ' <a href="' + link + '" target="_blank" rel="noreferrer noopener" title="'+ tarteaucitron.lang.cookieDetail + ' ' + service.name + ' ' + tarteaucitron.lang.ourSite + ' ' + tarteaucitron.lang.newWindow +'">';
  510. html += ' ' + tarteaucitron.lang.more;
  511. html += ' </a>';
  512. html += ' - ';
  513. html += ' <a href="' + service.uri + '" target="_blank" rel="noreferrer noopener" title="' + service.name + ' ' + tarteaucitron.lang.newWindow + '">';
  514. html += ' ' + tarteaucitron.lang.source;
  515. html += ' </a>';
  516. }
  517. html += ' </div>';
  518. html += ' <div class="tarteaucitronAsk">';
  519. html += ' <button type="button" id="' + service.key + 'Allowed" class="tarteaucitronAllow" onclick="tarteaucitron.userInterface.respond(this, true);">';
  520. html += ' &#10003; ' + tarteaucitron.lang.allow;
  521. html += ' </button> ';
  522. html += ' <button type="button" id="' + service.key + 'Denied" class="tarteaucitronDeny" onclick="tarteaucitron.userInterface.respond(this, false);">';
  523. html += ' &#10007; ' + tarteaucitron.lang.deny;
  524. html += ' </button>';
  525. html += ' </div>';
  526. html += '</li>';
  527. tarteaucitron.userInterface.css('tarteaucitronServicesTitle_' + service.type, 'display', 'block');
  528. if (document.getElementById('tarteaucitronServices_' + service.type) !== null) {
  529. document.getElementById('tarteaucitronServices_' + service.type).innerHTML += html;
  530. }
  531. tarteaucitron.userInterface.css('tarteaucitronNoServicesTitle', 'display', 'none');
  532. tarteaucitron.userInterface.order(service.type);
  533. }
  534. tarteaucitron.pro('!' + service.key + '=' + isAllowed);
  535. // allow by default for non EU
  536. if (isResponded === false && tarteaucitron.user.bypass === true) {
  537. isAllowed = true;
  538. tarteaucitron.cookie.create(service.key, true);
  539. }
  540. if ((!isResponded && (isAutostart || (isNavigating && isWaiting)) && !tarteaucitron.highPrivacy) || isAllowed) {
  541. if (!isAllowed) {
  542. tarteaucitron.cookie.create(service.key, true);
  543. }
  544. if (tarteaucitron.launch[service.key] !== true) {
  545. tarteaucitron.launch[service.key] = true;
  546. service.js();
  547. tarteaucitron.sendEvent(service.key + '_loaded');
  548. }
  549. tarteaucitron.state[service.key] = true;
  550. tarteaucitron.userInterface.color(service.key, true);
  551. } else if (isDenied) {
  552. if (typeof service.fallback === 'function') {
  553. service.fallback();
  554. }
  555. tarteaucitron.state[service.key] = false;
  556. tarteaucitron.userInterface.color(service.key, false);
  557. } else if (!isResponded && isDNTRequested && tarteaucitron.handleBrowserDNTRequest) {
  558. tarteaucitron.cookie.create(service.key, 'false');
  559. if (typeof service.fallback === 'function') {
  560. service.fallback();
  561. }
  562. tarteaucitron.state[service.key] = false;
  563. tarteaucitron.userInterface.color(service.key, false);
  564. } else if (!isResponded) {
  565. tarteaucitron.cookie.create(service.key, 'wait');
  566. if (typeof service.fallback === 'function') {
  567. service.fallback();
  568. }
  569. tarteaucitron.userInterface.color(service.key, 'wait');
  570. tarteaucitron.userInterface.openAlert();
  571. }
  572. tarteaucitron.cookie.checkCount(service.key);
  573. tarteaucitron.sendEvent(service.key + '_added')
  574. },
  575. "sendEvent" : function(event_key) {
  576. if(event_key !== undefined) {
  577. //ie compatibility
  578. var send_event_item;
  579. if(typeof(Event) === 'function') {
  580. send_event_item = new Event(event_key);
  581. }else{
  582. send_event_item = document.createEvent('Event');
  583. send_event_item.initEvent(event_key, true, true);
  584. }
  585. //end ie compatibility
  586. document.dispatchEvent(send_event_item);
  587. }
  588. },
  589. "cleanArray": function cleanArray(arr) {
  590. "use strict";
  591. var i,
  592. len = arr.length,
  593. out = [],
  594. obj = {},
  595. s = tarteaucitron.services;
  596. for (i = 0; i < len; i += 1) {
  597. if (!obj[arr[i]]) {
  598. obj[arr[i]] = {};
  599. if (tarteaucitron.services[arr[i]] !== undefined) {
  600. out.push(arr[i]);
  601. }
  602. }
  603. }
  604. out = out.sort(function (a, b) {
  605. if (s[a].type + s[a].key > s[b].type + s[b].key) { return 1; }
  606. if (s[a].type + s[a].key < s[b].type + s[b].key) { return -1; }
  607. return 0;
  608. });
  609. return out;
  610. },
  611. "userInterface": {
  612. "css": function (id, property, value) {
  613. "use strict";
  614. if (document.getElementById(id) !== null) {
  615. document.getElementById(id).style[property] = value;
  616. }
  617. },
  618. "addClass": function (id, className) {
  619. "use strict";
  620. if (document.getElementById(id) !== null) {
  621. document.getElementById(id).classList.add(className);
  622. }
  623. },
  624. "removeClass": function (id, className) {
  625. "use strict";
  626. if (document.getElementById(id) !== null) {
  627. document.getElementById(id).classList.remove(className);
  628. }
  629. },
  630. "respondAll": function (status) {
  631. "use strict";
  632. var s = tarteaucitron.services,
  633. service,
  634. key,
  635. index = 0;
  636. for (index = 0; index < tarteaucitron.job.length; index += 1) {
  637. service = s[tarteaucitron.job[index]];
  638. key = service.key;
  639. if (tarteaucitron.state[key] !== status) {
  640. if (status === false && tarteaucitron.launch[key] === true) {
  641. tarteaucitron.reloadThePage = true;
  642. }
  643. if (tarteaucitron.launch[key] !== true && status === true) {
  644. tarteaucitron.pro('!' + key + '=engage');
  645. tarteaucitron.launch[key] = true;
  646. tarteaucitron.services[key].js();
  647. }
  648. tarteaucitron.state[key] = status;
  649. tarteaucitron.cookie.create(key, status);
  650. tarteaucitron.userInterface.color(key, status);
  651. }
  652. }
  653. },
  654. "respond": function (el, status) {
  655. "use strict";
  656. var key = el.id.replace(new RegExp("(Eng[0-9]+|Allow|Deni)ed", "g"), '');
  657. // return if same state
  658. if (tarteaucitron.state[key] === status) {
  659. return;
  660. }
  661. if (status === false && tarteaucitron.launch[key] === true) {
  662. tarteaucitron.reloadThePage = true;
  663. }
  664. // if not already launched... launch the service
  665. if (status === true) {
  666. if (tarteaucitron.launch[key] !== true) {
  667. tarteaucitron.pro('!' + key + '=engage');
  668. tarteaucitron.launch[key] = true;
  669. tarteaucitron.sendEvent(key + '_loaded');
  670. tarteaucitron.services[key].js();
  671. }
  672. }
  673. tarteaucitron.state[key] = status;
  674. tarteaucitron.cookie.create(key, status);
  675. tarteaucitron.userInterface.color(key, status);
  676. },
  677. "color": function (key, status) {
  678. "use strict";
  679. var c = 'tarteaucitron',
  680. nbDenied = 0,
  681. nbPending = 0,
  682. nbAllowed = 0,
  683. sum = tarteaucitron.job.length,
  684. index;
  685. if (status === true) {
  686. document.getElementById(key + 'Line').classList.add('tarteaucitronIsAllowed');
  687. document.getElementById(key + 'Line').classList.remove('tarteaucitronIsDenied');
  688. } else if (status === false) {
  689. document.getElementById(key + 'Line').classList.remove('tarteaucitronIsAllowed');
  690. document.getElementById(key + 'Line').classList.add('tarteaucitronIsDenied');
  691. }
  692. // check if all services are allowed
  693. for (index = 0; index < sum; index += 1) {
  694. if (tarteaucitron.state[tarteaucitron.job[index]] === false) {
  695. nbDenied += 1;
  696. } else if (tarteaucitron.state[tarteaucitron.job[index]] === undefined) {
  697. nbPending += 1;
  698. } else if (tarteaucitron.state[tarteaucitron.job[index]] === true) {
  699. nbAllowed += 1;
  700. }
  701. }
  702. tarteaucitron.userInterface.css(c + 'DotGreen', 'width', ((100 / sum) * nbAllowed) + '%');
  703. tarteaucitron.userInterface.css(c + 'DotYellow', 'width', ((100 / sum) * nbPending) + '%');
  704. tarteaucitron.userInterface.css(c + 'DotRed', 'width', ((100 / sum) * nbDenied) + '%');
  705. if (nbDenied === 0 && nbPending === 0) {
  706. tarteaucitron.userInterface.removeClass(c + 'AllDenied', c + 'IsSelected');
  707. tarteaucitron.userInterface.addClass(c + 'AllAllowed', c + 'IsSelected');
  708. tarteaucitron.userInterface.addClass(c + 'MainLineOffset', c + 'IsAllowed');
  709. tarteaucitron.userInterface.removeClass(c + 'MainLineOffset', c + 'IsDenied');
  710. } else if (nbAllowed === 0 && nbPending === 0) {
  711. tarteaucitron.userInterface.removeClass(c + 'AllAllowed', c + 'IsSelected');
  712. tarteaucitron.userInterface.addClass(c + 'AllDenied', c + 'IsSelected');
  713. tarteaucitron.userInterface.removeClass(c + 'MainLineOffset', c + 'IsAllowed');
  714. tarteaucitron.userInterface.addClass(c + 'MainLineOffset', c + 'IsDenied');
  715. } else {
  716. tarteaucitron.userInterface.removeClass(c + 'AllAllowed', c + 'IsSelected');
  717. tarteaucitron.userInterface.removeClass(c + 'AllDenied', c + 'IsSelected');
  718. tarteaucitron.userInterface.removeClass(c + 'MainLineOffset', c + 'IsAllowed');
  719. tarteaucitron.userInterface.removeClass(c + 'MainLineOffset', c + 'IsDenied');
  720. }
  721. // close the alert if all service have been reviewed
  722. if (nbPending === 0) {
  723. tarteaucitron.userInterface.closeAlert();
  724. }
  725. if (tarteaucitron.services[key].cookies.length > 0 && status === false) {
  726. tarteaucitron.cookie.purge(tarteaucitron.services[key].cookies);
  727. }
  728. if (status === true) {
  729. if (document.getElementById('tacCL' + key) !== null) {
  730. document.getElementById('tacCL' + key).innerHTML = '...';
  731. }
  732. setTimeout(function () {
  733. tarteaucitron.cookie.checkCount(key);
  734. }, 2500);
  735. } else {
  736. tarteaucitron.cookie.checkCount(key);
  737. }
  738. },
  739. "openPanel": function () {
  740. "use strict";
  741. tarteaucitron.userInterface.css('tarteaucitron', 'display', 'block');
  742. tarteaucitron.userInterface.css('tarteaucitronBack', 'display', 'block');
  743. tarteaucitron.userInterface.css('tarteaucitronCookiesListContainer', 'display', 'none');
  744. document.getElementById('tarteaucitronClosePanel').focus();
  745. document.getElementsByTagName('body')[0].classList.add('modal-open');
  746. tarteaucitron.userInterface.focusTrap();
  747. tarteaucitron.userInterface.jsSizing('main');
  748. //ie compatibility
  749. var tacOpenPanelEvent;
  750. if(typeof(Event) === 'function') {
  751. tacOpenPanelEvent = new Event("tac.open_panel");
  752. }else{
  753. tacOpenPanelEvent = document.createEvent('Event');
  754. tacOpenPanelEvent.initEvent("tac.open_panel", true, true);
  755. }
  756. //end ie compatibility
  757. window.dispatchEvent(tacOpenPanelEvent);
  758. },
  759. "closePanel": function () {
  760. "use strict";
  761. if (document.location.hash === tarteaucitron.hashtag) {
  762. if (window.history) {
  763. window.history.replaceState('', document.title, window.location.pathname + window.location.search);
  764. } else {
  765. document.location.hash = '';
  766. }
  767. }
  768. tarteaucitron.userInterface.css('tarteaucitron', 'display', 'none');
  769. tarteaucitron.userInterface.css('tarteaucitronCookiesListContainer', 'display', 'none');
  770. tarteaucitron.fallback(['tarteaucitronInfoBox'], function (elem) {
  771. elem.style.display = 'none';
  772. }, true);
  773. if (tarteaucitron.reloadThePage === true) {
  774. window.location.reload();
  775. } else {
  776. tarteaucitron.userInterface.css('tarteaucitronBack', 'display', 'none');
  777. }
  778. if (document.getElementById('tarteaucitronCloseAlert') !== null) {
  779. document.getElementById('tarteaucitronCloseAlert').focus();
  780. }
  781. document.getElementsByTagName('body')[0].classList.remove('modal-open');
  782. //ie compatibility
  783. var tacClosePanelEvent;
  784. if(typeof(Event) === 'function') {
  785. tacClosePanelEvent = new Event("tac.close_panel");
  786. }else{
  787. tacClosePanelEvent = document.createEvent('Event');
  788. tacClosePanelEvent.initEvent("tac.close_panel", true, true);
  789. }
  790. //end ie compatibility
  791. window.dispatchEvent(tacClosePanelEvent);
  792. },
  793. "focusTrap": function() {
  794. "use strict";
  795. var focusableEls,
  796. firstFocusableEl,
  797. lastFocusableEl,
  798. filtered;
  799. focusableEls = document.getElementById('tarteaucitron').querySelectorAll('a[href], button');
  800. filtered = [];
  801. // get only visible items
  802. for (var i = 0, max = focusableEls.length; i < max; i++) {
  803. if (focusableEls[i].offsetHeight > 0) {
  804. filtered.push(focusableEls[i]);
  805. }
  806. }
  807. firstFocusableEl = filtered[0];
  808. lastFocusableEl = filtered[filtered.length - 1];
  809. //loop focus inside tarteaucitron
  810. document.getElementById('tarteaucitron').addEventListener("keydown", function (evt) {
  811. if ( evt.key === 'Tab' || evt.keyCode === 9 ) {
  812. if ( evt.shiftKey ) /* shift + tab */ {
  813. if (document.activeElement === firstFocusableEl) {
  814. lastFocusableEl.focus();
  815. evt.preventDefault();
  816. }
  817. } else /* tab */ {
  818. if (document.activeElement === lastFocusableEl) {
  819. firstFocusableEl.focus();
  820. evt.preventDefault();
  821. }
  822. }
  823. }
  824. })
  825. },
  826. "openAlert": function () {
  827. "use strict";
  828. var c = 'tarteaucitron';
  829. tarteaucitron.userInterface.css(c + 'Percentage', 'display', 'block');
  830. tarteaucitron.userInterface.css(c + 'AlertSmall', 'display', 'none');
  831. tarteaucitron.userInterface.css(c + 'AlertBig', 'display', 'block');
  832. tarteaucitron.userInterface.addClass(c + 'Root', 'tarteaucitronBeforeVisible');
  833. //ie compatibility
  834. var tacOpenAlertEvent;
  835. if(typeof(Event) === 'function') {
  836. tacOpenAlertEvent = new Event("tac.open_alert");
  837. }else{
  838. tacOpenAlertEvent = document.createEvent('Event');
  839. tacOpenAlertEvent.initEvent("tac.open_alert", true, true);
  840. }
  841. //end ie compatibility
  842. window.dispatchEvent(tacOpenAlertEvent);
  843. },
  844. "closeAlert": function () {
  845. "use strict";
  846. var c = 'tarteaucitron';
  847. tarteaucitron.userInterface.css(c + 'Percentage', 'display', 'none');
  848. tarteaucitron.userInterface.css(c + 'AlertSmall', 'display', 'block');
  849. tarteaucitron.userInterface.css(c + 'AlertBig', 'display', 'none');
  850. tarteaucitron.userInterface.removeClass(c + 'Root', 'tarteaucitronBeforeVisible');
  851. tarteaucitron.userInterface.jsSizing('box');
  852. //ie compatibility
  853. var tacCloseAlertEvent;
  854. if(typeof(Event) === 'function') {
  855. tacCloseAlertEvent = new Event("tac.close_alert");
  856. }else{
  857. tacCloseAlertEvent = document.createEvent('Event');
  858. tacCloseAlertEvent.initEvent("tac.close_alert", true, true);
  859. }
  860. //end ie compatibility
  861. window.dispatchEvent(tacCloseAlertEvent);
  862. },
  863. "toggleCookiesList": function () {
  864. "use strict";
  865. var div = document.getElementById('tarteaucitronCookiesListContainer');
  866. if (div === null) {
  867. return;
  868. }
  869. if (div.style.display !== 'block') {
  870. tarteaucitron.cookie.number();
  871. div.style.display = 'block';
  872. tarteaucitron.userInterface.jsSizing('cookie');
  873. tarteaucitron.userInterface.css('tarteaucitron', 'display', 'none');
  874. tarteaucitron.userInterface.css('tarteaucitronBack', 'display', 'block');
  875. tarteaucitron.fallback(['tarteaucitronInfoBox'], function (elem) {
  876. elem.style.display = 'none';
  877. }, true);
  878. } else {
  879. div.style.display = 'none';
  880. tarteaucitron.userInterface.css('tarteaucitron', 'display', 'none');
  881. tarteaucitron.userInterface.css('tarteaucitronBack', 'display', 'none');
  882. }
  883. },
  884. "toggle": function (id, closeClass) {
  885. "use strict";
  886. var div = document.getElementById(id);
  887. if (div === null) {
  888. return;
  889. }
  890. if (closeClass !== undefined) {
  891. tarteaucitron.fallback([closeClass], function (elem) {
  892. if (elem.id !== id) {
  893. elem.style.display = 'none';
  894. }
  895. }, true);
  896. }
  897. if (div.style.display !== 'block') {
  898. div.style.display = 'block';
  899. } else {
  900. div.style.display = 'none';
  901. }
  902. },
  903. "order": function (id) {
  904. "use strict";
  905. var main = document.getElementById('tarteaucitronServices_' + id),
  906. allDivs,
  907. store = [],
  908. i;
  909. if (main === null) {
  910. return;
  911. }
  912. allDivs = main.childNodes;
  913. if (typeof Array.prototype.map === 'function' && typeof Enumerable === 'undefined') {
  914. Array.prototype.map.call(main.children, Object).sort(function (a, b) {
  915. //var mainChildren = Array.from(main.children);
  916. //mainChildren.sort(function (a, b) {
  917. if (tarteaucitron.services[a.id.replace(/Line/g, '')].name > tarteaucitron.services[b.id.replace(/Line/g, '')].name) { return 1; }
  918. if (tarteaucitron.services[a.id.replace(/Line/g, '')].name < tarteaucitron.services[b.id.replace(/Line/g, '')].name) { return -1; }
  919. return 0;
  920. }).forEach(function (element) {
  921. main.appendChild(element);
  922. });
  923. }
  924. },
  925. "jsSizing": function (type) {
  926. "use strict";
  927. var scrollbarMarginRight = 10,
  928. scrollbarWidthParent,
  929. scrollbarWidthChild,
  930. servicesHeight,
  931. e = window,
  932. a = 'inner',
  933. windowInnerHeight = window.innerHeight || document.documentElement.clientHeight || document.body.clientHeight,
  934. mainTop,
  935. mainHeight,
  936. closeButtonHeight,
  937. headerHeight,
  938. cookiesListHeight,
  939. cookiesCloseHeight,
  940. cookiesTitleHeight,
  941. paddingBox,
  942. alertSmallHeight,
  943. cookiesNumberHeight;
  944. if (type === 'box') {
  945. if (document.getElementById('tarteaucitronAlertSmall') !== null && document.getElementById('tarteaucitronCookiesNumber') !== null) {
  946. // reset
  947. tarteaucitron.userInterface.css('tarteaucitronCookiesNumber', 'padding', '0px 10px');
  948. // calculate
  949. alertSmallHeight = document.getElementById('tarteaucitronAlertSmall').offsetHeight;
  950. cookiesNumberHeight = document.getElementById('tarteaucitronCookiesNumber').offsetHeight;
  951. paddingBox = (alertSmallHeight - cookiesNumberHeight) / 2;
  952. // apply
  953. tarteaucitron.userInterface.css('tarteaucitronCookiesNumber', 'padding', paddingBox + 'px 10px');
  954. }
  955. } else if (type === 'main') {
  956. // get the real window width for media query
  957. if (window.innerWidth === undefined) {
  958. a = 'client';
  959. e = document.documentElement || document.body;
  960. }
  961. // height of the services list container
  962. if (document.getElementById('tarteaucitron') !== null && document.getElementById('tarteaucitronClosePanel') !== null && document.getElementById('tarteaucitronMainLineOffset') !== null) {
  963. // reset
  964. tarteaucitron.userInterface.css('tarteaucitronServices', 'height', 'auto');
  965. // calculate
  966. mainHeight = document.getElementById('tarteaucitron').offsetHeight;
  967. closeButtonHeight = document.getElementById('tarteaucitronClosePanel').offsetHeight;
  968. // apply
  969. servicesHeight = (mainHeight - closeButtonHeight + 2);
  970. tarteaucitron.userInterface.css('tarteaucitronServices', 'height', servicesHeight + 'px');
  971. tarteaucitron.userInterface.css('tarteaucitronServices', 'overflow-x', 'auto');
  972. }
  973. // align the main allow/deny button depending on scrollbar width
  974. if (document.getElementById('tarteaucitronServices') !== null && document.getElementById('tarteaucitronScrollbarChild') !== null) {
  975. // media query
  976. if (e[a + 'Width'] <= 479) {
  977. tarteaucitron.userInterface.css('tarteaucitronScrollbarAdjust', 'marginLeft', '11px');
  978. } else if (e[a + 'Width'] <= 767) {
  979. scrollbarMarginRight = 12;
  980. }
  981. scrollbarWidthParent = document.getElementById('tarteaucitronServices').offsetWidth;
  982. scrollbarWidthChild = document.getElementById('tarteaucitronScrollbarChild').offsetWidth;
  983. tarteaucitron.userInterface.css('tarteaucitronScrollbarAdjust', 'marginRight', ((scrollbarWidthParent - scrollbarWidthChild) + scrollbarMarginRight) + 'px');
  984. }
  985. // center the main panel
  986. if (document.getElementById('tarteaucitron') !== null) {
  987. // media query
  988. if (e[a + 'Width'] <= 767) {
  989. mainTop = 0;
  990. } else {
  991. mainTop = ((windowInnerHeight - document.getElementById('tarteaucitron').offsetHeight) / 2) - 21;
  992. }
  993. if (document.getElementById('tarteaucitronMainLineOffset') !== null) {
  994. if (document.getElementById('tarteaucitron').offsetHeight < (windowInnerHeight / 2)) {
  995. mainTop -= document.getElementById('tarteaucitronMainLineOffset').offsetHeight;
  996. }
  997. }
  998. // correct
  999. if (mainTop < 0) {
  1000. mainTop = 0;
  1001. }
  1002. // apply
  1003. tarteaucitron.userInterface.css('tarteaucitron', 'top', mainTop + 'px');
  1004. }
  1005. } else if (type === 'cookie') {
  1006. // put cookies list at bottom
  1007. if (document.getElementById('tarteaucitronAlertSmall') !== null) {
  1008. tarteaucitron.userInterface.css('tarteaucitronCookiesListContainer', 'bottom', (document.getElementById('tarteaucitronAlertSmall').offsetHeight) + 'px');
  1009. }
  1010. // height of cookies list
  1011. if (document.getElementById('tarteaucitronCookiesListContainer') !== null) {
  1012. // reset
  1013. tarteaucitron.userInterface.css('tarteaucitronCookiesList', 'height', 'auto');
  1014. // calculate
  1015. cookiesListHeight = document.getElementById('tarteaucitronCookiesListContainer').offsetHeight;
  1016. cookiesCloseHeight = document.getElementById('tarteaucitronClosePanelCookie').offsetHeight;
  1017. cookiesTitleHeight = document.getElementById('tarteaucitronCookiesTitle').offsetHeight;
  1018. // apply
  1019. tarteaucitron.userInterface.css('tarteaucitronCookiesList', 'height', (cookiesListHeight - cookiesCloseHeight - cookiesTitleHeight - 2) + 'px');
  1020. }
  1021. }
  1022. }
  1023. },
  1024. "cookie": {
  1025. "owner": {},
  1026. "create": function (key, status) {
  1027. "use strict";
  1028. if (tarteaucitronForceExpire !== '') {
  1029. // The number of day(s)/hour(s) can't be higher than 1 year
  1030. if ((tarteaucitronExpireInDay && tarteaucitronForceExpire < 365) || (!tarteaucitronExpireInDay && tarteaucitronForceExpire < 8760)) {
  1031. if (tarteaucitronExpireInDay) {
  1032. // Multiplication to tranform the number of days to milliseconds
  1033. timeExpire = tarteaucitronForceExpire * 86400000;
  1034. } else {
  1035. // Multiplication to tranform the number of hours to milliseconds
  1036. timeExpire = tarteaucitronForceExpire * 3600000;
  1037. }
  1038. }
  1039. }
  1040. var d = new Date(),
  1041. time = d.getTime(),
  1042. expireTime = time + timeExpire, // 365 days
  1043. regex = new RegExp("!" + key + "=(wait|true|false)", "g"),
  1044. cookie = tarteaucitron.cookie.read().replace(regex, ""),
  1045. value = tarteaucitron.parameters.cookieName + '=' + cookie + '!' + key + '=' + status,
  1046. domain = (tarteaucitron.parameters.cookieDomain !== undefined && tarteaucitron.parameters.cookieDomain !== '') ? 'domain=' + tarteaucitron.parameters.cookieDomain + ';' : '';
  1047. d.setTime(expireTime);
  1048. document.cookie = value + '; expires=' + d.toGMTString() + '; path=/;' + domain;
  1049. },
  1050. "read": function () {
  1051. "use strict";
  1052. var nameEQ = tarteaucitron.parameters.cookieName + "=",
  1053. ca = document.cookie.split(';'),
  1054. i,
  1055. c;
  1056. for (i = 0; i < ca.length; i += 1) {
  1057. c = ca[i];
  1058. while (c.charAt(0) === ' ') {
  1059. c = c.substring(1, c.length);
  1060. }
  1061. if (c.indexOf(nameEQ) === 0) {
  1062. return c.substring(nameEQ.length, c.length);
  1063. }
  1064. }
  1065. return '';
  1066. },
  1067. "purge": function (arr) {
  1068. "use strict";
  1069. var i;
  1070. for (i = 0; i < arr.length; i += 1) {
  1071. document.cookie = arr[i] + '=; expires=Thu, 01 Jan 2000 00:00:00 GMT; path=/;';
  1072. document.cookie = arr[i] + '=; expires=Thu, 01 Jan 2000 00:00:00 GMT; path=/; domain=.' + location.hostname + ';';
  1073. document.cookie = arr[i] + '=; expires=Thu, 01 Jan 2000 00:00:00 GMT; path=/; domain=.' + location.hostname.split('.').slice(-2).join('.') + ';';
  1074. }
  1075. },
  1076. "checkCount": function (key) {
  1077. "use strict";
  1078. var arr = tarteaucitron.services[key].cookies,
  1079. nb = arr.length,
  1080. nbCurrent = 0,
  1081. html = '',
  1082. i,
  1083. status = document.cookie.indexOf(key + '=true');
  1084. if (status >= 0 && nb === 0) {
  1085. html += tarteaucitron.lang.useNoCookie;
  1086. } else if (status >= 0) {
  1087. for (i = 0; i < nb; i += 1) {
  1088. if (document.cookie.indexOf(arr[i] + '=') !== -1) {
  1089. nbCurrent += 1;
  1090. if (tarteaucitron.cookie.owner[arr[i]] === undefined) {
  1091. tarteaucitron.cookie.owner[arr[i]] = [];
  1092. }
  1093. if (tarteaucitron.cookie.crossIndexOf(tarteaucitron.cookie.owner[arr[i]], tarteaucitron.services[key].name) === false) {
  1094. tarteaucitron.cookie.owner[arr[i]].push(tarteaucitron.services[key].name);
  1095. }
  1096. }
  1097. }
  1098. if (nbCurrent > 0) {
  1099. html += tarteaucitron.lang.useCookieCurrent + ' ' + nbCurrent + ' cookie';
  1100. if (nbCurrent > 1) {
  1101. html += 's';
  1102. }
  1103. html += '.';
  1104. } else {
  1105. html += tarteaucitron.lang.useNoCookie;
  1106. }
  1107. } else if (nb === 0) {
  1108. html = tarteaucitron.lang.noCookie;
  1109. } else {
  1110. html += tarteaucitron.lang.useCookie + ' ' + nb + ' cookie';
  1111. if (nb > 1) {
  1112. html += 's';
  1113. }
  1114. html += '.';
  1115. }
  1116. if (document.getElementById('tacCL' + key) !== null) {
  1117. document.getElementById('tacCL' + key).innerHTML = html;
  1118. }
  1119. },
  1120. "crossIndexOf": function (arr, match) {
  1121. "use strict";
  1122. var i;
  1123. for (i = 0; i < arr.length; i += 1) {
  1124. if (arr[i] === match) {
  1125. return true;
  1126. }
  1127. }
  1128. return false;
  1129. },
  1130. "number": function () {
  1131. "use strict";
  1132. var cookies = document.cookie.split(';'),
  1133. nb = (document.cookie !== '') ? cookies.length : 0,
  1134. html = '',
  1135. i,
  1136. name,
  1137. namea,
  1138. nameb,
  1139. c,
  1140. d,
  1141. s = (nb > 1) ? 's' : '',
  1142. savedname,
  1143. regex = /^https?\:\/\/([^\/?#]+)(?:[\/?#]|$)/i,
  1144. regexedDomain = (tarteaucitron.cdn.match(regex) !== null) ? tarteaucitron.cdn.match(regex)[1] : tarteaucitron.cdn,
  1145. host = (tarteaucitron.domain !== undefined) ? tarteaucitron.domain : regexedDomain;
  1146. cookies = cookies.sort(function (a, b) {
  1147. namea = a.split('=', 1).toString().replace(/ /g, '');
  1148. nameb = b.split('=', 1).toString().replace(/ /g, '');
  1149. c = (tarteaucitron.cookie.owner[namea] !== undefined) ? tarteaucitron.cookie.owner[namea] : '0';
  1150. d = (tarteaucitron.cookie.owner[nameb] !== undefined) ? tarteaucitron.cookie.owner[nameb] : '0';
  1151. if (c + a > d + b) { return 1; }
  1152. if (c + a < d + b) { return -1; }
  1153. return 0;
  1154. });
  1155. if (document.cookie !== '') {
  1156. for (i = 0; i < nb; i += 1) {
  1157. name = cookies[i].split('=', 1).toString().replace(/ /g, '');
  1158. if (tarteaucitron.cookie.owner[name] !== undefined && tarteaucitron.cookie.owner[name].join(' // ') !== savedname) {
  1159. savedname = tarteaucitron.cookie.owner[name].join(' // ');
  1160. html += '<div class="tarteaucitronHidden">';
  1161. html += ' <span class="tarteaucitronTitle tarteaucitronH3" role="heading" aria-level="3">';
  1162. html += ' ' + tarteaucitron.cookie.owner[name].join(' // ');
  1163. html += ' </span>';
  1164. html += '</div><ul class="cookie-list">';
  1165. } else if (tarteaucitron.cookie.owner[name] === undefined && host !== savedname) {
  1166. savedname = host;
  1167. html += '<div class="tarteaucitronHidden">';
  1168. html += ' <span class="tarteaucitronTitle tarteaucitronH3" role="heading" aria-level="3">';
  1169. html += ' ' + host;
  1170. html += ' </span>';
  1171. html += '</div><ul class="cookie-list">';
  1172. }
  1173. html += '<li class="tarteaucitronCookiesListMain">';
  1174. 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>';
  1175. html += ' </div>';
  1176. html += ' <div class="tarteaucitronCookiesListRight">' + cookies[i].split('=').slice(1).join('=') + '</div>';
  1177. html += '</li>';
  1178. }
  1179. html += '</ul>';
  1180. } else {
  1181. html += '<div class="tarteaucitronCookiesListMain">';
  1182. html += ' <div class="tarteaucitronCookiesListLeft"><strong>-</strong></div>';
  1183. html += ' <div class="tarteaucitronCookiesListRight"></div>';
  1184. html += '</div>';
  1185. }
  1186. html += '<div class="tarteaucitronHidden" style="height:20px;display:block"></div>';
  1187. if (document.getElementById('tarteaucitronCookiesList') !== null) {
  1188. document.getElementById('tarteaucitronCookiesList').innerHTML = html;
  1189. }
  1190. if (document.getElementById('tarteaucitronCookiesNumber') !== null) {
  1191. document.getElementById('tarteaucitronCookiesNumber').innerHTML = nb;
  1192. }
  1193. if (document.getElementById('tarteaucitronCookiesNumberBis') !== null) {
  1194. document.getElementById('tarteaucitronCookiesNumberBis').innerHTML = nb + ' cookie' + s;
  1195. }
  1196. for (i = 0; i < tarteaucitron.job.length; i += 1) {
  1197. tarteaucitron.cookie.checkCount(tarteaucitron.job[i]);
  1198. }
  1199. }
  1200. },
  1201. "getLanguage": function () {
  1202. "use strict";
  1203. var availableLanguages = 'cs,de,en,es,fr,it,nl,pl,pt,ru,el,ro,bg,ja,cn,da',
  1204. defaultLanguage = 'en';
  1205. if (tarteaucitronForceLanguage !== '') {
  1206. if (availableLanguages.indexOf(tarteaucitronForceLanguage) !== -1) {
  1207. return tarteaucitronForceLanguage;
  1208. }
  1209. }
  1210. if (!navigator) { return 'en'; }
  1211. var lang = navigator.language || navigator.browserLanguage ||
  1212. navigator.systemLanguage || navigator.userLang || null,
  1213. userLanguage = lang ? lang.substr(0, 2) : null;
  1214. if (availableLanguages.indexOf(userLanguage) === -1) {
  1215. return defaultLanguage;
  1216. }
  1217. return userLanguage;
  1218. },
  1219. "getLocale": function () {
  1220. "use strict";
  1221. if (!navigator) { return 'en_US'; }
  1222. var lang = navigator.language || navigator.browserLanguage ||
  1223. navigator.systemLanguage || navigator.userLang || null,
  1224. userLanguage = lang ? lang.substr(0, 2) : null;
  1225. if (userLanguage === 'fr') {
  1226. return 'fr_FR';
  1227. } else if (userLanguage === 'en') {
  1228. return 'en_US';
  1229. } else if (userLanguage === 'de') {
  1230. return 'de_DE';
  1231. } else if (userLanguage === 'es') {
  1232. return 'es_ES';
  1233. } else if (userLanguage === 'it') {
  1234. return 'it_IT';
  1235. } else if (userLanguage === 'pt') {
  1236. return 'pt_PT';
  1237. } else if (userLanguage === 'nl') {
  1238. return 'nl_NL';
  1239. } else if (userLanguage === 'el') {
  1240. return 'el_EL';
  1241. } else {
  1242. return 'en_US';
  1243. }
  1244. },
  1245. "addScript": function (url, id, callback, execute, attrName, attrVal) {
  1246. "use strict";
  1247. var script,
  1248. done = false;
  1249. if (execute === false) {
  1250. if (typeof callback === 'function') {
  1251. callback();
  1252. }
  1253. } else {
  1254. script = document.createElement('script');
  1255. script.type = 'text/javascript';
  1256. script.id = (id !== undefined) ? id : '';
  1257. script.async = true;
  1258. script.src = url;
  1259. if (attrName !== undefined && attrVal !== undefined) {
  1260. script.setAttribute(attrName, attrVal);
  1261. }
  1262. if (typeof callback === 'function') {
  1263. if ( !tarteaucitron.parameters.useExternalJs ) {
  1264. script.onreadystatechange = script.onload = function () {
  1265. var state = script.readyState;
  1266. if (!done && (!state || /loaded|complete/.test(state))) {
  1267. done = true;
  1268. callback();
  1269. }
  1270. };
  1271. } else {
  1272. callback();
  1273. }
  1274. }
  1275. if ( !tarteaucitron.parameters.useExternalJs ) {
  1276. document.getElementsByTagName('head')[0].appendChild(script);
  1277. }
  1278. }
  1279. },
  1280. "makeAsync": {
  1281. "antiGhost": 0,
  1282. "buffer": '',
  1283. "init": function (url, id) {
  1284. "use strict";
  1285. var savedWrite = document.write,
  1286. savedWriteln = document.writeln;
  1287. document.write = function (content) {
  1288. tarteaucitron.makeAsync.buffer += content;
  1289. };
  1290. document.writeln = function (content) {
  1291. tarteaucitron.makeAsync.buffer += content.concat("\n");
  1292. };
  1293. setTimeout(function () {
  1294. document.write = savedWrite;
  1295. document.writeln = savedWriteln;
  1296. }, 20000);
  1297. tarteaucitron.makeAsync.getAndParse(url, id);
  1298. },
  1299. "getAndParse": function (url, id) {
  1300. "use strict";
  1301. if (tarteaucitron.makeAsync.antiGhost > 9) {
  1302. tarteaucitron.makeAsync.antiGhost = 0;
  1303. return;
  1304. }
  1305. tarteaucitron.makeAsync.antiGhost += 1;
  1306. tarteaucitron.addScript(url, '', function () {
  1307. if (document.getElementById(id) !== null) {
  1308. document.getElementById(id).innerHTML += "<span style='display:none'>&nbsp;</span>" + tarteaucitron.makeAsync.buffer;
  1309. tarteaucitron.makeAsync.buffer = '';
  1310. tarteaucitron.makeAsync.execJS(id);
  1311. }
  1312. });
  1313. },
  1314. "execJS": function (id) {
  1315. /* not strict because third party scripts may have errors */
  1316. var i,
  1317. scripts,
  1318. childId,
  1319. type;
  1320. if (document.getElementById(id) === null) {
  1321. return;
  1322. }
  1323. scripts = document.getElementById(id).getElementsByTagName('script');
  1324. for (i = 0; i < scripts.length; i += 1) {
  1325. type = (scripts[i].getAttribute('type') !== null) ? scripts[i].getAttribute('type') : '';
  1326. if (type === '') {
  1327. type = (scripts[i].getAttribute('language') !== null) ? scripts[i].getAttribute('language') : '';
  1328. }
  1329. if (scripts[i].getAttribute('src') !== null && scripts[i].getAttribute('src') !== '') {
  1330. childId = id + Math.floor(Math.random() * 99999999999);
  1331. document.getElementById(id).innerHTML += '<div id="' + childId + '"></div>';
  1332. tarteaucitron.makeAsync.getAndParse(scripts[i].getAttribute('src'), childId);
  1333. } else if (type.indexOf('javascript') !== -1 || type === '') {
  1334. eval(scripts[i].innerHTML);
  1335. }
  1336. }
  1337. }
  1338. },
  1339. "fallback": function (matchClass, content, noInner) {
  1340. "use strict";
  1341. var elems = document.getElementsByTagName('*'),
  1342. i,
  1343. index = 0;
  1344. for (i in elems) {
  1345. if (elems[i] !== undefined) {
  1346. for (index = 0; index < matchClass.length; index += 1) {
  1347. if ((' ' + elems[i].className + ' ')
  1348. .indexOf(' ' + matchClass[index] + ' ') > -1) {
  1349. if (typeof content === 'function') {
  1350. if (noInner === true) {
  1351. content(elems[i]);
  1352. } else {
  1353. elems[i].innerHTML = content(elems[i]);
  1354. }
  1355. } else {
  1356. elems[i].innerHTML = content;
  1357. }
  1358. }
  1359. }
  1360. }
  1361. }
  1362. },
  1363. "engage": function (id) {
  1364. "use strict";
  1365. var html = '',
  1366. r = Math.floor(Math.random() * 100000),
  1367. engage = tarteaucitron.services[id].name + ' ' + tarteaucitron.lang.fallback;
  1368. if (tarteaucitron.lang['engage-' + id] !== undefined) {
  1369. engage = tarteaucitron.lang['engage-' + id];
  1370. }
  1371. html += '<div class="tac_activate">';
  1372. html += ' <div class="tac_float">';
  1373. html += ' ' + engage;
  1374. html += ' <button type="button" class="tarteaucitronAllow" id="Eng' + r + 'ed' + id + '" onclick="tarteaucitron.userInterface.respond(this, true);">';
  1375. html += ' &#10003; ' + tarteaucitron.lang.allow;
  1376. html += ' </button>';
  1377. html += ' </div>';
  1378. html += '</div>';
  1379. return html;
  1380. },
  1381. "extend": function (a, b) {
  1382. "use strict";
  1383. var prop;
  1384. for (prop in b) {
  1385. if (b.hasOwnProperty(prop)) {
  1386. a[prop] = b[prop];
  1387. }
  1388. }
  1389. },
  1390. "proTemp": '',
  1391. "proTimer": function () {
  1392. "use strict";
  1393. setTimeout(tarteaucitron.proPing, 500);
  1394. },
  1395. "pro": function (list) {
  1396. "use strict";
  1397. tarteaucitron.proTemp += list;
  1398. clearTimeout(tarteaucitron.proTimer);
  1399. tarteaucitron.proTimer = setTimeout(tarteaucitron.proPing, 500);
  1400. },
  1401. "proPing": function () {
  1402. "use strict";
  1403. if (tarteaucitron.uuid !== '' && tarteaucitron.uuid !== undefined && tarteaucitron.proTemp !== '') {
  1404. var div = document.getElementById('tarteaucitronPremium'),
  1405. timestamp = new Date().getTime(),
  1406. url = 'https://opt-out.ferank.eu/log/?';
  1407. if (div === null) {
  1408. return;
  1409. }
  1410. url += 'account=' + tarteaucitron.uuid + '&';
  1411. url += 'domain=' + tarteaucitron.domain + '&';
  1412. url += 'status=' + encodeURIComponent(tarteaucitron.proTemp) + '&';
  1413. url += '_time=' + timestamp;
  1414. div.innerHTML = '<img src="' + url + '" style="display:none" />';
  1415. tarteaucitron.proTemp = '';
  1416. }
  1417. tarteaucitron.cookie.number();
  1418. },
  1419. "AddOrUpdate" : function(source, custom){
  1420. /**
  1421. Utility function to Add or update the fields of obj1 with the ones in obj2
  1422. */
  1423. for(key in custom){
  1424. if(custom[key] instanceof Object){
  1425. source[key] = tarteaucitron.AddOrUpdate(source[key], custom[key]);
  1426. }else{
  1427. source[key] = custom[key];
  1428. }
  1429. }
  1430. return source;
  1431. },
  1432. "getElemWidth": function(elem) {
  1433. return elem.getAttribute('width') || elem.clientWidth;
  1434. },
  1435. "getElemHeight": function(elem) {
  1436. return elem.getAttribute('height') || elem.clientHeight;
  1437. }
  1438. };