tarteaucitron.js 76 KB

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