tarteaucitron.js 75 KB

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