1var tnAdBlock = false; 2//adblock detection:start 3var ADS_URL = 'https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js'; 4 5function checkAdsBlocked(callback) { 6 var xhr = new XMLHttpRequest(); 7 xhr.onreadystatechange = function () { 8 if (xhr.readyState == XMLHttpRequest.DONE) { 9 callback(xhr.status === 0 || xhr.responseURL !== ADS_URL); 10 } 11 }; 12 xhr.open('HEAD', ADS_URL, true); 13 xhr.send(null); 14} 15checkAdsBlocked(function(adsBlocked) { 16 tnAdBlock = adsBlocked; 17}); 18//adblock detection:end 19 20 21 if (typeof tn_custom_variables === 'undefined') { 22 var tn_custom_variables = {}; 23 } 24 25 26 let user_role = "anonymous"; 27 let user_zip = ''; 28 var checknc = getCookie('SESSchecknc'); 29 var currentUrl = document.URL; 30 31 function getCookie(name){ 32 var re = new RegExp(name + "=([^;]+)"); 33 var value = re.exec(document.cookie); 34 return (value != null) ? unescape(value[1]) : null; 35 } 36 var Base64={_keyStr:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",encode:function(e){var t="";var n,r,i,s,o,u,a;var f=0;e=Base64._utf8_encode(e);while(f<e.length){n=e.charCodeAt(f++);r=e.charCodeAt(f++);i=e.charCodeAt(f++);s=n>>2;o=(n&3)<<4|r>>4;u=(r&15)<<2|i>>6;a=i&63;if(isNaN(r)){u=a=64}else if(isNaN(i)){a=64}t=t+this._keyStr.charAt(s)+this._keyStr.charAt(o)+this._keyStr.charAt(u)+this._keyStr.charAt(a)}return t},decode:function(e){var t="";var n,r,i;var s,o,u,a;var f=0;e=e.replace(/[^A-Za-z0-9+/=]/g,"");while(f<e.length){s=this._keyStr.indexOf(e.charAt(f++));o=this._keyStr.indexOf(e.charAt(f++));u=this._keyStr.indexOf(e.charAt(f++));a=this._keyStr.indexOf(e.charAt(f++));n=s<<2|o>>4;r=(o&15)<<4|u>>2;i=(u&3)<<6|a;t=t+String.fromCharCode(n);if(u!=64){t=t+String.fromCharCode(r)}if(a!=64){t=t+String.fromCharCode(i)}}t=Base64._utf8_decode(t);return t},_utf8_encode:function(e){e=e.replace(/rn/g,"n");var t="";for(var n=0;n<e.length;n++){var r=e.charCodeAt(n);if(r<128){t+=String.fromCharCode(r)}else if(r>127&&r<2048){t+=String.fromCharCode(r>>6|192);t+=String.fromCharCode(r&63|128)}else{t+=String.fromCharCode(r>>12|224);t+=String.fromCharCode(r>>6&63|128);t+=String.fromCharCode(r&63|128)}}return t},_utf8_decode:function(e){var t="";var n=0;var r=c1=c2=0;while(n<e.length){r=e.charCodeAt(n);if(r<128){t+=String.fromCharCode(r);n++}else if(r>191&&r<224){c2=e.charCodeAt(n+1);t+=String.fromCharCode((r&31)<<6|c2&63);n+=2}else{c2=e.charCodeAt(n+1);c3=e.charCodeAt(n+2);t+=String.fromCharCode((r&15)<<12|(c2&63)<<6|c3&63);n+=3}}return t}}; 37 var global_vars = {site_url:'https://www.thenation.com',login_text:'Log In',login_url:'https://www.thenation.com/login/',admin_link:'https://www.thenation.com/wp-admin/', dash_link: 'https://www.thenation.com/dashboard'}; 38 var user_name_cookie = getCookie('SESSname'); 39 var admin_name_cookie = getCookie('SESSadminname'); 40 var is_admin_cookie = getCookie('is_admin'); 41 42 if (is_admin_cookie == "true") { 43 var check_user_logged_in = 1; 44 } else { 45 var check_user_logged_in = user_name_cookie; 46 } 47 48 if(check_user_logged_in != null){ 49 50 var check_user_info = getCookie('SESSuserinfo'); 51 52 if (check_user_info != null) { 53 check_user_info = Base64.decode(check_user_info); 54 check_user_info = JSON.parse(check_user_info); 55 var user_roles = check_user_info.roles; 56 user_zip = check_user_info.zip; 57 58 if (user_roles.includes('subscriber') && null == getCookie('SESSsus_user')) { 59 user_role = "subscriber"; 60 } 61 62 if (user_roles.includes('nation_user') && null == getCookie('SESSexpireduser')) { 63 user_role = "nation_user"; 64 } 65 66 if ((user_roles.includes('subscriber') || user_roles.includes('nation_user')) && null != getCookie('SESSsus_user')) { 67 user_role = "suspended_user"; 68 } 69 70 if (user_roles.includes('nation_user') && null != getCookie('SESSexpireduser')) { 71 user_role = "expired_user"; 72 } 73 74 if (user_roles.includes('nation_user') && null != getCookie('SESSfree_user')) { 75 user_role = "free_user"; 76 } 77 if (user_roles.includes('staff_subscriber') && null != getCookie('SESSstaff_sub_user')) { 78 user_role = "staff_subscriber"; 79 } 80 81 if (user_roles.includes('premium_subscriber')) { 82 user_role = "premium_subscriber"; 83 } 84 } else { 85 user_role = "cms_user"; 86 } 87 88 } 89 //paywall counter 90 let hard_paywall = false;
91 let unique_IDs = []; 92 let tn_free_articles = []; 93 let total_pageviews = 0; 94 let cookie_suffix = (user_role == "anonymous")?"anon":"reg"; 95 let paywall_cookie = "article_counter_"+cookie_suffix; 96 let paywall_cookie_expiry = null; 97 const paywall_cookie_data = getCookie(paywall_cookie); 98 if(paywall_cookie_data) { 99 const parsed_pcd = JSON.parse(paywall_cookie_data); 100 unique_IDs = parsed_pcd.unique_IDs; 101 tn_free_articles = [...unique_IDs]; 102 total_pageviews = parsed_pcd.total; 103 paywall_cookie_expiry = parsed_pcd.expiry; 104 } 105 //push pageviews if article 106 if(tnContentSection == "article"){ 107 if(unique_IDs.indexOf(tnPostID) === -1) unique_IDs.push(tnPostID); 108 total_pageviews += 1; 109 setPaywallCookie(unique_IDs, total_pageviews, paywall_cookie_expiry, null, null, paywall_cookie); 110 } 111 112 113 114 115function getLightboxCookie(name) { 116 const cookieString = document.cookie; 117 const cookies = cookieString.split("; "); 118 for (let cookie of cookies) { 119 const [key, value] = cookie.split("="); 120 if (key === name) { 121 return value; 122 } 123 } 124 return null; 125} 126 127function tnDebounce(fn, wait = 100) { 128 let timer = null; 129 return function(...args) { 130 clearTimeout(timer); 131 timer = setTimeout(() => fn.apply(this, args), wait); 132 }; 133} 134 135function unitToMilliseconds(unit) { 136 switch (unit) { 137 case 'seconds': 138 return 1000; // 1 second = 1000 ms 139 case 'minutes': 140 return 60 * 1000; // 1 minute = 60 seconds 141 case 'hours': 142 return 60 * 60 * 1000; // 1 hour = 60 minutes 143 case 'days': 144 return 24 * 60 * 60 * 1000; // 1 day = 24 hours 145 case 'weeks': 146 return 7 * 24 * 60 * 60 * 1000; // ..1 Week = 7 days 147 case 'months': 148 // Assume 1 month = 30 days 149 return 30 * 24 * 60 * 60 * 1000; 150 case 'years': 151 // Assume 1 year = 365 days 152 return 365 * 24 * 60 * 60 * 1000; 153 default: 154 return 0; 155 } 156} 157 158function getClientInfo() { 159 const userAgent = navigator.userAgent.toLowerCase(); 160 const platform = navigator.platform.toLowerCase(); 161 162 // Device Type 163 let deviceType = "Desktop"; 164 if (/android/.test(userAgent) || /iphone|ipad|ipod/.test(userAgent) || /blackberry|iemobile|opera mini/.test(userAgent)) { 165 deviceType = /ipad/.test(userAgent) ? "Tablet" : "Mobile"; 166 } 167 168 // Operating System 169 let os = "Other Systems"; 170 if (platform.includes('win')) os = "Windows"; 171 if (platform.includes('mac')) os = "Mac"; 172 if (platform.includes('linux')) os = "Linux"; 173 if (/iphone|ipad|ipod|ios/.test(userAgent)) os = "iOS"; 174 if (/android/.test(userAgent)) os = "Android"; 175 176 // Browser 177 let browser = "Other browser"; 178 if (/chrome|crios/.test(userAgent) && !/edg|opr/.test(userAgent)) browser = "Chrome"; 179 else if (/safari/.test(userAgent) && !/chrome/.test(userAgent)) browser = "Safari"; 180 else if (/firefox/.test(userAgent)) browser = "Firefox"; 181 else if (/msie|trident/.test(userAgent)) browser = "IE"; 182 else if (/edg/.test(userAgent)) browser = "Edge"; 183 else if (/opera|opr/.test(userAgent)) browser = "Opera"; 184 185 return { deviceType, os, browser }; 186} 187 188function getUrlParams() { 189 const params = {}; 190 const queryString = window.location.search; 191 const urlParams = new URLSearchParams(queryString); 192 for (const [key, value] of urlParams.entries()) { 193 params[key] = value; 194 } 195 return params; 196} 197 198const cdevice = getClientInfo().deviceType.toLowerCase(); //'Desktop', 'Mobile', 'Tablet' 199const cos = getClientInfo().os.toLowerCase(); //'Windows', 'Mac', 'Linux', 'iOS', 'Android', 'Other systems' 200const cbrowser = getClientInfo().browser.toLowerCase(); //'Chrome', 'Safari', 'Firefox', 'IE', 'Edge', 'Opera', 'Other browser' 201 202 203function sendActivityLog({ 204 experienceId, 205 templateId, 206 segmentId, 207 clickCount, 208 closeCount, 209 pageviewCount 210}) { 211 const endpoint = 'https://prod-paywall.thenation.com/api/activity-logs/store-activityLog'; 212 213 const payload = { 214 experience_id: experienceId, 215 template_id: templateId, 216 segment_id: segmentId, 217 click_count: clickCount, 218 close_count: closeCount, 219 impression_count: pageviewCount, 220 page_url: tnPostURL, 221 browser_name: cbrowser, 222 }; 223 224 fetch(endpoint, { 225 method: 'POST', 226 headers: { 'Content-Type': 'application/json' }, 227 body: JSON.stringify(payload), 228 }) 229 .then(response => { 230 console.log('Activity-log sent, status:', response.status); 231 }) 232 .catch(error => { 233 // optional: log errors 234 console.error('Activity-log error:', error); 235 }); 236 237} 238 239function registerInteractions(config, d) { 240 config.forEach(({ element: selector, listen_once, event_listeners }) => { 241 const el = document.querySelector(selector); 242 if (!el) { 243 console.warn(`No element matches selector "${selector}"`); 244 return; 245 } 246
247 event_listeners.forEach(eventName => { 248 if(eventName == "rightclick") eventName = "contextmenu"; 249 el.addEventListener( 250 eventName, 251 event => { 252 callLightboxFunc(d); 253 }, 254 { once: listen_once } 255 ); 256 }); 257 }); 258} 259 260function setPaywallCookie(uniqueIDs, totalPageviews, expiryUTC, expiryValue, expiryUnit, name){ 261 let cookie_json = {}; 262uniqueIDs = uniqueIDs.slice(-20); //to keep cookie size under control 263 if(!expiryUTC && expiryValue){ 264 const unit = expiryUnit.toLowerCase(); 265 const factor = unitToMilliseconds(unit); 266 267 if (factor) { 268 const date = new Date(); 269 date.setTime(date.getTime() + expiryValue * factor); 270 expiryUTC = date.toUTCString(); 271 } 272 } 273 cookie_json = { 274 unique_IDs: uniqueIDs, 275 total: totalPageviews, 276 expiry: expiryUTC 277 }; 278 279 let cookieStr = `${name}=${JSON.stringify(cookie_json)}; path=/`; 280 cookieStr += (expiryUTC)?`; expires=${expiryUTC}`:''; 281 document.cookie = cookieStr; 282 } 283 284function callLightboxFunc(d){ 285 286let delay_value = d.delay_value; 287let delay_type = d.delay_type; 288 289 if(delay_type == "scroll_depth_px" || delay_type == "scroll_depth_percent") 290 { 291 function handleScroll() { 292 if (delay_type === "scroll_depth_percent") { 293 const percentscroll = delay_value / 100; 294 const scrollTop = window.pageYOffset || document.documentElement.scrollTop; 295 const docHeight = document.documentElement.scrollHeight - document.documentElement.clientHeight; 296 const scrolled = scrollTop / docHeight; 297 298 if (scrolled >= percentscroll) { 299 showLightbox(d); 300 window.removeEventListener("scroll", handleScroll); 301 } 302 } 303 else { 304 const scrollTop = window.pageYOffset || document.documentElement.scrollTop; 305 306 if (scrollTop >= delay_value) { 307 showLightbox(d); 308 window.removeEventListener("scroll", handleScroll); 309 } 310} 311} 312 313 314 window.addEventListener("scroll", handleScroll); 315 } 316 else if(delay_type == "time") 317 { 318 setTimeout(function(){ showLightbox(d); }, delay_value*1000); //time in seconds 319 } 320 else if(delay_type == "idle") 321 { 322 let idleTimer; //variable to hold the timer ID 323 324 function resetIdleTimer() { 325 //clear the previous timer if any 326 clearTimeout(idleTimer); 327 328 idleTimer = setTimeout(() => { 329 showLightbox(d); 330 }, delay_value*1000); 331 } 332 333 const activityEvents = [ 334 'mousemove', 335 'keydown', 336 'scroll', 337 'touchstart' 338 ]; 339 340 activityEvents.forEach(event => { 341 document.addEventListener(event, resetIdleTimer, false); 342 }); 343 344 resetIdleTimer(); 345 } 346 else showLightbox(d); 347} 348 349function showLightbox(d) { 350 351 //skip the lightbox if one is already being shown 352if (document.querySelector('.lightbox-container') && d.display_type == "modal") { 353 return; 354 } 355 356 const uniqueID = "e"+d.eid+"s"+d.sid+"t"+d.tid; 357 const inlineString = (d.display_type == "inline")?"-inline-":'-'; 358for (const cookie of d.cookies) { 359 360 let cookieStr = `${cookie.name}=${cookie.value}; path=${cookie.path}`; 361 362 if (cookie.domain) { 363 cookieStr += `; domain=${cookie.domain}`; 364 } 365 366 if (!cookie.sessionCookie && cookie.expiration && cookie.expirationUnit) { 367 const unit = cookie.expirationUnit.toLowerCase(); 368 const factor = unitToMilliseconds(unit); 369 370 if (factor) { 371 const date = new Date(); 372 date.setTime(date.getTime() + cookie.expiration * factor); 373 cookieStr += `; expires=${date.toUTCString()}`; 374 } 375 } 376 377 document.cookie = cookieStr; 378 379} 380 381 if (d.js) { 382 if (d.js.trim()) { 383 try { 384 const script1 = document.createElement('script'); 385 script1.textContent = d.js; 386 document.body.appendChild(script1); 387 } catch (e) { 388 console.error("Error executing Run JS code:", e); 389 } 390 } 391 } 392 393 if(!d.html) return; 394 const overlay = document.createElement('div'); 395 overlay.id = 'lightbox-container-'+uniqueID; 396 overlay.classList.add('tn-lightbox', 'lightbox'+inlineString+'container'); 397 const modal = document.createElement('div'); 398 modal.id = 'lightbox-inner-'+uniqueID; 399 modal.classList.add('lightbox'+inlineString+'inner'); 400 const closeButton = (d.allow_close)?'<button type="button" aria-label="Close" class="close-btn lb-close-button"></button>':''; 401 modal.innerHTML = closeButton+d.html; 402 403 if (d.css) { 404 const styleEl = document.createElement('style'); 405 styleEl.type = 'text/css'; 406 styleEl.textContent = d.css; 407 modal.appendChild(styleEl); 408 } 409 410 const customScripts = modal.querySelectorAll('[custom-script]');
411 customScripts.forEach(scriptContainer => { 412 const code = scriptContainer.textContent; 413 if (code.trim()) { 414 try { 415 // Execute the code in the global context 416 const script2 = document.createElement('script'); 417 script2.textContent = code; 418 overlay.appendChild(script2); 419 420 } catch (e) { 421 console.error("Error executing custom script:", e); 422 } 423 } 424 scriptContainer.remove(); 425 }); 426 427 overlay.appendChild(modal); 428 if(d.display_type == "modal") 429 document.body.appendChild(overlay); 430 else { 431 const inline_container = document.querySelector(d.inline_container_selector); 432 433 if (inline_container) { 434 inline_container.appendChild(overlay); 435 } else { 436 console.error(`No element found matching the selector: ${d.inline_container_selector}`); 437 } 438 } 439 440 sendActivityLog({ 441 experienceId: d.eid, 442 templateId: d.tid, 443 segmentId: d.sid, 444 clickCount: 0, 445 closeCount: 0, 446 pageviewCount: 1 447 }); 448 449 450 451 const experience_cookie = "lightbox_not_first_visit"; 452 const experience_cookie_date = new Date(); 453 experience_cookie_date.setTime(experience_cookie_date.getTime() + (30 * 24 * 60 * 60 * 1000)); // 30 days from now 454document.cookie = experience_cookie+"=true;" + "expires=" + experience_cookie_date.toUTCString() + ";path=/"; 455 456 457 458 459 460 461var lightboxContainer = document.getElementById(overlay.id); 462var clickableElements = lightboxContainer.querySelectorAll('a, button:not(.close-btn)'); 463 clickableElements.forEach(function(element) { 464 element.addEventListener('click', function(event) { 465 //log click count 466 sendActivityLog({ 467 experienceId: d.eid, 468 templateId: d.tid, 469 segmentId: d.sid, 470 clickCount: 1, 471 closeCount: 0, 472 pageviewCount: 0 473 }); 474 }); 475 }); 476 // Define a global close() function that removes the modal overlay 477 function close_popup() { 478 if (overlay.parentNode) { 479 overlay.parentNode.removeChild(overlay); 480 //log close count 481 sendActivityLog({ 482 experienceId: d.eid, 483 templateId: d.tid, 484 segmentId: d.sid, 485 clickCount: 0, 486 closeCount: 1, 487 pageviewCount: 0 488 }); 489 } 490 491 } 492 493 494 var closeButtonBinder = lightboxContainer.getElementsByClassName("close-btn"); 495 496 Array.prototype.forEach.call(closeButtonBinder, function(element) { 497 element.addEventListener('click', () => { 498 close_popup(); 499 }); 500 }); 501 502} 503 504 const url = 'https://prod-paywall.thenation.com/api/fetch-experience/'; 505 function isPrebidAvailable () { 506 return ( 507 window.pbjs && 508 typeof window.pbjs.requestBids === 'function' && 509 window.pbjs.libLoaded === true 510 ); 511} 512let adblockerValue = (!isPrebidAvailable())?'adblockers_enabled':'no_adblockers'; 513 514 515const data = { 516 content_section: tnContentSection, 517 content_author: window.tnContentAuthor, 518 user_type: user_role, 519 url: tnPostURL, 520 tags: window.tnContentTags, 521 url_parameters: getUrlParams(), 522 target_devices: cdevice, 523 target_os: cos, 524 target_browsers: cbrowser, 525 postal_code: user_zip, 526 referred_from: document.referrer, 527 adblockers: adblockerValue, 528 utc_time: new Date().toISOString(), 529 custom_variables: tn_custom_variables, 530 total_pageviews: total_pageviews, 531 //unique_pageviews: unique_IDs.length, 532 unique_pageviews: 1, 533 environment: "production" 534}; 535 536fetch(url, { 537 method: 'POST', 538 headers: { 539 'x-api-token': '54SBvkcDGvrvLs5ANeHrknVHJyJdhDFppGa8YaUH', 540 'x-private-key': '40RWGQuu3eVH8Qzp9y4sFH9emknixpXk9zRRHXtp', 541 'Content-Type': 'application/json' 542 }, 543 body: JSON.stringify(data) 544}) 545.then(response => response.json()) 546.then(items => { 547 items.forEach(data => { 548 const experience_id = data.experience_id; 549 const segment_id = data.matched_segment_id; 550 const template_id = data.template_id; 551 const exp_temp = data?.experience_template; 552 const interactions = (data?.interactions?.interactions !== undefined)?data.interactions.interactions:false; 553 const html = (data?.experience_template?.html !== undefined)?JSON.parse(JSON.stringify(data.experience_template.html)):''; 554 const css = (data?.experience_template?.css !== undefined)?JSON.parse(JSON.stringify(data.experience_template.css)):''; 555 const js = (data?.javascript_code !== undefined)?JSON.parse(JSON.stringify(data.javascript_code)):''; 556 const delay_type = (exp_temp)?data.experience_template.delay_type:''; 557 const delay_value = (exp_temp)?data.experience_template.delay_value:''; 558 const cookies = data?.cookies; 559 const on_first_visit = data?.on_first_visit; 560 const desktop_exit_side = (data?.viewport_exit_settings)?data.viewport_exit_settings.desktop_exit_side:false; 561 const mobile_back_button_enabled = (data?.viewport_exit_settings)?data.viewport_exit_settings.mobile_back_button_enabled:false; 562 const allow_close = (exp_temp)?data.experience_template.allow_close:false; 563 const display_type = (exp_temp)?data.experience_template.display_type:false; 564 const inline_container_selector = (exp_temp)?data.experience_template.inline_container_selector:false; 565 const custom_cookies = data?.custom_cookies; 566 567 const experience_cookie = "lightbox_not_first_visit"; 568 let viewLightbox = true; 569
570 //if on first visit is true, check for cookie 571 if(on_first_visit && getCookie(experience_cookie)) return; 572 573 //check custom cookie conditions 574 if(custom_cookies){ 575 function cookieConditions() { 576 for (const { name, value: values, condition } of custom_cookies) { 577 const cookieVal = getCookie(name); 578 switch (condition) { 579 case 'equals_one_of': 580 if (!values.includes(cookieVal)) { 581 return false; 582 } 583 break; 584 case 'does_not_equal': 585 if (values.includes(cookieVal)) { 586 return false; 587 } 588 break; 589 default: 590 return false; 591 } 592 } 593 // All conditions passed 594 return true; 595} 596if(!cookieConditions()) return; //cookie conditions did not match 597 598 } 599 600 601 602 if(data?.page_view_meter && tnContentSection == "article"){ 603 604 const page_view_meter = data.page_view_meter; 605 606 //skip if referrer domain matches 607 if(page_view_meter.excluded_referral_sites && document.referrer){ 608 const refHost = new URL(document.referrer).hostname.toLowerCase(); 609 610 const isExcluded = page_view_meter.excluded_referral_sites.some(domain => { 611 domain = domain.toLowerCase(); 612 return ( 613 refHost === domain || 614 refHost.endsWith(`.${domain}`) 615 ); 616 }); 617 618 if (isExcluded) { 619 unique_IDs.pop(); 620 total_pageviews -= 1; 621 setPaywallCookie(unique_IDs, total_pageviews, paywall_cookie_expiry, null, null, paywall_cookie) 622 return; 623 } 624 } 625 626 hard_paywall = (page_view_meter.meter_unique_pages_only && unique_IDs.length > page_view_meter.expire_after_value)?true:((!page_view_meter.meter_unique_pages_only && total_pageviews > page_view_meter.expire_after_value)?true:false); 627 if(!hard_paywall){ 628 629 if(page_view_meter.reset_after_checkbox && !paywall_cookie_expiry){ 630 setPaywallCookie(unique_IDs, total_pageviews, paywall_cookie_expiry, page_view_meter.reset_after_value, page_view_meter.reset_after_unit, paywall_cookie) 631 } 632 633 } 634 else { 635 if(tn_free_articles.includes(tnPostID)) return; 636 unique_IDs.pop(); 637 total_pageviews -= 1; 638 setPaywallCookie(unique_IDs, total_pageviews, paywall_cookie_expiry, null, null, paywall_cookie) 639 } 640} 641 642 if(viewLightbox) 643 { 644 645 let eid = experience_id; 646 let sid = segment_id; 647 let tid = template_id; 648 const lightboxParams = { 649 eid, 650 sid, 651 tid, 652 html, 653 css, 654 js, 655 cookies, 656 allow_close, 657 display_type, 658 inline_container_selector, 659 delay_type, 660 delay_value 661 }; 662 663 664 665 if(desktop_exit_side && cdevice == "desktop") { 666 667 if(desktop_exit_side == "top_side"){ 668 669 670 function onMouseOutTopSide(event) { 671 if (event.clientY <= 0) { 672 callLightboxFunc(lightboxParams); 673 document.removeEventListener('mouseout', onMouseOutTopSide); 674 } 675} 676document.addEventListener('mouseout', onMouseOutTopSide); 677 678 679 } 680 else { 681 682 function onMouseOutAllSides(event) { 683 if ( 684 event.clientY < 0 || 685 event.clientX < 0 || 686 event.clientX > window.innerWidth || 687 event.clientY > window.innerHeight 688 ) { 689 callLightboxFunc(lightboxParams); 690 document.removeEventListener('mouseout', onMouseOutAllSides); 691 } 692} 693 694document.addEventListener('mouseout', onMouseOutAllSides); 695 } 696 697 698 } 699 else if(mobile_back_button_enabled && cdevice == "mobile"){ 700 let shown = false; 701 const STATE = { trapped: true }; 702 703 window.history.replaceState(STATE, ''); 704 705 window.addEventListener('popstate', e => { 706 if (e.state && e.state.trapped) { 707 if (!shown) { 708 shown = true; 709 callLightboxFunc(lightboxParams); 710 history.pushState(STATE, ''); // keep them here 711 } else { 712 shown = false; 713 history.back(); 714 } 715 } 716 }); 717 } 718 else if(interactions) { //inject interactions 719 registerInteractions(interactions, lightboxParams); 720 } 721 else callLightboxFunc(lightboxParams); 722 } 723}); 724}) 725.catch(error => { 726 console.error('Error Paywall API:', error); 727});
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.