tarteaucitron.js 75 KB

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