tarteaucitron.js 75 KB

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