Incantation for America | The Nation

Incantation for America | The Nation


Incantation: a series of words said as a magic spell or charm. “Make America safe again. America, save us from ourselves. America, I elect to love you in this moment of extraordinary need. America, absolve us of our uncertainty and fears. America, make us safe again and indivisible, united, under myriad beliefs, with liberty and justice for all.”

 

‘);
}
});

/*
* 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:’social-justice’,curr_post_id:’260925′},
success : function(receivedHTML){

if ( typeof receivedHTML == ‘object’ ){
if(typeof receivedHTML.html!==’undefined’ && receivedHTML.html!=”){
html = receivedHTML.html;
}
}else{
$(‘a.inifiniteLoader’).hide();
$(“#single_article_footer”).show();
}

$(‘a.inifiniteLoader’).hide(‘1000’);

$(“#wrap”).append(html); // This will be the div where our content will be loaded

var postID = $($.parseHTML(html)).filter(“.scrolltrace”).attr(‘article-post-id’);

$(‘.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(/^(< . wp_automatic_readability="6.863069838185">)?([A-Za-z0-9])/g,’$1$2‘));
}
});

if( !$(‘.abody-‘ + postID +”).parent().parent().hasClass(‘textContainer_Truncate’) ){
$(‘

‘).insertAfter(‘.abody-‘ + postID);
}

/*
* 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);

/** 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() {
console.log(arguments);
});
}
});
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’));

/*
* Call Right Sidebar Ads
*/
if( !isMobile.any() ){
load_article_ads();
}
articlePostId = $(‘.currentScr’).attr(“article-post-id”);
}

/*
* 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 );
}
}

/*
* 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’)
});

var allSubject = $(‘.currentScr .article-header .article-info .category:first-child a’).html();
var allAuthor = $(‘.currentScr .author_name .author’).map(function(){
return this.innerHTML;
}).get();

var all_Author = allAuthor.join();

dataLayer.push({
‘event’:’InfiniteScrollPageView’,
‘virtualPageURL’:$(‘.currentScr’).attr(‘articlelistlinks’),
‘virtualPageTitle’ : $(‘.currentScr’).attr(‘articlelisttitle’)
});

_sf_async_config.sections=””+allSubject+””;
_sf_async_config.authors=””+all_Author+””;

var username = getCookie(‘SESSname’);
if(username != null){
_cbq.push([‘_acct’, ‘paid’]);
}else{
_cbq.push([‘_acct’, ‘anon’]);
}

pSUPERFLY.virtualPage($(‘.currentScr’).attr(‘articlelistlinks’), $(‘.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 art_recirc_bot = ”;
var windowTop = $(window).scrollTop();

var inline_ad_300x250 = $(‘.currentScr .inline_ad_300x250_’+articlePostId+”);
if( inline_ad_300x250.length > 0 ){
inline_ad_300x250_pos = inline_ad_300x250.offset().top – window.innerHeight;

if( windowTop >= inline_ad_300x250_pos ){
inline_ad( articlePostId );
}
}

if( $current_article.find(‘.expand-reduce’).length != 0 ){

if( !$(‘#expand-reduce-‘+articlePostId+”).hasClass(‘expand-close’) ){

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();
}
}

var art_recirc_bot = $(‘.currentScr .article-share’);
var art_recric_pos = art_recirc_bot.last().offset().top – window.innerHeight; //article bottom action tout
if( windowTop >= art_recric_pos ){
if( $(‘#slot-‘ + articlePostId).children(‘div’).length ==0 ){
var slotName = generateNextSlotName();
autoload_article_ads( slotName, articlePostId );
}
}

}else{

var art_recirc_bot = $(‘.currentScr .new-article-footer’);
var art_recric_pos = art_recirc_bot.last().offset().top – window.innerHeight; //article bottom action tout
if( windowTop >= art_recric_pos ){
if( $(‘#div-gpt-ad-1428494597034-0’).children(‘div’).length==0 ){
call_ad_leaderboard();
}
}
}
}

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 1){
comment_count = “comments (“+data.comment_count.approved+”)”;
}

$(“.postid-“+art_post_id+” .click_comment .title”).html(comment_count);

if($(“#comments_”+art_post_id+” .comments-area .comment_sorting_setting_outer”).length > 0){}
else{
if(data.comment_count.total_comments > 1){
$(“#comments_”+art_post_id+” .comments-area”).append(”);
}
}

if($(“#comments_”+art_post_id+” .comments-area .comment-list”).length > 0){
$(“#comments_”+art_post_id+” .comments-area .comment-list”).html(data.comment_list);
}else{
$(“#comments_”+art_post_id+” .comments-area”).append(“”);
}

if(username !=null){
$(“#comments_”+art_post_id+” .comments-area .comment-respond”).html(data.comment_box);
}
}
}
});
});

/*
* Script for Comment Sec
*/
$(‘body’).on(‘click’,’.click_comment’,function(event){

event.preventDefault();

$(this).closest(‘.article-footer’).find(‘.commentContainer’).slideToggle(‘slow’, function(){
if ($(this).css(‘display’)==’none’){
check_comment = false;//condition added for print
}else{
check_comment = true;//condition added for print
}
});

$(this).find(‘abbr.open’).toggleClass(‘close’);

$(‘html, body’).animate({
scrollTop: $($(this).closest(‘.article-footer’).find(‘.commentContainer’)).offset().top
},2000);
});

