PageSourceSearch

https://www.localsamosa.com/static/js/legacy_v2_js/article_V2.js

js localsamosa.com collected 2026-10-02 13:32:26 UTC 30,387 bytes, 777 lines download raw bytes

1var elem = document.getElementById('article-js');
2var primary_category = elem.getAttribute('primary_category');
3var article_type = elem.getAttribute('article_type');
4var article_legacy_url = elem.getAttribute('article_legacy_url');
5var publisher_actual_domain = elem.getAttribute('publisher_actual_domain');
6var post_id = elem.getAttribute('post_id');
7var enable_infinite_articles = elem.getAttribute('enable_infinte_article');
8var allow_login_wall = elem.getAttribute('allow_login_wall');
9var infScrollArticleURLs = []
10var infScrollPageIndex = 2
11var article_key_string = article_url_string()
12var allow_scroll_height = 0.4
13var web_story_logo = elem.getAttribute('web_story_logo');
14var gallery_logo = elem.getAttribute('gallery_logo');
15var hide_full_content= elem.getAttribute('hide_full_content');
16var allow_reader_login = elem.getAttribute('allow_reader_login')
17var enable_native_legacy_var = elem.getAttribute('enable_native_legacy_ui')
18var enable_native_legacy_ui = (enable_native_legacy_ui == '1' || enable_native_legacy_ui=='True') ? true : false
19var blog_current_page = 2
20let post_access_type = elem.getAttribute('post_access_type')
21let gallery_slide_url_config = elem.getAttribute('gallery_slide_url_config');
22let gallery_slide_url_enabled = (gallery_slide_url_config == '1' || gallery_slide_url_config=='True') ? true : false
23
24let publisher_domain = publisher_actual_domain;
25if (publisher_domain)
26    publisher_domain = publisher_domain.replace(/^https?:\/\//, '').replace(/\/$/, '')
27const access_wall_version = elem.getAttribute('access_wall_version');
28
29
30function check_duplicate(nextURL){
31  var current_page_path = window.location.pathname.replace(/^.*\/\/[^\/]+/, '')
32  if (article_legacy_url === nextURL){
33    return 1
34  }
35  return 0
36}
37function updateNextURL( page ) {
38  nextURL = infScrollArticleURLs[page-1]
39}
40
41function getCookieValue(name) {
42  const value = `; ${document.cookie}`;
43  const parts = value.split(`; ${name}=`);
44  if (parts.length === 2) return parts.pop().split(";").shift();
45  return null;
46}
47
48function article_url_string() {
49  var url = window.location.pathname.replace(/^.*\/\/[^\/]+/, '')
50  url = url.replaceAll("/","")
51    return url
52}
53
54function article_url_string_for_title(url) {
55  url = decodeURIComponent(url)
56  const slugify = str =>
57  str
58    .toLowerCase()
59    .trim()
60    .replace(/[^\w\s-]/g, '')
61    .replace(/[\s_-]+/g, '-')
62    .replace(/^-+|-+$/g, '');
63  url = slugify(url)
64  return url
65}
66
67function getAllValues() {
68  var inputValues = $('.category_list input').map(function() {
69      return {"name":$(this).data('name'),"slug":$(this).val()}
70  })
71  return inputValues;
72}
73
74
75
76function getPenPath() {  
77  if (this.loadCount == 0){
78    this.loadCount = 1
79  }
80  if ( category_list[ this.loadCount ] ) {
81    return `/get_category_posts/${category_list[ this.loadCount ].slug}`;
82  }
83  else{
84    return 0
85  }
86}
87// Check if window.visited_pages is not defined or is not an array
88if (!window.visited_pages || !Array.isArray(window.visited_pages)) {
89  window.visited_pages = []; // Initialize it as an empty array
90}
91
92window.visited_pages.push(article_url_string_for_title(article_legacy_url))
93function get_me_the_visited_page(){
94  return window.visited_pages
95}
96
97$.fn.isInCertainHeight = function() {
98  var elementTop = $(this).offset().top;
99  var elementBottom = elementTop + $(this).outerHeight();
100  var viewportTop = $(window).scrollTop() +400 ;
101  var viewportBottom = viewportTop + $(window).height() - 800;
102  var viewportBottom_new = viewportTop + $(window).height() - 200;
103  return (viewportTop < elementTop && elementTop < viewportBottom) || (viewportTop < elementBottom && elementBottom < viewportBottom_new) || (elementBottom > viewportTop && elementTop < viewportBottom);
104};
105
106function infinite_articles(){
107  let elem = ''
108  elem = document.querySelector('#left-col');
109  let infScrollArticle = new InfiniteScroll( elem, {
110    // options
111    path: function() {
112      if(nextURL){
113        return nextURL;
114      }
115      return ''
116    },
117    append: '.article_main_div',
118    prefill: true,
119    debug: false, // for prod set this as false
120    history: false,
121    historyTitle: false,
122    scrollThreshold: 2000,
123    // checkLastPage: getPenPath
124  });
125  
126
127  infScrollArticle.on( 'load', function( body, path, response ) {
128    window.loaded_article_url = publisher_actual_domain + nextURL
129    try{
130      const elements = body.getElementsByClassName('next_page_hide');
131      for (let i = 0; i < elements.length; i++) {
132        elements[i].style.display = 'none';
133      }
134      }
135      catch(err){}
136    var all_next_divs = body.querySelectorAll('.next_page_show_ads')
137    try {
138      window.page_counter++;
139      for(let i = 0; i<all_next_divs.length;i++){
140        const element_id = all_next_divs[i].id.slice(0, -1) // slice last digit from the id to update it
141        all_next_divs[i].id = element_id+window.page_counter;
142      }
143    }
144
145    catch(err) {
146      console.log("error is ",err)
147    }
148    try{
149      const hide_ads_cookie_value = getCookieValue("hide_ads");
150      if (hide_ads_cookie_value == "1") {
151          const divs = body.getElementsByClassName("ads-container");
152          for (let i = divs.length - 1; i >= 0; i--) {
153            const div = divs[i];
154            if (div && div.parentNode) {
155              const parent = div?.parentNode
156              parent.removeChild(div);
157              try{
158                const siblings = Array.from(parent?.children).filter(child => child !== div);
159  
160                // Check if siblings are less than 2
161                if (siblings?.length < 2 && parent) {
162                  // Update height to auto
163                  parent.style.height = 'auto';
164                }
165              }catch(err){
166                console.log('error',err)
167              }
168
169            }
170          }
171      }
172    }
173    catch(err){
174      console.log("hide ads error");
175    }
176    try{
177      window.visited_pages.push(article_url_string_for_title(path))
178      // lazy loading all the image for infinite article
179      const article_image = body.querySelectorAll('img')
180      for(let i=0 ;i<=article_image.length;i++){
181        article_image[i]?.setAttribute('loading', 'lazy');
182      }
183    }
184    catch(err){
185      console.error("image article break =>",err)
186    }
187    $('.pulse-container').css("display", "none");
188
189    $('.read-more-article-box').css('display','flex')
190    updateNextURL(infScrollArticle.pageIndex)
191    infScrollPageIndex = infScrollArticle.pageIndex
192
193    try {
194      if(allow_reader_login == 1) {
195        get_next_page_bookmark(body)
196        if(allow_login_wall) {
197          handle_next_page_login_elements(body)
198        }
199      }
200    }
201    catch(err){
202      console.error("next page error", err)
203    }
204  });
205
206  infScrollArticle.on( 'request', function( path, fetchPromise ) {
207    if(nextURL){
208    $('.top_article_ads').css("display", "flex");
209    $('.top_article_ads').css("margin-top", "10px");
210      $('.pulse-container').css("display", "flex");
211      $('div #infinite_page_loader').css("display", "flex");
212    }
213  })
214  
215  infScrollArticle.on( 'last', function( body, path ) {
216    $('div #infinite_page_loader').css("display", "none");
217    
218  }); 
219
220  // Function to dynamically load PL script
221  function loadPLScript() {
222    return new Promise((resolve, reject) => {
223      if (window.PL) {
224        resolve();
225        return;
226      }
227      
228      // Create PL function placeholder
229      window.PL = window.PL || function(){(window.PL.q=window.PL.q||[]).push(arguments)};
230      
231      // Load the script
232      const script = document.createElement('script');
233      script.async = true;
234      script.src = `https://${publisher_domain}/static/access_wall/paywall.js`;
235      script.onload = () => resolve();
236      script.onerror = () => reject(new Error('Failed to load PL script'));
237      
238      const firstScript = document.getElementsByTagName('script')[0];
239      firstScript.parentNode.insertBefore(script, firstScript);
240    });
241  }
242
243  infScrollArticle.on('append', function( body, path, items, response ) {
244    try {
245      items.forEach(async (item) => {
246        const newPost = item.querySelector('#postContent');
247        const isAccessRequired = newPost.dataset.accessRequired;
248        if (newPost && isAccessRequired == 'true') {
249          const load = window.PL ? Promise.resolve() : loadPLScript();
250          load.then(() => {
251            PL.init({
252              publisher_domain: publisher_domain,
253              access_url: "/reader/content-access",
254              article_id: newPost.dataset.articleId,
255              article_legacy_url: newPost.dataset.legacyUrl,
256              article_container: "[data-article-id='"+newPost.dataset.articleId+"']",
257              header_container: ".header-class",
258              options: { 
259                visible_height: 0.4,
260                article_main_container: "#post-container",
261                article_hidden_container: "#access-wall-content",
262                on_hide_ads: window.on_hide_ads,
263                on_show_content: () => {
264                  window.on_show_content(newPost.dataset.articleId)
265                  const plShowWhenHide = document.querySelectorAll(`.pl-hide-with-paywall-show-${newPost.dataset.articleId}`)
266                  if (plShowWhenHide) {
267                    plShowWhenHide.forEach((el) => {
268                      el.classList.remove(`pl-access-hide`)
269                    })
270                  }
271                },
272                on_hide_content: () => {
273                  window.on_hide_content(newPost.dataset.articleId);
274                  const plShowWhenHide = document.querySelectorAll(`.pl-hide-with-paywall-show-${newPost.dataset.articleId}`)
275                  if (plShowWhenHide) {
276                    plShowWhenHide.forEach((el) => {
277                      el.classList.add(`pl-access-hide`)
278                    })
279                  }
280                },
281              }
282            });
283          }).catch(plError => {
284            console.error("[PL Script Loading] [Error]", plError);
285          });
286        }
287      });
288    } catch (err) {
289      console.error("[infScrollArticle.on('append')] [error] in items loops", err);
290    }
291    try {
292      const hasTweets = Array.from(items).some(item => item.querySelector('.twitter-tweet') !== null);
293      if (hasTweets) {
294        twttr.widgets.load();
295      }
296    } catch (err) {
297      console.log('twttr handled error', err);
298    }
299  })
300  
301}
302
303
304function article_url_string() {
305  var url = window.location.pathname.replace(/^.*\/\/[^\/]+/, '')
306  url = url.replaceAll("/","")
307    return url
308}
309
310$(document).ready(function() {
311  if(article_type !== 'CustomPage' && enable_infinite_articles === 'True'){
312    get_infinite_articles(primary_category)
313  }
314  if(article_type === 'LiveBlog'){
315    // start polling for blog updates
316    setInterval(function(){
317      $.get(article_legacy_url, function(data){
318      data_html = $.parseHTML(data);
319      var update_content = false
320      $('.live_blog_icon_update_div').css('display','none')
321        for(let i = 1; i<$(data_html).find('#live_blog_updates_'+post_id+'_div li').length;i++){
322          if($('.blog_update_unique_class_'+i).attr('id') !== $(data_html).find('.blog_update_unique_class_'+i).attr('id')) {
323            update_content = true
324            $('.live_blog_icon_update_div span').html('New Update: '+  $(data_html).find('.blog_update_unique_class_'+i+' .update-heading').html())
325            $('.live_blog_icon_update_div').css('display','flex')
326            // load twitter widget if available when content is updated
327            try{
328              twttr.widgets.load();
329            }catch(err){
330              console.log('twttr handled error')
331            }
332            break
333          }
334        }
335        if(update_content){
336          $('#live_blog_updates_'+post_id+'_div').html($(data_html).find('#live_blog_updates_'+post_id+'_div').html());
337        }
338
339    });
340      // Todo: update the interval time to 15000
341    }, 15000)
342    load_live_blog(blog_current_page)
343  }
344});
345
346function load_live_blog(page){
347  $.ajax({
348    method:'get',
349    url:`/get-live-blog-updates/${post_id}?page=${page}`,
350    dataType: 'json',
351    success: function(res){
352      var post_items = res.items
353      for(let i = 0; i<post_items.length;i++){
354        $('#live_blog_updates_'+post_id).append(
355          `
356          <li id="blog_update_${post_items[i].id}" data-update-time="${ post_items[i].created_at }" data-sort-time="${ post_items[i].created_at }" class="live-blog-li-div update">
357            <div class="live-blog-date-title-div">
358              <div class="update-date-div">
359                <div class="update-date">${ post_items[i].created_at }</div>
360                <div class="update-heading">${ post_items[i].blog_title }</div>
361              </div>
362            </div>
363            <div class="update-content">
364            ${ post_items[i].blog_content }
365            </div> 
366          </li>
367      `
368        );
369    }
370    if(!res.next){
371      $('.blog-update-load-more-button').css('display','none')
372    }
373  }
374})
375}
376
377$('.blog-update-load-more-button').on('click', function(){
378  blog_current_page++
379  load_live_blog(blog_current_page)
380})
381
382$(window).on('resize scroll', function() {
383  try{
384    if(typeof window.adjust_padding == 'function'){window.adjust_padding()}
385    url = article_url_string()
386    const new_page = get_me_the_visited_page() // this function is to update the visited page
387    for(let i=0;i<window.visited_pages.length;i++){
388      if($('.article_scroll_post_'+window.visited_pages[i]).isInCertainHeight()){
389        const title = $('.article_scroll_post_'+window.visited_pages[i]).data('page-title')
390        const url = $('.article_scroll_post_'+window.visited_pages[i]).data('page-url')
391        const nextPostKey = $('.article_scroll_post_'+window.visited_pages[i]).data('page-post-id')
392        const articlePageType = $('.article_scroll_post_'+window.visited_pages[i]).data('page-article-type')
393        if(document.querySelector('title').textContent !== title){
394          document.querySelector('title').textContent = title;
395          const state = { title: title };
396          if(enable_infinite_articles === 'True'){
397            history.replaceState(state, title, url);
398          }
399          if (gallery_slide_url_enabled && articlePageType=='Gallery') {
400            const images = document.querySelectorAll(`.pub-gallery-img-${nextPostKey}`);
401            galleryPostViewUrl(images,url)
402          }
403        }
404      }
405    }
406  }catch(err){
407    console.log('error',err);
408  }
409});
410
411get_infinite_articles = (primary_category)=>{
412  $.ajax({
413    method:'get',
414    url:'/get_infinte_posts/'+primary_category,
415    dataType: 'json',
416    success: function(res){
417      var post_items = res.pages
418      var related_articles = ""
419      if(post_items.length > 0){
420        $(".related_show").css('display','block')
421        var author = {'name':'','slug':''}    
422        $('#realted_articles_divider').css('display','block')
423        for(let i = 0; i<post_items.length;i++){
424          
425          if(check_duplicate(post_items[i].url)){
426            continue
427          }
428          infScrollArticleURLs.push(post_items[i].url)
429        }
430        page = 0
431        nextURL = infScrollArticleURLs[page]
432        
433        infinite_articles()
434      }
435      else{
436        console.error("error")
437      }
438    }
439   
440})}
441
442
443function get_next_page_bookmark(body){
444  let id = body.getElementById("article-post-id")?.value;
445  if (id === undefined || (typeof id !== "string" && typeof id !== "number") || isNaN(id)) return;
446  let form = new FormData()
447  form.append('post_id', id);
448  fetch(`/reader/bookmark`, {
449    method: "POST",
450    body: form
451  }) .then(response => {
452    if (response.ok) {
453      return response.json();
454    } else {
455      throw new Error('Request failed with status: ' + response.status);
456    }
457  }) .then(data => {
458    if(!data?.authorised) {
459      return;
460    } 
461    let bookmark_state = data?.bookmarked
462    if(bookmark_state) {
463      document.querySelector(`#remove-bookmark-btn-${id}`).style.display="block"
464    } 
465    else {
466      document.querySelector(`#add-bookmark-btn-${id}`).style.display="block"
467    }
468    document.getElementById(`bookmark-redirect-btn-${id}`).style.display="none"
469  }) .catch((error) => {
470    console.log(error)
471  });
472}
473
474
475if(allow_login_wall && access_wall_version != "2.0") {
476  function handleLoginWallDisplay(show=false){
477    if(show){
478      if(loginWall?.classList.contains('hide')) {
479        loginWall?.classList.remove('hide')
480        loginWall?.classList.add('show')
481      }
482    }else {
483      if(loginWall?.classList.contains('show')) {
484        loginWall?.classList.remove('show')
485        loginWall?.classList.add('hide')
486      }
487    }
488  }
489  let loginWall = document.querySelector('.login-wall')
490window.addEventListener('load', ()=>{
491
492  document.querySelector('.login-wall .login-wall--inner button')?.addEventListener('click', ()=> handleLoginWallDisplay(false))
493  document.querySelector('.nav-user-account  button')?.addEventListener('click', ()=> handleLoginWallDisplay(false))
494  document.querySelector('.close-sign-up-btn')?.addEventListener('click', ()=> handleLoginWallDisplay(true))
495
496  window.addEventListener('scroll', function() {
497    const articleHeight = document.querySelector('#postContent').clientHeight;
498    const scrollPosition = window.scrollY;
499    const threshold = articleHeight * allow_scroll_height;
500
501    if (scrollPosition > threshold) {
502      loginWall?.classList.remove('hide');
503      loginWall?.classList.add('show');
504      loginWall?.classList.remove('loginwall-visible')
505    } else if(loginWall?.classList.contains('show') && !loginWall?.classList.contains('loginwall-visible')) {
506      loginWall?.classList.add('hide');
507      loginWall?.classList.remove('show');
508    }
509  });
510
511} )
512}
513
514window.show_full_article=(e)=>{
515  const post_id = e
516  $('#article_tag_'+post_id).removeClass("hide_article_content");
517  $('#recomened_article_list_'+post_id).removeClass("hide_article_content");
518  $('#recomened_article_title_'+post_id).removeClass("hide_article_content");
519  $('#newsletter_div_'+post_id).removeClass("hide_article_content");
520  $('#article_div_'+post_id+' #postContent').removeClass("cropped");
521  $('#article_div_'+post_id+' #postContent').removeClass("hide-full-content");
522  $('#desktop_ap_after_article_'+post_id).removeClass("hide_article_content");
523  $(this).parent().css("display", "none");
524  document.querySelector('#vuukle-module')?.classList.remove("hide_article_content");
525}
526
527function handle_next_page_login_elements(body){
528  let login_wall_section = document.getElementById('login_Wall_section')
529  let is_reader_logged_in = $(`#reader-login-status`).html()
530  if(is_reader_logged_in == 1 && login_wall_section) { 
531    // handle display of global login wall article
532    if(hide_full_content != "false") body.querySelector('#postContent')?.classList.remove("hide-full-content")
533  }
534}
535
536function get_video_icon() {
537  return `<svg xmlns="http://www.w3.org/2000/svg"
538            xmlns:xlink="http://www.w3.org/1999/xlink" width="100%" height="100%"
539            viewBox="0 0 71.393 71.393" style="margin: auto;">
540            <defs>
541                <filter id="Path_12" x="0" y="0" width="71.393" height="71.393"
542                        filterUnits="userSpaceOnUse">
543                    <feGaussianBlur stdDeviation="1" result="blur"/>
544                    <feFlood flood-opacity="0.161"/>
545                    <feComposite operator="in" in2="blur"/>
546                    <feComposite in="SourceGraphic"/>
547                </filter>
548                <filter id="Path_13" x="21.557" y="14.418" width="40.418"
549                        height="46.557" filterUnits="userSpaceOnUse">
550                    <feGaussianBlur stdDeviation="3" result="blur-2"/>
551                    <feFlood flood-opacity="0.161"/>
552                    <feComposite operator="in" in2="blur-2"/>
553                    <feComposite in="SourceGraphic"/>
554                </filter>
555            </defs>
556            <g id="Icon_feather-play-circle" data-name="Icon feather-play-circle"
557            transform="translate(8 4)">
558                <g transform="matrix(1, 0, 0, 1, -8, -4)" filter="url(#Path_12)">
559                    <path id="Path_12-2" data-name="Path 12"
560                        d="M64.393,33.7A30.7,30.7,0,1,1,33.7,3,30.7,30.7,0,0,1,64.393,33.7Z"
561                        transform="translate(5 1)" fill="none" stroke="#fff"
562                        stroke-linecap="round" stroke-linejoin="round"
563                        stroke-width="4"/>
564                </g>
565                <g transform="matrix(1, 0, 0, 1, -8, -4)" filter="url(#Path_13)">
566                    <path id="Path_13-2" data-name="Path 13"
567                        d="M15,12,33.418,24.279,15,36.557Z"
568                        transform="translate(17.56 10.42)" fill="none" stroke="#fff"
569                        stroke-linecap="round" stroke-linejoin="round"
570                        stroke-width="4"/>
571                </g>
572            </g>
573        </svg>`
574}
575
576related_articles = (primary_category)=>{
577  $.ajax({
578    method:'get',
579    url:'/get_recommended_posts/'+primary_category,
580    dataType: 'json',
581    success: function(res){
582      var post_items = res.items.recommended_posts
583      var related_articles = ""
584      if(post_items.length > 0){
585        $(".related_show").css('display','block')
586        var author = {'name':'','slug':''}    
587        $('#realted_articles_divider').css('display','block')
588        for(let i = 0; i<post_items.length;i++){
589          if(post_items[i].contributors.length > 0){
590            author = post_items[i].contributors[0]
591          }
592          else{
593            author = post_items[i].member
594          }
595          if(check_duplicate(post_items[i].legacy_url)){
596            continue
597          }
598          related_articles +=  `<div class="col-sm-4 col-md-4 col-lg-4" style="margin-bottom: 20px;
599                                    margin: 10px;">
600                                            <div class="related-carousel analytics-related-article-comp post-collection">
601                                            <a href="${post_items[i].legacy_url}" aria-label="${post_items[i].title}">
602                                                <div class="small-post rec-article-tile">
603                                                    <div class="post-cover" style="margin: 0px;">
604 
605                                                        <img class="image cover ${enable_native_legacy_ui ?  " " :"aspect-ratio" } " width="${enable_native_legacy_ui ?  "230" :"260" }"  style="object-fit: cover; ${window?.get_image_style_from_meta_data?.(post_items[i]?.media_file_banner)}" src="${post_items[i].short_banner_url}" loading="lazy" alt="${post_items[i].title}">
606                                                        <span class="recommended-icon ${post_items[i].video_block_cssclass}">
607                                                                ${get_video_icon()}
608                                                            </span>
609                                                            <span class="recommended-icon ${post_items[i].web_story_block_cssclass}"
610                                                                >
611                                                                  <amp-img
612                                                                  alt="logo"
613                                                                  class="web-story-recommended-logo"
614                                                                  src="${web_story_logo}"
615                                                                  width="100"
616                                                                  height="100"
617                                                                  layout="fill"
618                                                              ></amp-img>
619                                                            </span>
620                                                            <span class="recommended-icon ${post_items[i].gallery_block_cssclass}">
621                                                                <amp-img
622                                                                alt="web-stroy-logo"
623                                                                class="gallery-logo"
624                                                                src="${gallery_logo}"
625                                                                width="100"
626                                                                height="100"
627                                                                layout="fill"
628                                                                ></amp-img>
629                                                            </span>
630                                                            ${get_live_icon(post_items[i])}
631                                                    </div>
632                                                    <div class="para-rec">
633                                                    <div class="rec-article-title primary_font">
634                                                      ${post_items[i].title}
635                                                    </div>
636                                                    </div>
637                                                </div>
638                                        
639                                            </a>
640                                            </div>
641                                    </div>`
642            
643        }
644        const amp_base_carousel = `
645                              <amp-base-carousel width="${enable_native_legacy_ui ?  "750" :"888" }" height="${ enable_native_legacy_ui ?  "300" :"340" }" layout="responsive" snap="true"  visible-count="3" auto-advance="true" auto-advance-interval="3000" loop="true"> 
646                              ${related_articles}
647                            </amp-base-carousel>`
648        $("#related_articles").append(amp_base_carousel)
649      
650      }
651      else{
652        console.error("error")
653      }
654    }
655   
656})}
657
658
659let PaywallDetails = (legacy_url)=>{
660  fetch(`/reader/details?legacy_url=${legacy_url}`)
661  .then((response) => {
662    return response.json();
663  })
664  .then((data) => {
665  if(data?.items[0].legacy_url == legacy_url){
666    if(data?.items[0].readability_status == "1"){
667      document.querySelector('#postContent')?.classList.remove("hide-full-content")
668      document.getElementById('post-container').style.display =""
669      document.querySelector('.login-wall')?.classList.add("d-none")
670      document.querySelector('.bottom-shadow-mobile')?.classList.add("d-none")
671      document.querySelectorAll('.access-wall-comp').forEach(function(element) {element.classList.remove('d-none');});
672      handleLoginWallDisplay(true)
673      accessWallArticleDisplay()
674    }
675    else{
676      document.querySelector(`#reader-login-status`).innerHTML = 2
677      document.querySelector('#postContent')?.classList.add("hide-full-content")
678      document.querySelector('.login-wall')?.classList.remove("d-none")
679      document.querySelector('.bottom-shadow-mobile')?.classList.remove("d-none")
680      handleLoginWallDisplay(false)
681      let paywall_container = document.getElementById('pub-paywall-container')
682      if(paywall_container){
683        paywall_container.innerHTML += paywall_content_html(data?.items[0].paywall)
684        document.getElementById('pub-paywall-container').style.backgroundColor = data?.items[0].paywall.content.background_color
685        document.getElementById('pub-cta-btn').addEventListener('click', function(){
686          localStorage.setItem('redirect_url', window.location.href);
687          console.log('URL stored in localStorage');
688          // or alert('URL stored in localStorage');
689        })
690      }
691    }
692  }
693  })
694  .catch(err => {
695    console.log(err);
696  })
697}
698
699function unhide_full_content() {
700  document.querySelector("#postContent")?.classList.remove("hide-full-content");
701  document.getElementById("post-container").style.display = "";
702  document.querySelector(".login-wall")?.classList.add("d-none");
703  document.querySelector(".bottom-shadow-mobile")?.classList.add("d-none");
704  document.querySelectorAll(".access-wall-comp").forEach(function (element) {
705    element.classList.remove("d-none");
706  });
707  handleLoginWallDisplay(true);
708}
709
710function show_paywall(itemData) {
711  document.querySelector(`#reader-login-status`).innerHTML = 2;
712  document.querySelector("#postContent")?.classList.add("hide-full-content");
713  document.querySelector(".login-wall")?.classList.remove("d-none");
714  document.querySelector(".bottom-shadow-mobile")?.classList.remove("d-none");
715  handleLoginWallDisplay(false);
716  
717  let paywall_container = document.getElementById("pub-paywall-container");
718  if (paywall_container) {
719    paywall_container.innerHTML += paywall_content_html(itemData.paywall);
720    document.getElementById("pub-paywall-container").style.backgroundColor = itemData.paywall.content.background_color;
721    document.getElementById("pub-cta-btn").addEventListener("click", function () {
722      localStorage.setItem("redirect_url", window.location.href);
723    })
724  }
725}
726
727let HandleMulitpleCta =(data)=>{
728  try{
729    if(data.content.cta.length >= 1){  
730      let cta_data = data.content.cta
731      let cta_btns = ""
732      for (let i = 0; i < cta_data.length; i++) {
733        cta_btns += `
734        <a id="pub-cta-btn" class="pub-wall-btn" style="background-color:${data.content?.link_color};color:${data.content?.text_color}" href="${cta_data[i].cta_link}" aria-label="">${cta_data[i].cta_text}</a>
735        `
736      }
737      return cta_btns
738    }
739  }
740  catch(err){
741    console.error("error",err)
742  }
743  return ''
744}
745
746document.addEventListener('DOMContentLoaded', function() {
747  if(access_wall_version != "2.0" && post_access_type == "Paid"){
748    PaywallDetails(article_legacy_url)
749  }
750});
751
752let paywall_content_html = (data)=>{
753  return `
754  <div class="login-wall--inner" style="background-color:${data.content.background_color};color:${data.content?.text_color};">
755    <img src="${data.content.logo}" id="pub-paywall-logo" alt="login-icon">
756    <div id="pub_paywall_content">
757      ${data.content.information}
758    </div>
759    ${HandleMulitpleCta(data)}
760  </div>
761  `
762}
763
764function get_live_icon(items){
765  try{
766    return `
767    <div class="live-blog-icon ${items.live_block_cssclass}">
768      <span >
769          LIVE
770      </span>
771    </div>
772    `
773  }catch(err){
774    console.log('live log',err)
775    return ``
776  }
777}

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.