tarteaucitron.js 74 KB

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