Ralph Nader Remembers Michael Pertschuk
Ralph Nader #RalphNader
‘; newWin.document.write(NewDocumentWrite); // newWin.addEventListener(‘load’,function(){ // }); newWin.print(); newWin.close(); } /* * @function for print article */ function tn_print_fn(){ var tn_current_url=window.location.href; if(check_comment == true){ window.open(tn_current_url+’?print=1&comment=1′,’_blank’); }else{ window.open(tn_current_url+’?print=1′,’_blank’); } return false; } /* * @function sailthru action tout */ function add_action_tout_sailthru(post_id){ var ajaxurl=ajax_object.ajax_url; var sailthru_email_take_action = document.getElementById(‘take_action_sailthru_email_’+post_id).value; if(sailthru_email_take_action!=”){ var take_action_sailthru_list_final = document.getElementById(‘take_action_sailthru_list_final_’+post_id).value; var action_tout_sailthru=’action_tout_sailthru’; jQuery.ajax({ url :ajaxurl, type :”POST”, data :”sailthru_email_take_action=”+sailthru_email_take_action+”&take_action_sailthru_list_final=”+take_action_sailthru_list_final+”&action=”+action_tout_sailthru, success : function(data){ document.getElementById(‘action_tout_response_’+post_id).innerHTML=data; document.getElementById(‘take_action_sailthru_email_’+post_id).value=”; } }); }else{ var error_msg=’Please Enter Email’; document.getElementById(‘action_tout_response_’+post_id).innerHTML=error_msg; } } /* * Check for logged in user */ function getParaOneNextStep( articlePostId, step ){ if( typeof articlePostId !== typeof undefined && is_user_logged_in!=null && typeof paragraph_module!=typeof undefined && paragraph_module[articlePostId][step].user_logged_in==1 ){ step = parseInt(step)+1; step = ( step > 5 )? 0 : step; step = getParaOneNextStep( articlePostId, step ); } return step; } /* * @function Email Sign Up Logic */ function email_signup_module( articlePostId ){ /* * Check For Email Sign Up Cookie */ if( typeof paragraph_module[articlePostId] !== typeof undefined ){ /* Hide All */ $(“.abody-“+articlePostId+” .email-signup-module”).hide(); /* Hide All */ var TNstep = getCookie(‘TNstep’); if( TNstep!=null ){ var step = getParaOneNextStep(articlePostId, TNstep); $(“.abody-“+articlePostId+” .email-signup-module.para-one-“+paragraph_module[articlePostId][step].order+””).show(); /* show event tracking */ paragraphOneShowEvent(articlePostId, step); /* show event tracking */ }else{ var TNlifetime = getCookie(‘TNlifetime’); if( TNlifetime!=null ){ nextTNstep = parseInt(TNlifetime)+1; nextTNstep = ( nextTNstep > 5 )? 0 : nextTNstep; var step = getParaOneNextStep(articlePostId, nextTNstep); var cookieDateTNstep = new Date(); cookieDateTNstep.setTime(cookieDateTNstep.getTime() + (30*24*60*60*1000)); document.cookie = “TNstep=”+step+”;expires=”+cookieDateTNstep.toUTCString()+”;path=/”; var cookieDateTNlifetime = new Date(); cookieDateTNlifetime.setTime(cookieDateTNlifetime.getTime() + (10*365*24*60*60*1000)); document.cookie = “TNlifetime=”+step+”;expires=”+cookieDateTNlifetime.toUTCString()+”;path=/”; $(“.abody-“+articlePostId+” .email-signup-module.para-one-“+paragraph_module[articlePostId][step].order+””).show(); /* show event tracking */ paragraphOneShowEvent(articlePostId,step); /* show event tracking */ }else{ var step = getParaOneNextStep(articlePostId, 0); var cookieDateTNstep = new Date(); cookieDateTNstep.setTime(cookieDateTNstep.getTime() + (30*24*60*60*1000)); document.cookie = “TNstep=”+step+”;expires=”+cookieDateTNstep.toUTCString()+”;path=/”; var cookieDateTNlifetime = new Date(); cookieDateTNlifetime.setTime(cookieDateTNlifetime.getTime() + (10*365*24*60*60*1000)); document.cookie = “TNlifetime=”+step+”;expires=”+cookieDateTNlifetime.toUTCString()+”;path=/”; $(“.abody-“+articlePostId+” .email-signup-module.para-one-“+paragraph_module[articlePostId][step].order+””).show(); /* show event tracking */ paragraphOneShowEvent(articlePostId, step); /* show event tracking */ } } } } /* * Event Tracking Functions */ /* Paragraph One Show Event Trigger */ function paragraphOneShowEvent( articlePostId, step ){ if( typeof articlePostId !== typeof undefined && typeof step !== typeof undefined && (typeof paragraph_module[articlePostId] !== typeof undefined) && (paragraph_module[articlePostId][step].event_name!=””) ){ /* * Track Views paragraph one module GTM */ dataLayer.push({ ‘event’: ‘gaParagraphOneShowEvent’, ‘gaEventCategory’: ”+ paragraph_module[articlePostId][step].event_name +”, ‘gaEventAction’: ”+ paragraph_module[articlePostId][step].event_name +’-show’, ‘gaEventLabel’: document.URL, }); } } /* Paragraph One Click Event Trigger */ function paragraphOneClickEvent( articlePostId, step ){ if( typeof articlePostId !== typeof undefined && typeof step !== typeof undefined && (typeof paragraph_module[articlePostId] !== typeof undefined) && (paragraph_module[articlePostId][step].event_name!=””) ){ dataLayer.push({ ‘event’: ‘gaParagraphOneEvent’, ‘gaEventCategory’: ”+ paragraph_module[articlePostId][step].event_name +”, ‘gaEventAction’: ”+ paragraph_module[articlePostId][step].event_name +’-click’, ‘gaEventLabel’: document.URL, }); } } /* * Event Tracking Functions */ /* Related Single Article */ function relatedSingleArticle( articlePostId ){ if( jQuery(“.postid-“+articlePostId+” .expand-reduce”).length ==0 || jQuery(“.postid-“+articlePostId+” .expand-close”).length !=0 ){ if( jQuery(“.postid-“+articlePostId+” aside.related-oneup”).length > 0 ){ var count = jQuery(“.postid-“+articlePostId+” aside.related-oneup”).length; for( i=0; i 0 ){ var count = jQuery(“.postid-“+articlePostId+” aside.related-multi”).length; for( i=0; i 0 ){ /* * Track Views Current Issue Module GTM */ dataLayer.push({ ‘event’: ‘gaCurrentIssueModuleShowEvent’, ‘gaEventCategory’: ‘current-issue-module’, ‘gaEventAction’: ‘current-issue-module-show’, ‘gaEventLabel’: document.URL, }); } } } /* Inline CTA 1 Views */ function inlineCtaOne( articlePostId ){ if( jQuery(“.postid-“+articlePostId+” .expand-reduce”).length ==0 || jQuery(“.postid-“+articlePostId+” .expand-close”).length !=0 ){ if( jQuery(“.postid-“+articlePostId+” aside.inline-cta-1″).length > 0 ){ /* * Track Views Current Issue Module GTM */ dataLayer.push({ ‘event’: ‘gaInlineCtaOneShowEvent’, ‘gaEventCategory’: ‘inline-cta-1’, ‘gaEventAction’: ‘inline-cta-1-show’, ‘gaEventLabel’: document.URL, }); } } } /* Inline CTA 2 Views */ function inlineCtaTwo( articlePostId ){ if( jQuery(“.postid-“+articlePostId+” .expand-reduce”).length ==0 || jQuery(“.postid-“+articlePostId+” .expand-close”).length !=0 ){ if( jQuery(“.postid-“+articlePostId+” aside.inline-cta-2″).length > 0 ){ /* * Track Views Current Issue Module GTM */ dataLayer.push({ ‘event’: ‘gaInlineCtaTwoShowEvent’, ‘gaEventCategory’: ‘inline-cta-2’, ‘gaEventAction’: ‘inline-cta-2-show’, ‘gaEventLabel’: document.URL, }); } } } function inlineCtaSignup( articlePostId ){ if( jQuery(“.postid-“+articlePostId+” .expand-reduce”).length ==0 || jQuery(“.postid-“+articlePostId+” .expand-close”).length !=0 ){ if( jQuery(“.postid-“+articlePostId+” aside.inline-cta_form”).length > 0 ){ /* * Track Views Current Issue Module GTM */ dataLayer.push({ ‘event’: ‘gaInlineCtaSignupShowEvent’, ‘gaEventCategory’: ‘inline-cta-signup’, ‘gaEventAction’: ‘inline-cta-signup-show’, ‘gaEventLabel’: document.URL, }); } } } /* Author Highlight Views */ function authorHighlight( articlePostId ){ if( jQuery(“.postid-“+articlePostId+” .expand-reduce”).length ==0 || jQuery(“.postid-“+articlePostId+” .expand-close”).length !=0 ){ if( jQuery(“.postid-“+articlePostId+” aside.author-modules”).length > 0 ){ /* * Track Views Author Highlight GTM */ dataLayer.push({ ‘event’: ‘gaAuthorHighlightShowEvent’, ‘gaEventCategory’: ‘author-Highlight’, ‘gaEventAction’: ‘author-Highlight-show’, ‘gaEventLabel’: document.URL, }); } } } /* Series Module Views */ function seriesModule( articlePostId ){ if( jQuery(“.postid-“+articlePostId+” .expand-reduce”).length ==0 || jQuery(“.postid-“+articlePostId+” .expand-close”).length !=0 ){ if( jQuery(“.postid-“+articlePostId+” aside.series-modules”).length > 0 ){ /* * Track Views Series Module GTM */ dataLayer.push({ ‘event’: ‘gaSeriesModuleShowEvent’, ‘gaEventCategory’: ‘series-module’, ‘gaEventAction’: ‘series-module-show’, ‘gaEventLabel’: document.URL, }); } } } /* Comment Module Views */ function commentModule( articlePostId ){ if( jQuery(“.postid-“+articlePostId+” .expand-reduce”).length ==0 || jQuery(“.postid-“+articlePostId+” .expand-close”).length !=0 ){ if( jQuery(“.postid-“+articlePostId+” aside.comment-module”).length > 0 ){ /* * Track Views Comment Module GTM */ dataLayer.push({ ‘event’: ‘gaCommentsModuleShowEvent’, ‘gaEventCategory’: ‘comments-module’, ‘gaEventAction’: ‘comments-module-show’, ‘gaEventLabel’: document.URL, }); } } } /* Books Salad Views */ function booksSalad( articlePostId ){ if( jQuery(“.postid-“+articlePostId+” .expand-reduce”).length ==0 || jQuery(“.postid-“+articlePostId+” .expand-close”).length !=0 ){ if( jQuery(“.postid-“+articlePostId+” aside.book-module”).length > 0 ){ /* * Track Views Books Salad GTM */ dataLayer.push({ ‘event’: ‘gaBooksSaladShowEvent’, ‘gaEventCategory’: ‘books-salad’, ‘gaEventAction’: ‘books-salad-show’, ‘gaEventLabel’: document.URL, }); } } } /* Action Tout Module Views */ function actionToutModule( articlePostId ){ if( jQuery(“.postid-“+articlePostId+” .expand-reduce”).length ==0 || jQuery(“.postid-“+articlePostId+” .expand-close”).length !=0 ){ if( jQuery(“.postid-“+articlePostId+” aside.takeaction”).length > 0 ){ /* * Track Views Action Tout Module GTM */ dataLayer.push({ ‘event’: ‘gaActionToutModuleShowEvent’, ‘gaEventCategory’: ‘action-tout-module’, ‘gaEventAction’: ‘action-tout-module-show’, ‘gaEventLabel’: document.URL, }); } } } /* Sidebar Community Module Views */ function sidebarCommunityModule( articlePostId ){ if( jQuery(“.postid-“+articlePostId+” .expand-reduce”).length ==0 || jQuery(“.postid-“+articlePostId+” .expand-close”).length !=0 ){ if( jQuery(“.postid-“+articlePostId+” aside.n-community”).length > 0 ){ /* * Track Views Sidebar Community Module GTM */ dataLayer.push({ ‘event’: ‘gaSidebarShowEvent’, ‘gaEventCategory’: ‘sidebar-community’, ‘gaEventAction’: ‘sidebar-community-show’, ‘gaEventLabel’: document.URL, }); } } } /* Taxnonomy and Author GA Event on single article page */ function gaTaxonomyAuthor( gaEventCategory, gaEventAction, gaEventLabel ){ dataLayer.push({ “event”: “gaglobaltaxonomyauthor”, “gaEventCategory”: gaEventCategory, “gaEventAction”: gaEventAction, “gaEventLabel”: gaEventLabel }); } jQuery( document ).ready(function($) { /*============== Variables ==================*/ var preventLoad_article = false; var flag = false; var $e = $(‘.article-body’).children().last(); var $t = $e.prop(“tagName”); var tagsArray = [‘FORM’,’ASIDE’]; var anothertagsArray = {‘UL’:’li’,’OL’:’li’,’BLOCKQUOTE’:’p’}; var url_id = window.location.hash.substr(1); var pageChange = 1; var articlePostId = 437720; var count = 1; var article_divider = 1; var loagAgn = false; var scroll_art_recric = true; var list; /*============== Variables ==================*/ /* Taxnonomy and Author GA Event on single article page */ var allSubject = $(‘.postid-‘+articlePostId+’ input[name=”tpTags”]’).val(); var allAuthor = $(‘.postid-‘+articlePostId+’ input[name=”tpContentAuthor”]’).val(); var first_article_title = $(‘.postid-‘+articlePostId).attr(‘articlelisttitle’); var first_article_path = $(‘.postid-‘+articlePostId).attr(‘articlelistlinks’); var allSubject = allSubject.split(‘,’); $.each( allSubject, function( i, allsubval ) { gaTaxonomyAuthor( allsubval, first_article_title, first_article_path ); }); var allAuthor = allAuthor.split(‘,’); $.each( allAuthor, function( i, allautval ) { gaTaxonomyAuthor( allautval, first_article_title, first_article_path ); }); /* * Body content image in gallery */ $(‘section.article-body img’).each(function() { if($(this).parent(“a”).parent(“figure”).hasClass(‘bx-item’)){ flag = true; }else{ var href_val = $(this).parent(“a”).attr(‘href’); var img_src = $(this).attr(‘src’); if( href_val === img_src && !$(this).parents().hasClass(“email-signup-module”) ){ $(this).parent(“a”).addClass(“gallery”); }else{ if( !$(this).parent(“a”).hasClass(“no-target-blank”) ){ $(this).parent(“a”).attr(‘target’,’_blank’); } } } }); /* * Run image slider */ if(flag){ runSlider(jQuery(‘.gallery-2′)); } /* * Email Sign Up */ if(!flag){ email_signup_module( 437720 ); } /* * Article N logo */ articleNLogo( 437720 ); /* * Related Single Article Track */ relatedSingleArticle( 437720 ); /* * Related Multiple Article Track */ relatedMultiArticle( 437720 ); /* * Current Issue Module Track */ currentIssueModule( 437720 ); /* * Inline CTA One Track */ inlineCtaOne( 437720 ); /* * Inline CTA Two Track */ inlineCtaTwo( 437720 ); /* * Inline CTA Signup Track */ inlineCtaSignup( 437720 ); /* * Author Highlight Track */ authorHighlight( 437720 ); /* * Series Module Track */ seriesModule( 437720 ); /* * Comment Module Track */ commentModule( 437720 ); /* * Books Salad Track */ booksSalad( 437720 ); /* * Action Tout Module Track */ actionToutModule( 437720 ); /* * Sidebar Community Module Track */ sidebarCommunityModule( 437720 ); /* * @function for print article */ /* * Check for video */ /* * Red dot after article content */ if(jQuery.inArray($t, tagsArray )!=’-1′){ }else{ if($t in anothertagsArray){ $(‘.article-body > p:last-of-type’).toggleClass(‘changed’); $e.find(anothertagsArray[$t]+’:last’).addClass(‘redotclass’); } } /* * this wrapped in jQuery will give us the current .letter-q div */ $(‘figure’).each(function(){ if( $(this).hasClass(‘alignright’)||$(this).hasClass(‘alignleft’) || $(this).hasClass(‘aligncenter’) ){ $(this).after(‘
‘); } }); /* * Scroll IF # id exist in URL */ if(url_id!=”){ var s = url_id; var n = s.indexOf(‘/’); if(n!=”&& typeof n!= ‘undefined’){ var id_var = s.substring(0, n != -1 ? n : s.length); $(‘html, body’).animate({ scrollTop: $(‘#’+id_var).offset().top },2000); return false; } } /* * Check for audio */ /* * script to handle Back Button Event */ if(window.attachEvent){ window.attachEvent(‘onpopstate’, datHash); } function datHash(event){ var str = $(‘#goback’).val(); if(str==”){ window.history.go(-Math.abs(pageChange)); }else{ window.history.go(-Math.abs(pageChange)); } return false; } /* * */ $(‘.post-edit-link’).attr(‘href’, function( _, action){ return action.replace(‘https’, ‘http’); }); /* * @function for load article in infinite scroll */ $(‘a.inifiniteLoader’).hide(); function loadArticle(pageNumber){ $(‘a.inifiniteLoader’).show(‘fast’); $.ajax({ url : “https://www.thenation.com/wp-admin/admin-ajax.php”, type : ‘POST’, cache : false, dataType : ‘json’, data : {action:’infinite_scroll’,page_no: pageNumber,loop_file: ‘articleload’,slug:’activism,congress,democrats,government,health-and-disease,inequality,republicans,science-and-health,society,the-left,conservatives-and-the-american-right’,curr_post_id:’437720′}, success : function(receivedHTML){ if ( typeof receivedHTML == ‘object’ && receivedHTML!=null ){ if(typeof receivedHTML.html!==’undefined’ && receivedHTML.html!=”){ html = receivedHTML.html; } }else{ $(‘a.inifiniteLoader’).hide(); $(“#single_article_footer”).show(); } $(‘a.inifiniteLoader’).hide(‘1000’); if ( typeof receivedHTML == ‘object’ && receivedHTML!=null ){ $(“#wrap”).append(html); // This will be the div where our content will be loaded var postID = $($.parseHTML(html)).filter(“.scrolltrace”).attr(‘article-post-id’); var postLink = $($.parseHTML(html)).filter(“.scrolltrace”).attr(‘articlelistlinks’); var postTitle = $($.parseHTML(html)).filter(“.scrolltrace”).attr(‘articlelisttitle’); $(‘.abody-‘+postID+’ .article-body-inner’).children(‘p:first-of-type’).html(function (i, html) { if ( $(‘.abody-‘+postID).children(‘img’).length == “0” ){ var text = $(‘.abody-‘+postID+’ .article-body-inner’).children(‘p:first-of-type’).html(); $(‘.abody-‘+postID+’ .article-body-inner’).children(‘p:first-of-type’).html(text.replace(/^()?([A-Za-z0-9])/g,’$1$2′)); } }); if( !$(‘.abody-‘ + postID +”).parent().parent().hasClass(‘textContainer_Truncate’) ){ $(”).insertAfter(‘.abody-‘ + postID); } if($(‘.abody-‘+postID).parent().parent()){ $(‘.abody-‘+postID).parent().parent().attr(“aria-posinset”, pageNumber); $(‘.abody-‘+postID).parent().parent().attr(“aria-setsize”, “-1″); } /* * Article Divider Count */ article_divider = article_divider+1; $(‘.abody-‘+postID+”).attr(“article-number”,article_divider); /*for hiding meterpaywall popups when pixel ads call starts here*/ var hidePixelBool = false; var meetkatstep1 = jQuery(‘#paywall .step.one’); var meetkatstep2 = jQuery(‘#paywall .step.two’); var meetkatstep3 = jQuery(‘#paywall .step.three’); var meetkatstep4 = jQuery(‘#paywall .step.four’); if( typeof meetkatstep1!=’undefined’ && meetkatstep1.is(‘:visible’) ){ hidePixelBool = true; } if ( typeof meetkatstep2!=’undefined’ && meetkatstep2.is(‘:visible’) ){ hidePixelBool = true; } if( typeof meetkatstep3!=’undefined’ && meetkatstep3.is(‘:visible’) ){ hidePixelBool = true; } if( typeof meetkatstep4!=’undefined’ && meetkatstep4.is(‘:visible’) ){ hidePixelBool = true; } if( hidePixelBool===false ){ /*for hiding meterpaywall popups when pixel ads call ends here*/ /****Alternate Popup code start*********/ var enable_alterpopup_check; enable_alterpopup_check =”; if( typeof(enable_alterpopup_check) != “undefined” && enable_alterpopup_check == 1 ){ var alternate_article_no; alternate_article_no = ”; if( pageCounterPaywall % alternate_article_no == 0 && pageCounterPaywall!=0 ){ show_lightbox(”,”); } } /******Alternate Popup code End********/ } pageCounterPaywall++; ajaxCarousel(postID); ajaxGallery(postID); articleNLogo(postID); /** Slider Content **/ flag = false; $(‘section.article-body:last img’).each(function(){ if($(this).parent(“a”).parent(“figure”).hasClass(‘bx-item’)){ flag = true; }else{ $(this).parent(“a”).addClass(“gallery”); } }); if(flag){ var k = $(‘section.article-body:last’).find(‘.gallery-2’).bxSlider({ adaptiveHeight: true, adaptiveHeightSpeed: 500, infiniteLoop: false, hideControlOnEnd: false, pager: false }); k.reloadSlider(); } /* Slider Content End */ var usera = navigator.userAgent.toLowerCase(); if ( $(‘.article-page’).length ) { var slickWidth = $(‘.article-list.slick-slide’).width(); if ($(‘.ie9’).length){ slickWidth = $(‘.recirc-carousel.slick-initialized.slick-slider’).width(); } $(‘.slick-list.draggable’).css({‘width’ : slickWidth}); if( !/android|webos|iphone|ipad|ipod|blackberry/i.test(usera) ){ $(‘.article-list.slick-slide’).children(‘li’).css({‘width’ : slickWidth}); $(‘.slick-list’).css({‘width’ : slickWidth}); } } var $newArticles = $(html); var imagesLoading = []; $newArticles.find(‘img’).each(function() { // For each image, create a new deferred object that resolves when the // image has loaded and add that to an array of deferred objects. var loadingImage = $.Deferred(); imagesLoading.push(loadingImage); // “this” is the image element here and should have a complete property. // See http://stackoverflow.com/a/24201249 if (this.complete){ loadingImage.resolve(); }else{ var adTimeout = window.setTimeout(function() { loadingImage.resolve(); }, 3000); this.addEventListener(‘load’, function() { loadingImage.resolve(); window.clearTimeout(adTimeout); }); this.addEventListener(‘error’, function() { // We really don’t care if the image never loads, but we still need // to resolve the promise so that we can reset the waypoints. loadingImage.resolve(); window.clearTimeout(adTimeout); }); // Clean up event listeners this.removeEventListener(‘load’, function() { loadingImage.resolve(); window.clearTimeout(adTimeout); }); this.removeEventListener(‘error’, function() { loadingImage.resolve(); window.clearTimeout(adTimeout); }); } }); $.when.apply(this, imagesLoading).then(function() { fixedAds($(‘.postid-‘ + postID).children(‘article’)); }, function() { }); /**Inifnite Scroll Share This */ var newSharePostID = window.__sharethis__.config[‘inline-share-buttons’]; newSharePostID.id=”inline-share-button-“+postID; newSharePostID.url= postLink; newSharePostID.title= postTitle; var shareLoadPromise = new Promise(function(resolutionFunc,rejectionFunc){resolutionFunc()}); shareLoadPromise.then(function(){ window.__sharethis__.load(‘inline-share-buttons’, newSharePostID); }) .then(function(){ $(“#inline-share-button-“+postID+” > .st-last “).removeClass(“st-last”); $(“#inline-share-button-“+postID).append(‘
‘); }); if (getCookie(‘SESSuserinfo’) != false) { var tn_sfg_local = localStorage.getItem(“tn_sfg_local”); if (null != tn_sfg_local && undefined != tn_sfg_local && ” != tn_sfg_local) { tn_sfg_local = JSON.parse(tn_sfg_local); if (tn_sfg_local.includes(parseInt(postID))) { $(‘.currentScr’).find(‘.tn-sfg-add-to-list’).addClass(‘selected’); $(‘.currentScr’).find(‘.tn-sfg-add-to-list’).removeClass(‘hide’); }else { $(‘.currentScr’).find(‘.tn-sfg-add-to-list’).removeClass(‘hide’); } } else { $(‘.currentScr’).find(‘.tn-sfg-add-to-list’).removeClass(‘hide’); } } } } }); return false; } /* * Load second article on scroll */ $(window).bind(‘scroll’, function(){ $(‘.scrolltrace’).each(function(){ var post = $(this); var topp = post.position().top; var bott = post.position().top + post.height(); var pos = $(window).scrollTop(); if ( pos>=topp && pos 0){ }else{ window.history.pushState({}, “”, $(‘.currentScr’).attr(‘articlelistlinks’)); articlePostId = $(‘.currentScr’).attr(“article-post-id”); /*New non subscriber For Infinite Scroll*/ if (null != is_user_logged_in) { var tn_sfg_local = localStorage.getItem(“tn_sfg_local”); if (null != tn_sfg_local && undefined != tn_sfg_local && ” != tn_sfg_local) { tn_sfg_local = JSON.parse(tn_sfg_local); if (tn_sfg_local.includes(parseInt(articlePostId))) { $(‘.currentScr’).find(‘.tn-sfg-add-to-list’).addClass(‘selected’); $(‘.currentScr’).find(‘.tn-sfg-add-to-list’).removeClass(‘hide’); }else { $(‘.currentScr’).find(‘.tn-sfg-add-to-list’).removeClass(‘hide’); } } else { $(‘.currentScr’).find(‘.tn-sfg-add-to-list’).removeClass(‘hide’); } } /*New non subscriber For Infinite Scroll*/ var allSubject = $(‘.postid-‘+articlePostId+’.currentScr input[name=”tpTags”]’).val(); var allAuthor = $(‘.postid-‘+articlePostId+’.currentScr input[name=”tpContentAuthor”]’).val(); var username = getCookie(‘SESSname’); if(username != null){ _cbq.push([‘_acct’, ‘paid’]); }else{ _cbq.push([‘_acct’, ‘anon’]); } pSUPERFLY.virtualPage({ sections: allSubject, authors : allAuthor, path : window.location.pathname, title : $(‘.currentScr’).attr(‘articlelisttitle’) }); } /* Taxonomy and Author Trigger in GA Event Start */ var allSubject = allSubject.split(‘,’); $.each( allSubject, function( i, allsubval ) { gaTaxonomyAuthor( allsubval, $(‘.currentScr’).attr(‘articlelisttitle’), $(‘.currentScr’).attr(‘articlelistlinks’) ); }); var allAuthor = allAuthor.split(‘,’); $.each( allAuthor, function( i, allautval ) { gaTaxonomyAuthor( allautval, $(‘.currentScr’).attr(‘articlelisttitle’), $(‘.currentScr’).attr(‘articlelistlinks’) ); }); /* Taxonomy and Author Trigger in GA Event End */ /* * Call Email Signup for infinite scroll */ if( !$(‘.postid-‘+articlePostId+’ .article-body img’).parent(“a”).parent(“figure”).hasClass(‘bx-item’) ){ if( !$(“.abody-“+articlePostId+””).hasClass(“email-signup-visited”) ){ email_signup_module( articlePostId ); } } /* Content Page View Event */ dataLayer.push({ ‘event’: ‘gaPageViewEvent’, ‘gaEventCategory’: ‘article’, ‘gaEventAction’: $(‘.currentScr’).attr(‘articlelisttitle’), ‘gaEventLabel’: articlePostId, }); /* Content Page View Event */ /* * Article Divider Scrolled Over Total Count */ dataLayer.push({ ‘event’: ‘gaRecirculationEvent’, ‘gaEventCategory’: ‘recirculation’, ‘gaEventAction’: ‘article-divider-scrolled-over’, ‘gaEventLabel’: $(‘.currentScr’).attr(‘articlelistlinks’), }); /* * Article Divider Scrolled Over Individual Count */ article_number = $(‘.abody-‘+articlePostId+”).attr(“article-number”); if (typeof article_number !== typeof undefined && article_number !== false) { dataLayer.push({ ‘event’: ‘gaRecirculationEvent’, ‘gaEventCategory’: ‘recirculation’, ‘gaEventAction’: ‘article-divider-scrolled-over-‘+article_number+”, ‘gaEventLabel’: $(‘.currentScr’).attr(‘articlelistlinks’), }); } // Google Analytics for Infinite Scroll /*ga(‘send’, ‘pageview’, { ‘page’: $(‘.currentScr’).attr(‘articlelistlinks’), ‘title’: $(‘.currentScr’).attr(‘articlelisttitle’) });*/ ga(‘set’, ‘dimension1’, $(‘.currentScr’).find(‘.tn_publish_date’).text()); ga(‘send’, ‘pageview’, { ‘page’: window.location.pathname, ‘title’: $(‘.currentScr’).attr(‘articlelisttitle’) }); dataLayer.push({ ‘event’:’InfiniteScrollPageView’, ‘virtualPageURL’: window.location.pathname, ‘virtualPageTitle’ : $(‘.currentScr’).attr(‘articlelisttitle’) }); $(“nav.primary ul li.article-meta h2”).html($(‘.currentScr’).attr(‘articlelisttitle’).substring(0,100)); $(“title”).html($(‘.currentScr’).attr(‘articlelisttitle’)); var linktext = $(‘.currentScr’).find(“.anchor_subject”).html(); if ( linktext!=” ){ var linkredirectval =$(‘.currentScr’).find(“.anchor_subject”).attr(‘subjectlink’); if(typeof linkredirectval!=’undefined’){ var subject_head_link = “”+linktext+””; $(‘.tophead_subject’).html(subject_head_link); }else{ var subject_head_link = “”; $(‘.tophead_subject’).html(subject_head_link); } } pageChange = parseInt(pageChange) + 1; } }else{ $(this).removeClass(‘currentScr’); } }); $current_article = $(‘.scrolltrace.currentScr’); // Load next leaderboard ad on reach to bottom action tout if($current_article.hasClass(‘currentScr’)){ articlePostId = $(‘.currentScr’).attr(“article-post-id”); var windowTop = $(window).scrollTop(); if( $current_article.find(‘.expand-reduce’).length != 0 ){ if( !$(‘#expand-reduce-‘+articlePostId+”).hasClass(‘expand-close’) && !$(‘#expand-reduce-‘+articlePostId+”).hasClass(‘tn-first-expand’)){ if( $(‘.abody-‘+articlePostId+”).hasClass(‘keep-reading’) ){ /* Overflow Hidden Parent Div */ $(‘.abody-‘+articlePostId+”).parent().addClass(“keep-reading-parent”); /* Hide Article Footer */ $(‘#article-footer-‘+articlePostId+”).hide(); /* Hide Rev Content Block */ $(‘#tabola-block-‘+articlePostId+”).hide(); /* Hide aside wrap modules */ $(‘.scrolltrace.currentScr .aside-wrap .ad-wrap’).not(‘:eq(0)’).hide(); /* Show expand Reduce */ $(‘#expand-reduce-‘+articlePostId+”).show(); }else{ // Execute when the page loaded eval(“pushDataPianoOnInfinite_”+articlePostId+”()”); tp.experience.execute(); } } } } var loadPoint = $(‘.article-body:last’).offset().top – 68; if (loadPoint!=false && $(window).scrollTop() >= loadPoint){ if( $(‘.scrolltrace’).length==count ){ loagAgn = true; if(loagAgn){ count++; if(count < 6){ if(preventLoad_article==false){ loadArticle(count);//code } } if (count==6) { $('a.inifiniteLoader').hide(); $("#article-footer-last").show(); $("#single_article_footer").show(); /* * Track views of article footer last */ /* * Latest form the nation */ dataLayer.push({ 'event': 'gaInfiniteScrollfooterShowEvent', 'gaEventCategory': 'infinite-scroll-footer-latest-articles', 'gaEventAction': 'infinite-scroll-footer-latest-articles-show', 'gaEventLabel': document.URL, }); /* * Editor Picks */ dataLayer.push({ 'event': 'gaInfiniteScrollfooterShowEvent', 'gaEventCategory': 'infinite-scroll-footer-editor-picks', 'gaEventAction': 'infinite-scroll-footer-editor-picks-show', 'gaEventLabel': document.URL, }); } loagAgn = false; } } } $(".wpsdc-drop-cap").parent("p").addClass("drop_c"); }); /* * Change Height & Text Expand Reduce */ $(document).on('click', '.expand-reduce .expand-reduce-full, .expand-reduce .expand-reduce-keep', function(event){ event.preventDefault(); /** * Most Popular */ if ( undefined !== thenationmp ) { let thenation_infinite_article_most_popular = jQuery(".thenation-single-article-most-popular"); if ( null !== thenation_infinite_article_most_popular ) { thenation_infinite_article_most_popular.each(function(){ thenationmp.getSingleArticleMostPopular( jQuery(this) ); }); } } $(this).parents('.expand-reduce').toggleClass('expand-close'); var $article_id = $(this).attr('article-id'); setTimeout(function (){ eval("pushDataPianoOnInfinite_"+$article_id+"()"); // Execute when the page loaded tp.experience.execute(); /* * Related Single Article Track */ relatedSingleArticle( $article_id ); /* * Related Multiple Article Track */ relatedMultiArticle( $article_id ); /* * Current Issue Module Track */ currentIssueModule( $article_id ); /* * Inline CTA One Track */ inlineCtaOne( $article_id ); /* * Inline CTA Two Track */ inlineCtaTwo( $article_id ); /* * Inline CTA Two Track */ inlineCtaSignup( $article_id ); /* * Author Highlight Track */ authorHighlight( $article_id ); /* * Series Module Track */ seriesModule( $article_id ); /* * Comment Module Track */ commentModule( $article_id ); /* * Books Salad Track */ booksSalad( $article_id ); /* * Action Tout Module Track */ actionToutModule( $article_id ); /* * Sidebar Community Module Track */ sidebarCommunityModule( $article_id ); }, 2000); tp.push(["setCustomVariable", "book_and_arts_article", "false"]); $('.abody-'+$article_id+'').removeClass('keep-reading'); $('.abody-'+$article_id+'').removeClass('no-reading'); /* Overflow Visible Parent */ $('.abody-'+$article_id+'').parent().removeClass("keep-reading-parent"); /* Show Article Footer */ $('#article-footer-'+$article_id+'').show(); /* Show Rev Content Block */ $('#tabola-block-'+$article_id+'').show(); /* Show aside wrap modules */ $('.postid-'+$article_id+' .aside-wrap .ad-wrap').not(':eq(0)').show(); /* Hide expand Reduce */ $('#expand-reduce-'+$article_id+'').hide(); if (sharethis_infinite.includes($article_id) === false && 0 < $("#inline-share-button-"+$article_id ).length) { var x = $("#inline-share-button-"+$article_id).children(); for(var i = 0 ; i a’,function(){ /* * Click Event */ dataLayer.push({ ‘event’: ‘gaAuthorHighlight’, ‘gaEventCategory’: ‘author-Highlight’, ‘gaEventAction’: ‘author-Highlight-click’, ‘gaEventLabel’: $(this).attr(‘href’), }); }); /* * Click Event Tracking for Series Module */ $(document).on(‘click’, ‘.series-modules .series-modules-blocks .series-blocks > a’,function(){ /* * Click Event */ dataLayer.push({ ‘event’: ‘gaSeriesModule’, ‘gaEventCategory’: ‘series-module’, ‘gaEventAction’: ‘series-module-click’, ‘gaEventLabel’: $(this).attr(‘href’), }); }); /* * Click Event Tracking for Comment Module */ $(document).on(‘click’, ‘.comment-module .comment-blocks .cta input’,function(){ /* * Click Event */ dataLayer.push({ ‘event’: ‘gaCommentsModule’, ‘gaEventCategory’: ‘comments-module’, ‘gaEventAction’: ‘comments-module-click’, ‘gaEventLabel’: $(this).val(), }); }); /* * Click Event Tracking for Books Salad */ $(document).on(‘click’, ‘.book-module .newrelated-blocks a’,function(){ /* * Click Event */ dataLayer.push({ ‘event’: ‘gaBooksSalad’, ‘gaEventCategory’: ‘books-salad’, ‘gaEventAction’: ‘books-salad-click’, ‘gaEventLabel’: $(this).parent().parent().find(‘h5’).text(), }); }); /* * Click Event Tracking for Action Tout Module */ $(document).on(‘click’, ‘aside.takeaction .cta input’,function(){ /* * Click Event */ dataLayer.push({ ‘event’: ‘gaActionToutModule’, ‘gaEventCategory’: ‘action-tout-module’, ‘gaEventAction’: ‘action-tout-module-click’, ‘gaEventLabel’: document.URL, }); }); /* * Click Event Tracking for Keep Reading 2/3/4/5 */ $(document).on(‘click’, ‘.expand-reduce a’,function(){ var article_number = $(this).parents(‘.scrolltrace’).find(‘.article-body’).attr(‘article-number’); if (typeof article_number !== typeof undefined && article_number !== false) { /* * Click Event */ dataLayer.push({ ‘event’: ‘gaKeepReading’, ‘gaEventCategory’: ‘keep-reading’, ‘gaEventAction’: ‘keep-reading-‘+article_number+’-click’, ‘gaEventLabel’: document.URL, }); } }); /* * Article Email Sign Up */ $(document).on(‘click’,’.para_one_button_email’,function(){ /* * Track Click On Sign Up Button GTM */ var current_email_signup = $(this).parents(“.email-signup-module”); var current_step = current_email_signup.attr(“data-section”); var article_id = $(this).parents(“#url-title”).parent().attr(“article-post-id”); paragraphOneClickEvent(article_id, current_step); var email = current_email_signup.find(“#para-one-email-input-“+current_step+””).val(); var sailthru_list = current_email_signup.find(“#para-one-sailthru-list-“+current_step+””).val(); var current_parent = $(this).parent(); if( email!=” && typeof email!==typeof undefined){ jQuery.ajax({ url :ajax_object.ajax_url, type :”POST”, data :”sailthru_email_take_action=”+email+”&take_action_sailthru_list_final=”+sailthru_list+”&action=action_tout_sailthru”, success : function(data){ if( data.indexOf(‘errormsg’) > 0 ){ current_parent.find(‘.footer_email_error’).html(data); }else{ /* * Track Successful Sign Up GTM */ if( typeof article_id !== typeof undefined && typeof current_step !== typeof undefined && (typeof paragraph_module !== typeof undefined) && (paragraph_module[article_id][current_step].event_name!=””) ){ dataLayer.push({ ‘event’: ‘gaParagraphOneEvent’, ‘gaEventCategory’: ”+ paragraph_module[article_id][current_step].event_name +”, ‘gaEventAction’: ”+ paragraph_module[article_id][current_step].event_name +’-list’, ‘gaEventLabel’: email, }); } var nextTNstep = parseInt(current_step)+1; nextTNstep = ( nextTNstep > 5 )? 0 : nextTNstep; var step = getParaOneNextStep(article_id, nextTNstep); var cookieDateTNstep = new Date(); cookieDateTNstep.setTime(cookieDateTNstep.getTime() + (30*24*60*60*1000)); document.cookie = “TNstep=”+step+”;expires=”+cookieDateTNstep.toUTCString()+”;path=/”; var cookieDateTNlifetime = new Date(); cookieDateTNlifetime.setTime(cookieDateTNlifetime.getTime() + (10*365*24*60*60*1000)); document.cookie = “TNlifetime=”+step+”;expires=”+cookieDateTNlifetime.toUTCString()+”;path=/”; $(“.abody-“+article_id+” .email-signup-module”).hide(); current_email_signup.next(“#para-one-thankyou-“+article_id+””).show(); } } }); }else{ current_parent.find(‘.footer_email_error’).html(‘Please Enter Email’); } }); /* * Paragraph one other module */ $(document).on(‘click’,’.para_one_button’,function(){ /* * Track Click On Sign Up Button GTM */ var current_step = $(this).parents(“.email-signup-module”).attr(“data-section”); var article_id = $(this).parents(“#url-title”).parent().attr(“article-post-id”); var nextTNstep = parseInt(current_step)+1; nextTNstep = ( nextTNstep > 5 )? 0 : nextTNstep; var step = getParaOneNextStep(article_id, nextTNstep); var cookieDateTNstep = new Date(); cookieDateTNstep.setTime(cookieDateTNstep.getTime() + (30*24*60*60*1000)); document.cookie = “TNstep=”+step+”;expires=”+cookieDateTNstep.toUTCString()+”;path=/”; var cookieDateTNlifetime = new Date(); cookieDateTNlifetime.setTime(cookieDateTNlifetime.getTime() + (10*365*24*60*60*1000)); document.cookie = “TNlifetime=”+step+”;expires=”+cookieDateTNlifetime.toUTCString()+”;path=/”; paragraphOneClickEvent(article_id, current_step); }); $(document).on(‘click’,’.inline_cta_signup’,function(){ var current_email_signup = $(this).parents(“.inline-cta-form-module”); var article_id = $(this).parents(“#url-title”).parent().attr(“article-post-id”); $(“.inline_cta__form_error_”+article_id).html(“”); $(“.inline_cta__form_toperror_”+article_id).html(“”); var email = $(“#inline_cta__email_”+article_id).val(); var sailthru_list = $(“#inline_cta__sail_list_”+article_id).val(); var current_parent = $(this).parent(); if( email!=” && typeof email!==typeof undefined){ if(!isValidEmailAddress(email)){ $(“.inline_cta__form_error_”+article_id).html(‘
‘); } else{ jQuery.ajax({ url :ajax_object.ajax_url, type :”POST”, data :”article_id=”+article_id+”&email=”+email+”&list=”+sailthru_list+”&action=inlinecta-signup”, success : function(data){ if( data.indexOf(‘errormsg’) > 0 ){ $(“.inline_cta__form_error_”+article_id).html(data); }else{ $(“.inline_cta__signup_module_”+article_id).hide(); if (data.indexOf(‘verify_email’) > 0) { $(“#inline_cta__form_thanks”+article_id).html(data); } $(“#inline_cta__form_thanks”+article_id).show(); } } }); } }else{ $(“.inline_cta__form_error_”+article_id).html(‘
‘); } }); }); function isJSON(string){ try { JSON.parse(string); } catch (e) { return false; } return true; }
Copyright (c) 2023 The Nation Company LLC