/*
* Script for comment reply
*/

$(‘body’).on(‘click’,’a.comment-reply-link’,function(event){
$( “.comment-status” ).remove();

var comment_link_respond = $(this);

comment_link_respond.closest(‘.comment-form’).find(‘.comment-status’).html(”);

list = $(this).closest(‘article’).attr(‘id’);

var PIDS = list.split(‘-‘);

$(this).closest(‘.comments-area’).find(‘.comment-respond’).find(‘#comment_parent’).val(PIDS[PIDS.length-1]);
});

/*
* Comment cancel link
*/

$(‘body’).on(‘click’,’.cancel-comment-reply-link’,function(event){
$( “.comment-status” ).remove();
list=null;
});

/*
* Submit button click
*/

$(‘body’).on(‘click’,’.submit’,function(event){

event.preventDefault();

$( “.comment-status” ).remove();
var commentform=$(this).closest(‘.comment-form’); // find the comment form
commentform.prepend(”); // add info panel before the form to provide feedback or errors
var statusdiv=commentform.find(‘.comment-status’); // define the infopanel
var checkspace = $(this).closest(‘.comment-form’).find(“textarea#comment”).val();

if(checkspace.replace(/s/g, ”).length && $(this).closest(‘.comment-form’).find(“textarea#comment”).val()!=”){

statusdiv.html(‘ ‘);

//serialize and store form data in a variable
var formdata=commentform.serialize();

//Add a status message
//Extract action URL from commentform
var formurl=commentform.attr(‘action’);

statusdiv.html(‘

Processing…

‘);

$(this).attr(‘disabled’,’disabled’);

var e = $(this);

$.ajax({
type : ‘post’,
url : formurl,
data : formdata,
error: function(XMLHttpRequest, textStatus, errorThrown){
statusdiv.html(‘ ‘);
$(‘.submit’).removeAttr(‘disabled’);
statusdiv.html(‘

You might have left one of the fields blank, or be posting too quickly

‘);
},
success: function(data, textStatus){

var chkstatus_comment = $($.parseHTML(data)).filter(“.chk_comment_class”).attr(‘comment-status’);

if(chkstatus_comment==’spam’){
statusdiv.html(‘

You have been blocked from commenting by The Nation’s moderators.

‘);
}else{
$(‘.submit’).removeAttr(‘disabled’);
$(“textarea#comment”).val(”);
statusdiv.html(”);
if(e.closest(“.comments-area”).has(“ol.comment-list”).length > 0){
if(list != null){
e.closest(“.comments-area”).find(‘#’+list).after(data);
}else{
e.closest(“.comments-area”).find(‘ol.comment-list’).prepend(data);
}
}else{
e.closest(“.comments-area”).prepend(”);
e.closest(“.comments-area”).find(‘ol.comment-list’).html(data);
}
}
}
});
return false;
statusdiv.html(”);
}else{
statusdiv.html(‘

Please enter text in comment box.

‘);
}
});

jQuery( “.action_tout_remove_gallery a” ).removeClass( “gallery imgHover” ).delay( 1000 );

/*
* Article Email Sign Up
*/

$(document).on(‘click’,’.email_sign_up’,function(){

/*
* Track Click On Sign Up Button GTM
*/
dataLayer.push({
‘event’: ‘gaParagraphOneEvent’,
‘gaEventCategory’: ‘paragraph-1-email-signup’,
‘gaEventAction’: ‘paragraph-1-email-signup-click’,
‘gaEventLabel’: document.URL,
});
var email = $(this).parent().parent().find(“.email-signup-input”).val();
var article_id = $(this).parents(“#url-title”).parent().attr(“article-post-id”);
var ajaxurl = ajax_object.ajax_url;
var current_parent = $(this).parent();
if( email != ” ){
var sailthru_list = $(this).parent().parent().find(“.email-sailthru-list”).val();
var action_tout_sailthru = ‘action_tout_sailthru’;
jQuery.ajax({
url :ajaxurl,
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
*/
dataLayer.push({
‘event’: ‘gaParagraphOneEvent’,
‘gaEventCategory’: ‘paragraph-1-email-signup’,
‘gaEventAction’: ‘paragraph-1-email-signup-list’,
‘gaEventLabel’: email,
});

/*
* Cookie For Subscription
*/
var cookieDate = new Date();
cookieDate.setTime(cookieDate.getTime() + (10*365*24*60*60*1000));
document.cookie = “TNemailsignup=1;expires=”+cookieDate.toUTCString()+”;path=/”;

var cookieDateTNstep = new Date();
cookieDateTNstep.setTime(cookieDateTNstep.getTime() + (10*365*24*60*60*1000));
document.cookie = “TNstep=2;expires=”+cookieDateTNstep.toUTCString()+”;path=/”;

var cookieDateTNlifetime = new Date();
cookieDateTNlifetime.setTime(cookieDateTNlifetime.getTime() + (10*365*24*60*60*1000));
document.cookie = “TNlifetime=2;expires=”+cookieDateTNlifetime.toUTCString()+”;path=/”;

/*
* Display Subscription Box
*/
$(“.abody-“+article_id+” .email-signup-module.one”).hide();
$(“.abody-“+article_id+” .email-signup-module.two”).show();
}
$(this).parent().parent().find(“.email-signup-input”).val(”);
}
});
}else{
current_parent.find(‘.footer_email_error’).html(‘Please Enter Email’);
}
});

$(document).on(‘click’,’.subscription_after_signup’,function(){
var cookieDateTNstep = new Date();
cookieDateTNstep.setTime(cookieDateTNstep.getTime() + (30*24*60*60*1000));
document.cookie = “TNstep=3;expires=”+cookieDateTNstep.toUTCString()+”;path=/”;

var cookieDateTNlifetime = new Date();
cookieDateTNlifetime.setTime(cookieDateTNlifetime.getTime() + (10*365*24*60*60*1000));
document.cookie = “TNlifetime=3;expires=”+cookieDateTNlifetime.toUTCString()+”;path=/”;

/*
* Track Clicks of Subscribe GTM
*/
dataLayer.push({
‘event’: ‘gaParagraphOneEvent’,
‘gaEventCategory’: ‘paragraph-1-subscribe’,
‘gaEventAction’: ‘paragraph-1-subscribe-click’,
‘gaEventLabel’: document.URL,
});
});

$(document).on(‘click’,’.donate_after_signup’,function(){
var cookieDateTNstep = new Date();
cookieDateTNstep.setTime(cookieDateTNstep.getTime() + (30*24*60*60*1000));
document.cookie = “TNstep=4;expires=”+cookieDateTNstep.toUTCString()+”;path=/”;

var cookieDateTNlifetime = new Date();
cookieDateTNlifetime.setTime(cookieDateTNlifetime.getTime() + (10*365*24*60*60*1000));
document.cookie = “TNlifetime=4;expires=”+cookieDateTNlifetime.toUTCString()+”;path=/”;

/*
* Track Clicks of Donate GTM
*/
dataLayer.push({
‘event’: ‘gaParagraphOneEvent’,
‘gaEventCategory’: ‘paragraph-1-donate’,
‘gaEventAction’: ‘paragraph-1-donate-click’,
‘gaEventLabel’: document.URL,
});
});

$(document).on(‘click’,’.take_action_after_signup’,function(){
var cookieDateTNstep = new Date();
cookieDateTNstep.setTime(cookieDateTNstep.getTime() + (30*24*60*60*1000));
document.cookie = “TNstep=5;expires=”+cookieDateTNstep.toUTCString()+”;path=/”;

var cookieDateTNlifetime = new Date();
cookieDateTNlifetime.setTime(cookieDateTNlifetime.getTime() + (10*365*24*60*60*1000));
document.cookie = “TNlifetime=5;expires=”+cookieDateTNlifetime.toUTCString()+”;path=/”;

/*
* Track Clicks of Take Action GTM
*/
dataLayer.push({
‘event’: ‘gaParagraphOneEvent’,
‘gaEventCategory’: ‘paragraph-1-takeaction’,
‘gaEventAction’: ‘paragraph-1-takeaction-click’,
‘gaEventLabel’: document.URL,
});
});

$(document).on(‘click’,’.tn_take_curise’,function(){
var cookieDateTNstep = new Date();
cookieDateTNstep.setTime(cookieDateTNstep.getTime() + (30*24*60*60*1000));
document.cookie = “TNstep=6;expires=”+cookieDateTNstep.toUTCString()+”;path=/”;

var cookieDateTNlifetime = new Date();
cookieDateTNlifetime.setTime(cookieDateTNlifetime.getTime() + (10*365*24*60*60*1000));
document.cookie = “TNlifetime=6;expires=”+cookieDateTNlifetime.toUTCString()+”;path=/”;

/*
* Track Clicks of Travel GTM
*/
dataLayer.push({
‘event’: ‘gaParagraphOneEvent’,
‘gaEventCategory’: ‘paragraph-1-travel’,
‘gaEventAction’: ‘paragraph-1-travel-click’,
‘gaEventLabel’: document.URL,
});
});

$(document).on(‘click’,’.wine_signup’,function(){
var is_user_logged_in = getCookie(‘SESSname’);
var cookieDateTNstep = new Date();
cookieDateTNstep.setTime(cookieDateTNstep.getTime() + (30*24*60*60*1000));
document.cookie = “TNstep=3;expires=”+cookieDateTNstep.toUTCString()+”;path=/”;

var cookieDateTNlifetime = new Date();
cookieDateTNlifetime.setTime(cookieDateTNlifetime.getTime() + (10*365*24*60*60*1000));
document.cookie = “TNlifetime=3;expires=”+cookieDateTNlifetime.toUTCString()+”;path=/”;

/*
* Track Clicks of Wine Club GTM
*/
dataLayer.push({
‘event’: ‘gaParagraphOneEvent’,
‘gaEventCategory’: ‘paragraph-1-wineclub’,
‘gaEventAction’: ‘paragraph-1-wineclub-click’,
‘gaEventLabel’: document.URL,
});
});

$(document).on(‘click’,’.nation_convsersation’,function(){

var article_id = $(this).attr(‘article-id’);
$(‘.postid-‘+article_id+’ .click_comment .open’).addClass(‘close’);
$(‘html, body’).animate({scrollTop: $(‘.postid-‘+article_id+’ .click_comment’).offset().top},2000);
$(‘.postid-‘+article_id+’ .commentContainer’).show();
});

$(“.social-share-icon”).click(function(){
$(“.nav-toggle, .logo”).toggleClass(“hidden”);
$(“.share-icons”).toggleClass(“slide-share”);
$(“.header-bar a.social-sharing”).toggleClass(“share-icons-close”);
});

/*
* Click Event Tracking for Related Single Article
*/

$(document).on(‘click’, ‘.related-oneup-click’,function(){
/*
* Click Event
*/
dataLayer.push({
‘event’: ‘gaRelatedSingleArticleEvent’,
‘gaEventCategory’: ‘related-single-article’,
‘gaEventAction’: ‘related-single-article-click’,
‘gaEventLabel’: $(this).attr(‘href’),
});
});

/*
* Click Event Tracking for Related Multi Article
*/

$(document).on(‘click’, ‘.related-multi-click’,function(){
/*
* Click Event
*/
dataLayer.push({
‘event’: ‘gaRelatedMultiArticleEvent’,
‘gaEventCategory’: ‘related-multi-article’,
‘gaEventAction’: ‘related-multi-article-click’,
‘gaEventLabel’: $(this).attr(‘href’),
});
});

/*
* Click Event Tracking for Current Issue
*/

$(document).on(‘click’, ‘.magazine_button a’,function(){
/*
* Click Event
*/
dataLayer.push({
‘event’: ‘gaCurrentIssueModuleEvent’,
‘gaEventCategory’: ‘current-issue-module’,
‘gaEventAction’: ‘current-issue-module-click’,
‘gaEventLabel’: $(this).find(‘input’).val(),
});
});

/*
* Click Event Tracking for In-line CTA 1
*/

$(document).on(‘click’, ‘.inline-cta-1 .cta a’,function(){
/*
* Click Event
*/
dataLayer.push({
‘event’: ‘gaInlineCtaOneEvent’,
‘gaEventCategory’: ‘inline-cta-1’,
‘gaEventAction’: ‘inline-cta-1-click’,
‘gaEventLabel’: $(this).find(‘input’).val(),
});
});

/*
* Click Event Tracking for In-line CTA 2
*/

$(document).on(‘click’, ‘.inline-cta-2 .cta a’,function(){
/*
* Click Event
*/
dataLayer.push({
‘event’: ‘gaInlineCtaTwoEvent’,
‘gaEventCategory’: ‘inline-cta-2’,
‘gaEventAction’: ‘inline-cta-2-click’,
‘gaEventLabel’: $(this).find(‘input’).val(),
});
});

/*
* Click Event Tracking for Footer Last Latest From NAtion
*/

$(document).on(‘click’, ‘#article-footer-last .latest-from h3 a’,function(){
/*
* Click Event
*/
dataLayer.push({
‘event’: ‘gaInfiniteScrollfooterEvent’,
‘gaEventCategory’: ‘infinite-scroll-footer-latest-articles’,
‘gaEventAction’: ‘infinite-scroll-footer-latest-articles-click’,
‘gaEventLabel’: $(this).attr(‘href’),
});
});

/*
* Click Event Tracking for Footer Last Editor Picks
*/

$(document).on(‘click’, ‘#article-footer-last .editors-picks h3 a, #article-footer-last .editors-picks .story a’,function(){
/*
* Click Event
*/
dataLayer.push({
‘event’: ‘gaInfiniteScrollfooterEvent’,
‘gaEventCategory’: ‘infinite-scroll-footer-editor-picks’,
‘gaEventAction’: ‘infinite-scroll-footer-editor-picks-click’,
‘gaEventLabel’: $(this).attr(‘href’),
});
});

/*
* Click Event Tracking for Author Highlight
*/

$(document).on(‘click’, ‘.author-modules .newrelated-blocks > 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,
});
}
});

});



Source link

Leave a Reply

Your email address will not be published.