PageSourceSearch

https://www.ciol.com/static/js/reader/signin.js

js ciol.com collected 2026-10-01 10:14:28 UTC 29,344 bytes, 877 lines download raw bytes

1var signin = document.getElementById("signin_page-js");
2var publisher_platform_id = JSON.parse(
3  signin.getAttribute("publisher_platform_id")
4);
5var is_mobile_device = signin.getAttribute("is_mobile");
6let actual_domain_signin = `https://${signin.getAttribute("actual_domain") || window.location.hostname}`
7var default_user_avatar = signin.getAttribute("default_user_avatar");
8var page_type = signin.getAttribute("page_type");
9var publisher = signin.getAttribute('publisher');
10var hide_full_content= signin.getAttribute('hide_full_content');
11const host_domain = signin.getAttribute('host_domain') || window.location.hostname
12const publisher_name = signin.getAttribute('publisher_name');
13const publisher_logo = signin.getAttribute('publisher_logo');
14const publisher_color = signin.getAttribute('publisher_color');
15const pricing_page_key = signin.getAttribute('pricing_page_key');
16const paywall_is_enabled = signin.getAttribute('paywall_is_enabled');
17const access_version = signin.getAttribute('access_wall_version');
18// handling home page Reader state
19
20const AUTH_PATH = [
21  '/reader/login',
22  '/reader/signin',
23  '/reader/signup',
24  '/reader/forget_password',
25  '/reader/update_password',
26  '/reader/password_updated',
27  '/reader/verify_email',
28]
29
30function getPageReferrer() {
31  const fallback = document.referrer || window.location.origin;
32
33  try {
34    const params = new URLSearchParams(window.location.search);
35    const ref = params.get('referrer');
36
37    if (!ref) return fallback;
38
39    const decoded = decodeURIComponent(ref);
40
41    const isAbsolute = /^https?:\/\//i.test(decoded);
42    const url = isAbsolute
43      ? new URL(decoded)
44      : new URL(decoded, window.location.origin);
45
46    if (url.origin === window.location.origin) return url.href;
47
48    console.warn(`[getPageReferrer] Cross-origin referrer rejected: ${url.origin}`);
49    return fallback;
50
51  } catch (err) {
52    console.error(`[getPageReferrer] Failed to parse referrer:`, err);
53    return fallback;
54  }
55}
56
57function setCookie(name, value, days) {
58  // Create a date object
59  const date = new Date();
60  
61  // Set the expiration date by adding the specified number of days
62  date.setTime(date.getTime() + (days * 24 * 60 * 60 * 1000));
63  
64  // Format the date to UTC string for the cookie expiration
65  const expires = "expires=" + date.toUTCString();
66  
67  // Set the cookie with name, value, and expiration date
68  document.cookie = name + "=" + encodeURIComponent(value) + ";" + expires + ";path=/";
69}
70function getCookie(name) {
71  try {
72    return document.cookie
73      .split("; ")
74      .find((row) => row.startsWith(name + "="))
75      ?.split("=")[1];
76  } catch (error) {
77    console.error(`Error getting cookie: ${name}`, error);
78    return null;
79  }
80}
81
82function publishEvent(eventName, data) {
83  if (!window?.eventBus?.publish) return;
84  window?.eventBus?.publish(eventName, data);
85}
86
87function handleDesktopReader() {
88  let has_uuid = getCookie('has_uuid')
89  let login_wall_section = document.getElementById('login_Wall_section')
90  if(has_uuid){
91    fetch(`${actual_domain_signin}/reader/details`)
92    .then((response) => {
93      return response.json();
94    })
95    .then((data) => {
96      let user = data?.items?.[0]
97      if (user) {
98        user = user?.user
99      }
100      if (!user || !data?.items) {
101        throw new Error("User not Authenticated")
102      }
103      if(data?.reader_detail?.authorised && data?.reader_detail?.status){
104        setCookie('hide_ads',1,7)
105      }
106      update_reader_button(user);
107      document.querySelector(`#reader-login-status`).innerHTML = 1
108      handleComponentsDependantOnAuthorisedLogin()
109      // handle article page login wall
110      if(page_type === "ArticlePage" && login_wall_section){
111        document.querySelector('.login-wall')?.classList.add("display-none")
112        document.querySelector('.bottom-shadow-mobile')?.classList.add("display-none")
113        const postContainer = document.getElementById('post-container')
114        if (postContainer) {
115          postContainer.style.display = "block"
116        }
117        if(hide_full_content != "false") document.querySelector('#postContent')?.classList.remove("hide-full-content")
118          document.querySelectorAll('.access-wall-comp').forEach(function(element) {element.classList.remove('d-none');});
119        accessWallArticleDisplay()
120      }
121      if (AUTH_PATH.some(p => window.location.pathname.endsWith(p))) {
122        if (!document.referrer || AUTH_PATH.some(p => document.referrer.endsWith(p))) {
123          window.location.href = `${actual_domain_signin}`;
124        } else   
125          window.location = document.referrer;
126      }
127      publishEvent("user:authenticated", {
128        user,
129        reader_detail: data?.reader_detail,
130      })
131    }).catch(err => {
132      handleUnauthorisedElements()
133      handleComponentsDependantOnUnauthorisedLogin();
134      // If page is loaded, initialize platforms else wait for page load
135      if (document.readyState === "complete") {
136        initPlatformLogin();
137      } else {
138        window.addEventListener('load', () => initPlatformLogin());
139      }
140      publishEvent("user:unauthenticated")
141    });
142  }
143  else{
144      handleUnauthorisedElements();
145      handleComponentsDependantOnUnauthorisedLogin();
146      if(page_type === "ArticlePage" && login_wall_section){
147        document.querySelector('.login-wall')?.classList.add("show")
148        document.querySelector('.login-wall')?.classList.add("loginwall-visible")
149      }
150      // If page is loaded, initialize platforms else wait for page load
151      if (document.readyState === "complete") {
152        initPlatformLogin();
153      } else {
154        window.addEventListener('load', () => initPlatformLogin());
155      }
156      return;
157
158  }
159}
160
161// Add all components dependant on Unauthorised login
162function handleComponentsDependantOnUnauthorisedLogin(){
163  const handleUGCUnauthorisedElements=  window?.handleUGCUnauthorisedElements;
164  if(handleUGCUnauthorisedElements) handleUGCUnauthorisedElements();
165}
166
167function handleComponentsDependantOnAuthorisedLogin(){
168  const handleUGCUpdateCTAonLogin = window?.handleUGCUpdateCTAonLogin;
169  if(handleUGCUpdateCTAonLogin) handleUGCUpdateCTAonLogin();
170}
171
172function update_reader_button(user) {
173
174  const SidebarUserDropdown = document.getElementById(`sidebar-user-dropdown`)
175  const SidebarUserSignin = document.getElementById(`sidebar-signin`)
176  const SidebarSignup = document.querySelector(`.sidebar-signup-wrapper`)
177  document.getElementById(`user-account-logo`)? document.getElementById(`user-account-logo`).style.display = "none":"";
178  document.getElementById(`navbar-user-dropdown`)? document.getElementById(`navbar-user-dropdown`).style.display= "block":"";
179  document.getElementById(`subscribe_login`)? document.getElementById(`subscribe_login`).style.display = "none":"";
180  SidebarUserDropdown? SidebarUserDropdown.style.display= "block":'';
181  SidebarUserSignin? SidebarUserSignin.style.display= "none":'';
182 
183  const readerImg = document.getElementById("reader-photo-thumbnail");
184  const readersideImg = document.getElementById("sidebar_reader_logo");
185  var usernames = document.querySelectorAll(".user_name");
186  if(usernames){
187    usernames.forEach(function(username) {
188      username.innerText = user.name;
189    });}
190    let photo_url = user?.photo_thumbnail || default_user_avatar
191    readerImg.setAttribute("src", photo_url); 
192    readersideImg? readersideImg.setAttribute("src", photo_url):""; 
193
194  SidebarSignup? SidebarSignup.style.display = "none" :"";
195}
196
197function loginUser(jsonData) {
198  fetch(`${actual_domain_signin}/reader/login/uuid_token`, {
199    method: "POST",
200    headers: {
201      "Content-Type": "application/json",
202    },
203    body: JSON.stringify(jsonData),
204  }).then((response) => {
205    if (response.ok) {
206      const isAuthPage = AUTH_PATH.some(p => window.location.pathname.endsWith(p))
207      if (isAuthPage) {
208        window.location = getPageReferrer();
209      } else {
210        if (isAuthPage) {
211          window.location = `${actual_domain_signin}`;
212        }
213         else {
214        window.location.reload()
215      }
216    }
217    }
218  });
219}
220
221handleDesktopReader()
222
223function handleCredentialResponse(response) {
224   jsonData = {
225    user_json: { provider: 'google', token: response.credential },
226  };
227  loginUser(jsonData)
228}
229
230
231function initPlatformLogin() {
232  const platformInitFunctions = [googleInit, facebookLoginInit];
233  platformInitFunctions.forEach((func) => func());
234}
235
236function googleLoginBtnInit() {
237  function createFakeGoogleWrapper() {
238    let googleLoginWrapper = document.querySelector(`.custom-google-button`);
239
240    google?.accounts?.id.renderButton(googleLoginWrapper, {
241      type: "icon",
242    });
243
244    const googleLoginWrapperButton =
245      googleLoginWrapper.querySelector("div[role=button]");
246
247    return {
248      click: () => {
249        googleLoginWrapperButton.click();
250      },
251    };
252  }
253
254  const googleButtonWrapper = createFakeGoogleWrapper();
255
256  document.querySelectorAll(".google-login").forEach(btn => {
257    btn.addEventListener('click', ()=> {
258      googleButtonWrapper.click();
259    })
260  })
261}
262
263function googleInit(){
264  // testing to see if the event is triggering 
265  try {
266    google.accounts.id.initialize({
267      client_id: publisher_platform_id?.google_login?.client_id,
268      ux_mode: "popup",
269      callback: handleCredentialResponse
270    });
271    google.accounts.id.prompt();
272
273    googleLoginBtnInit()
274  } catch(err){
275    console.log(err)
276  }
277}
278
279function facebookLoginInit(){
280  var fbKey = publisher_platform_id?.facebook_login?.client_id;
281  if(!fbKey) return;
282  
283  window.fbAsyncInit = function() {
284    FB.init({
285      appId      : publisher_platform_id?.facebook_login?.client_id,
286      xfbml      : true,
287      version    : 'v17.0'
288    });
289    FB.AppEvents.logPageView();
290  };
291  (function(d, s, id){
292    var js, fjs = d.getElementsByTagName(s)[0];
293    if (d.getElementById(id)) {return;}
294    js = d.createElement(s); js.id = id;
295    js.defer = true;
296    js.src = `https://connect.facebook.net/en_US/sdk.js#version=v2.2&appId=${fbKey}&status=true&cookie=true&xfbml=false`;
297    fjs.parentNode.insertBefore(js, fjs);
298  }(document, 'script', 'facebook-jssdk'));
299
300}
301
302function openFacebookLoginModal() {
303  FB.login(function(response) {
304    if (response.authResponse) {
305      loginUser({
306        user_json: { provider: 'facebook', token: response.authResponse.accessToken },
307      })
308    } else {
309      console.log("some thing went wrong in fb login",response )
310    }
311  }, { scope: 'email' });
312}
313
314function handleUnauthorisedElements(){
315  // Bookmarks Page
316   if(page_type === "BookMarksPage") {
317    if (document.referrer.includes("/bookmarks")) {
318      window.location.href = `${actual_domain_signin}`;
319    } 
320    else {
321      window.location = document.referrer;
322    }
323  }
324  else if (page_type === 'ManageSubscription'){
325    window.location.href = `${actual_domain_signin}/reader/login`
326  }
327  else if( page_type === "ReaderProfilePage"){
328    window.location.href = `${actual_domain_signin}/reader/login`
329  }
330}
331
332function handleLoginFlow(){
333  let user_json = {
334      "email": document.getElementById('signin_email').value,
335      "password" : document.getElementById('signin_password').value
336  }
337  if (! isValidEmail(document.getElementById('signin_email').value)) {
338      document.getElementById('response-message').innerHTML = 'Invalid email address'
339      document.getElementById('response-message').style.color = 'red'
340      document.getElementById('response-message').style.padding = '10px 0px'
341      return 
342  }
343  fetch(`${actual_domain_signin}/reader/sign_in_the_user`, {
344      method: "POST",
345      headers: {
346      "Content-Type": "application/json",
347      },
348      body: JSON.stringify(user_json),
349  }).then(response => {
350      if (!response.ok) {
351          throw new Error("Network response was not ok");
352      }
353      return response.json(); // Parse response as JSON
354  })
355  .then(data => {
356      document.getElementById('response-message').innerHTML = data.message
357      document.getElementById('response-message').style.color = 'red'
358      document.getElementById('response-message').style.padding = '10px 0px'
359  })
360  .catch(error => {
361      // if http response is success and it will reload the page 
362      const referrer = getPageReferrer();
363      if (AUTH_PATH.some(p => window.location.pathname.endsWith(p))) {
364      const redirectToHomePage = !document.referrer || AUTH_PATH.some(p => document.referrer.endsWith(p))
365      if (redirectToHomePage) {
366          window.location.href = `${actual_domain_signin}`;
367      } else   
368          if (referrer && referrer !== window.location.href) window.location = referrer;
369          else window.location = document.referrer
370      }
371      else{
372        if (referrer && referrer !== window.location.href) window.location = referrer;
373        else window.location = document.referrer
374      }
375  });
376}
377
378try{
379  document.getElementById('signin_form_button').addEventListener('click', function (event) {
380          event.preventDefault();
381          handleLoginFlow()
382      })
383  document.getElementById('signin_form_button').addEventListener('submit', function (event) {
384          event.preventDefault();
385          handleLoginFlow()
386      })
387  }
388catch(err){}
389
390try{  
391  $('#sign_up_submit_btn').on('click', function (event) {
392    const url = $('#sign_up_url_address').val()
393    const email = $('#sign_up_email_address').val()
394    const first_name = $('#sign_up_first_name').val()
395    const forget_password = $('#sign_up_forget_password').val()
396    if((!first_name) && !forget_password){
397      document.getElementById('response-message').innerHTML = 'First name is required in order to create an account.'
398      document.getElementById('response-message').style.color = 'red'
399      document.getElementById('response-message').style.padding = '10px 0px'
400      return
401    }
402    if((!email) && !forget_password){
403      document.getElementById('response-message').innerHTML = 'Email is required in order to create an account.'
404      document.getElementById('response-message').style.color = 'red'
405      document.getElementById('response-message').style.padding = '10px 0px'
406      return
407    }
408    if (! isValidEmail(email)) {
409      document.getElementById('response-message').innerHTML = 'Invalid email address'
410      document.getElementById('response-message').style.color = 'red'
411      document.getElementById('response-message').style.padding = '10px 0px'
412      return 
413    }
414    var formData = $('#sign_up_form').serialize() // using form serializer due to captcha 
415    $.ajax({
416      url: url,
417      type: 'POST',
418      data: formData,
419      dataType : 'JSON',
420    })
421    .done(data =>{
422        $('#response-message').html(data.message)
423        if(data.status == 'error'){
424          document.getElementById('response-message').style.color = 'red'
425          document.getElementById('response-message').style.padding = '10px 0px'
426        }else{
427          document.getElementById('response-message').style.color = '#1FA549'
428          document.getElementById('response-message').style.padding = '10px 0px'
429        }
430    })
431  })
432}catch(err){
433}
434
435try{
436  document.getElementById('forget_password_update').addEventListener('click', function (event) {
437  let user_json = {
438    "email": document.getElementById('forget_password_email')?.value,
439    "token": document.getElementById('forget_password_token')?.value,
440    "new_password": document.getElementById('forget_password_new_password')?.value,
441    "confirm_password" : document.getElementById('forget_password_confirm_password')?.value
442  }
443  if (document.getElementById('forget_password_old').checked) {
444    user_json['forgot_password']=true
445  }
446  fetch(`${actual_domain_signin}/reader/forget_password_update`, {
447    method: "POST",
448    headers: {
449      "Content-Type": "application/json",
450    },
451    body: JSON.stringify(user_json),
452  }).then(response => {
453    if (!response.ok) {
454        throw new Error("Network response was not ok");
455    }
456    return response.json(); // Parse response as JSON
457  })
458  .then(data => {
459      if (data.user_password_update) {
460        if (data.forgot_password) {
461          window.location = '/reader/password_updated?forgot_password=true'; //redirect to forget password page
462        }else{
463          window.location = '/reader/password_updated'; //redirect to forget password page
464        }
465      }else{
466        document.getElementById('response-message').innerHTML = data.message
467        document.getElementById('response-message').style.color = '#1FA549'
468        document.getElementById('response-message').style.padding = '10px 0px'
469      }
470  })
471  .catch(error => {
472      console.error("Fetch error:", error);
473  });
474})
475}catch(err){
476}
477document.addEventListener('keyup', function(e) {
478  if (e.key === 'Enter') {
479    document.querySelector('.form_submit_button').click();
480  }
481});
482
483
484function isValidEmail(email) {
485  const emailRegex = /^[^\s@]+@[^\s@]+\.[^\s@]+$/;
486  return emailRegex.test(email);
487}
488
489
490
491// payment gateway and polling for subscription
492
493// creating subscription link Razorpay
494let PreviousPageUrl = ()=>{
495  let redirect_url = localStorage.getItem('redirect_url');
496  // localStorage.removeItem('redirect_url');
497  if(redirect_url){
498    return redirect_url
499  }
500  else {return '/'}
501}
502let CreateSubscription = (plan_id,user)=>{
503  var myModal = new bootstrap.Modal(document.getElementById('pub_payment_status_modal'), {
504    keyboard: false
505  });
506  myModal.show();
507  document.getElementById('initiate_modal').style.display = "block";
508  var params = new URLSearchParams();
509  params.append('plan', plan_id);
510  params.append('user_email', user.email);
511  var queryString = params.toString();
512  var url = `${actual_domain_signin}/create_subscription?${queryString}`;
513  fetch(url, {
514      method: 'GET',
515  })
516  .then((data) => {
517    return data.json();
518  })
519  .then((data) => {
520    if(!data.message){
521    // Handle successful response
522    document.getElementById('initiate_modal').style.display = "none";
523    document.getElementById('comfirmation_modal').style.display = "block";
524    // HandleSubscriptionPolling(data.id)
525    var rzp1 = new Razorpay(razorpayOption(user,data,myModal));
526    rzp1.open();
527    }
528    else{
529      const redirect_url = PreviousPageUrl();
530
531      document.getElementById('initiate_modal').style.display = "none";
532      document.getElementById('already_title').innerHTML = `Welcome Back, ${user.name}`;
533      document.getElementById('already_content').innerHTML = `You're already subscribed to <b>${data.plan_name}</b>. Continue enjoying premium content."`;
534      document.getElementById('already_subscribed_modal').style.display = "block";
535      document.getElementById('redirect-btn').setAttribute("href", redirect_url ) 
536    }
537    // polling for subscription status
538      
539      
540  })
541  .catch(error => {
542      // Handle any errors
543      console.error('Error:', error);
544  });
545}
546
547// interval polling function for subscription status
548let pollingInterval;
549function HandleSubscriptionPolling(data_id) {
550  let elapsedTime = 0;
551
552  function poll() {
553    HandleSubscriptionStatus(data_id);
554
555    // Stop polling after 10 minutes (600,000 milliseconds)
556    elapsedTime += 10000; // Increment by polling interval
557    if (elapsedTime >= 180000) {
558      clearInterval(pollingInterval);
559      document.getElementById('comfirmation_modal').style.display = "none";
560      document.getElementById('timeout_modal').style.display = "block";
561    }
562  }
563  // Initial call to start polling
564  poll();
565  pollingInterval = setInterval(poll, 10000);
566}
567
568// polling api call for subscription status
569function HandleSubscriptionStatus(plan_id) {
570  fetch(`${actual_domain_signin}/subscription_status_check/${plan_id}`)
571  .then((response) => {
572    return response.json();
573  })
574  .then((data) => {
575    let status = data.status;
576    if(status == "Completed" || status == "Active" ){
577      pervious_page_redirection(true);
578    }
579  })
580  .catch(err => {
581    console.log(err);
582  });
583}
584// set host domain as localhost or 127.0.0.1 for debug mode
585function ConstructURLWithParams(baseUrl, params){
586  const url = new URL(`https://${host_domain}/${baseUrl}`);
587  Object.keys(params).forEach(key => {
588    url.searchParams.append(key, params[key]);
589  })
590  return url.toString();
591}
592function HandleSubscriptionSignVerification(plan_id,razarpayResponse) {
593  const subcriptionVerificationURL = ConstructURLWithParams(`subscription_status_check/${plan_id}`, razarpayResponse )
594  fetch(subcriptionVerificationURL)
595  .then((response) => {
596    return response.json();
597  })
598  .then((data) => {
599    HandleSubscriptionPolling(plan_id,razarpayResponse)
600  })
601  .catch(err => {
602    console.log(err);
603  });
604}
605
606// checking if user is logged in or not and calling subscription api
607function HandlePaidSubscription(plan_id) {
608  fetch(`${actual_domain_signin}/reader/details`)
609  .then((response) => {
610    return response.json();
611  })
612  .then((data) => {
613      let user = data?.items?.[0];
614      if (user) {
615        user = user?.user
616      }
617      if(!user){
618        if (pricing_page_key && access_version === "2.0") {
619          return;
620        }
621        if(is_mobile_device === "True" ){window.location.href = '/reader/login';}
622        else{
623          var myModal = new bootstrap.Modal(document.getElementById('signup_modal'), {
624            keyboard: false
625          });
626          myModal.show();
627        }
628      }
629      else{
630        if(plan_id){
631          CreateSubscription(plan_id,user)
632        }
633      }
634  })
635  .catch(err => {
636      console.log(err);
637  });
638}
639
640if(pricing_page_key){
641  document.addEventListener('DOMContentLoaded', function() {
642    HandlePaidSubscription(null);
643  });
644}
645
646// selecting subscription
647let plan_select_btn = document.querySelectorAll('.pub-selection')
648plan_select_btn.forEach(button => {
649  button.addEventListener('click', function() {
650    const dataId = this.getAttribute('data-id');
651    HandlePaidSubscription(dataId)
652  });
653});
654
655let pervious_page_redirection = ()=>{
656  const currentDomain = window.location.hostname;
657  if (host_domain === currentDomain ) {
658      window.history.back();
659  } 
660  else {
661      window.location.href = '/'
662  }
663}
664
665
666// razorpay options for paywall subscriptions
667function razorpayOption(user,subData,modal=null) {
668  var options = {
669    "key": subData?.api_key,
670    "amount": subData?.plan_amount,
671    "currency": subData?.plan_currency,
672    "name": publisher_name,
673    "description": subData?.plan_description,
674    "image": publisher_logo,
675    "handler": function(response) {
676      HandleSubscriptionSignVerification(subData?.id,response)
677    },
678    "prefill": {
679      "name": user?.name,
680      "email": user?.email,
681    },
682    "theme": {
683      "color": publisher_color
684    },
685    modal: {
686      ondismiss: function () {
687        // This function will be triggered when the modal is closed
688        if(modal){
689          modal.hide();
690        }
691        if(document.getElementById('comfirmation_modal')){
692          document.getElementById('comfirmation_modal').style.display = "none";
693        }
694      }
695    }
696  };
697  if(subData.aggregator_subscription_id){
698    options["subscription_id"] = subData?.aggregator_subscription_id;
699  }
700  else{
701    options["order_id"] = subData?.aggregator_order_id;
702  }
703return options;
704}
705window.accessWallArticleDisplay = ()=>{
706  try{
707    const articleContainer = document.querySelector('#post-container');
708    const accessWallPostContainer = document.querySelector('#access-wall-content');
709    accessWallPostContainer.style.display = 'none'
710    articleContainer.style.display = ''
711  }
712  catch(err){
713    console.log()
714  }
715}
716
717// class UserLoginSystem{
718//   constructor(actual_domain_signin){
719//     this.actual_domain_signin = actual_domain_signin;
720//   }
721
722//   handleDesktopReader() {
723//     const fetchReaderDetails = () => {
724//       return fetch(`https://${this.actual_domain_signin}
724/reader/details`)
725//         .then(response => response.json());
726//     };
727
728//     const showLoginWall = (loginWallSection) => {
729//       if (page_type === "ArticlePage" && loginWallSection) {
730//         const loginWall = document.querySelector('.login-wall');
731//         loginWall?.classList.add("show");
732//         loginWall?.classList.add("loginwall-visible");
733//       }
734//     };
735
736//     const hideLoginWall = (loginWallSection) => {
737//       if (page_type === "ArticlePage" && loginWallSection) {
738//         document.querySelector('.login-wall')?.classList.add("display-none");
739//         document.querySelector('.bottom-shadow-mobile')?.classList.add("display-none");
740//         document.getElementById('post-container').style.display = "block";
741//         if (hide_full_content != "false") {
742//           document.querySelector('#postContent')?.classList.remove("hide-full-content");
743//         }
744//         document.querySelectorAll('.access-wall-comp').forEach(element => {
745//           element.classList.remove('d-none');
746//         });
747//         accessWallArticleDisplay();
748//       }
749//     };
750
751//     const redirectIfOnLoginPage = () => {
752//       if (window.location.pathname === "/reader/login") {
753//         if (document.referrer.includes("/reader/login")) {
754//           window.location.href = "/";
755//         } else {
756//           window.location = document.referrer;
757//         }
758//       }
759//     };
760
761//     const initPlatformsOnLoad = () => {
762//       if (document.readyState === "complete") {
763//         initPlatformLogin();
764//       } else {
765//         window.addEventListener('load', () => initPlatformLogin());
766//       }
767//     };
768
769//     fetchReaderDetails()
770//       .then(data => {
771//         let user = data?.items?.[0];
772//         if (user) {
773//           user = user?.user;
774//         }
775
776//         if (data?.reader_detail?.authorised && data?.reader_detail?.status) {
777//           setCookie('hide_ads', 1, 7);
778//         }
779
780//         const loginWallSection = document.getElementById('login_Wall_section');
781
782//         if (!user || !data?.items) {
783//           handleUnauthorisedElements();
784//           handleComponentsDependantOnUnauthorisedLogin();
785//           showLoginWall(loginWallSection);
786//           initPlatformsOnLoad();
787//           return;
788//         }
789
790//         update_reader_button(user);
791//         document.querySelector(`#reader-login-status`).innerHTML = 1;
792//         handleComponentsDependantOnAuthorisedLogin();
793//         hideLoginWall(loginWallSection);
794//         redirectIfOnLoginPage();
795//       })
796//       .catch(err => {
797//         handleUnauthorisedElements();
798//         handleComponentsDependantOnUnauthorisedLogin();
799//         initPlatformsOnLoad();
800//       });
801//   }
802
803// // Add all components dependant on Unauthorised login
804//  handleComponentsDependantOnUnauthorisedLogin(){
805//   const handleUGCUnauthorisedElements=  window?.handleUGCUnauthorisedElements;
806//   if(handleUGCUnauthorisedElements) handleUGCUnauthorisedElements();
807// }
808
809//  handleComponentsDependantOnAuthorisedLogin(){
810//   const handleUGCUpdateCTAonLogin = window?.handleUGCUpdateCTAonLogin;
811//   if(handleUGCUpdateCTAonLogin) handleUGCUpdateCTAonLogin();
812// }
813
814//  update_reader_button(user) {
815
816//   const SidebarUserDropdown = document.getElementById(`sidebar-user-dropdown`)
817//   const SidebarUserSignin = document.getElementById(`sidebar-signin`)
818//   const SidebarSignup = document.querySelector(`.sidebar-signup-wrapper`)
819//   document.getElementById(`user-account-logo`)? document.getElementById(`user-account-logo`).style.display = "none":"";
820//   document.getElementById(`navbar-user-dropdown`)? document.getElementById(`navbar-user-dropdown`).style.display= "block":"";
821//   document.getElementById(`subscribe_login`)? document.getElementById(`subscribe_login`).style.display = "none":"";
822//   SidebarUserDropdown? SidebarUserDropdown.style.display= "block":'';
823//   SidebarUserSignin? SidebarUserSignin.style.display= "none":'';
824 
825//   const readerImg = document.getElementById("reader-photo-thumbnail");
826//   const readersideImg = document.getElementById("sidebar_reader_logo");
827//   var usernames = document.querySelectorAll(".user_name");
828//   if(usernames){
829//     usernames.forEach(function(username) {
830//       username.innerText = user.name;
831//     });}
832//     let photo_url = user?.photo_thumbnail || default_user_avatar
833//     readerImg.setAttribute("src", photo_url); 
834//     readersideImg? readersideImg.setAttribute("src", photo_url):""; 
835
836//   SidebarSignup? SidebarSignup.style.display = "none" :"";
837// }
838
839//  decodeJwtResponse(token) {
840//   var base64Url = token.split(".")[1];
841//   var base64 = base64Url.replace(/-/g, "+").replace(/_/g, "/");
842//   var jsonPayload = decodeURIComponent(
843//     window
844//       .atob(base64)
845//       .split("")
846//       .map(function (c) {
847//         return "%" + ("00" + c.charCodeAt(0).toString(16)).slice(-2);
848//       })
849//       .join("")
850//   );
851
852//   return JSON.parse(jsonPayload);
853// }
854
855//  loginUser(jsonData) {
856//   fetch(`${actual_domain_signin}/reader/login/uuid_token`, {
857//     method: "POST",
858//     headers: {
859//       "Content-Type": "application/json",
860//     },
861//     body: JSON.stringify(jsonData),
862//   }).then((response) => {
863//     if (response.ok) {
864//       if (window.location.pathname === "/reader/login") {
865//         window.location = document.referrer;
866//       } else {
867//         if (window.location.pathname === "/reader/login") {
868//           window.location = `${actual_domain_signin}`;
869//         }
870//          else {
871//         window.location.reload()
872//       }
873//     }
874//     }
875//   });
876// }
877// } 

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.