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