!function(){"use strict";function i(i,n){for(var t=0;t= 0 ) return true; } return false; }, /** * Function to check if the loaded link is a ThirstyAffiliates link or not. * * @since 3.0.0 * @since 3.1.2 Make function detect root relative URLs. */ isThirstyLink : function( href ) { if ( ! href ) return; href = href.replace( 'http:' , '{protocol}' ).replace( 'https:' , '{protocol}' ); var link_uri = href.replace( thirsty_global_vars.home_url , '' ).replace( '{protocol}' , '' ), link_prefix, new_href; link_uri = link_uri.indexOf( '/' ) == 0 ? link_uri.replace( '/' , '' ) : link_uri; link_prefix = link_uri.substr( 0 , link_uri.indexOf( '/' ) ), new_href = href.replace( '/' + link_prefix + '/' , '/' + thirsty_global_vars.link_prefix + '/' ).replace( '{protocol}' , window.location.protocol ); return ( link_prefix && $.inArray( link_prefix , link_prefixes ) > -1 ) ? new_href : false; }, /** * Function to check if the loaded link is a ThirstyAffiliates link or not. * * @since 3.0.0 * @since 3.3.0 Add data-nojs attribute support. * @since 3.3.5 Make sure href property of links available before fetching the query strings. */ linkFixer : function() { if ( thirsty_global_vars.link_fixer_enabled !== 'yes' ) return; var $allLinks = $( 'body a' ), hrefs = [], href, linkClass, isShortcode, isImage , key; // fetch all links that are thirstylinks for ( key = 0; key < $allLinks.length; key++ ) { href = $( $allLinks[ key ] ).attr( 'href' ); linkClass = $( $allLinks[ key ] ).attr( 'class' ); isShortcode = $( $allLinks[ key ] ).data( 'shortcode' ); isImage = $( $allLinks[ key ] ).has( 'img' ).length; href = thirstyFunctions.isThirstyLink( href ); if ( href && ! isShortcode ) hrefs.push({ key : key , class : linkClass , href : href , is_image : isImage }); $( $allLinks[ key ] ).removeAttr( 'data-shortcode' ); } // skip if there are no affiliate links if ( hrefs.length < 1 ) return; $.post( thirsty_global_vars.ajax_url , { action : 'ta_link_fixer', hrefs : hrefs, post_id : thirsty_global_vars.post_id }, function( response ) { if ( response.status == 'success' ) { for ( var x in response.data ) { // make sure response data is valid before proceeding. if ( typeof response.data[ x ] != 'object' ) continue; var key = response.data[ x ][ 'key' ], hrefProp = $( $allLinks[ key ] ).prop( 'href' ), qs = hrefProp ? hrefProp.split('?')[1] : '', // get the url query strings href = response.data[ x ][ 'href' ], title = response.data[ x ][ 'title' ], className = response.data[ x ][ 'class' ], connector; if ( qs && response.data[ x ][ 'pass_qs' ] ) { connector = href.indexOf( '?' ) < 0 ? '?' : '&'; href = href + connector + qs; } // update protocol to replace it with the one used on the site. href = href.replace( 'http:' , window.location.protocol ).replace( 'https:' , window.location.protocol ); // add the title if present, if not then remove the attribute entirely. if ( title ) $( $allLinks[ key ] ).prop( 'title' , title ); else $( $allLinks[ key ] ).removeAttr( 'title' ); // if disable_thirstylink_class is set to yes then remove the thirstylink and thirstylinkimg classes. if ( thirsty_global_vars.disable_thirstylink_class == 'yes' ) className = className.replace( 'thirstylinkimg' , '' ).replace( 'thirstylink' , '' ).trim(); if ( className ) $( $allLinks[ key ] ).prop( 'class' , className ); else $( $allLinks[ key ] ).removeAttr( 'class' ); // map the other attributes. $( $allLinks[ key ] ).prop( 'href' , href ) .prop( 'rel' , response.data[ x ][ 'rel' ] ) .prop( 'target' , response.data[ x ][ 'target' ] ) .attr( 'data-linkid' , response.data[ x ][ 'link_id' ] ); // tag links as "nojs" to disable JS redirect for them. if ( thirsty_global_vars.enable_js_redirect === 'yes' ) $( $allLinks[ key ] ).attr( 'data-nojs' , response.data[ x ][ 'nojs' ] ); } } }, 'json' ); } } var link_prefixes = $.map( thirsty_global_vars.link_prefixes , function(value , index) { return [value]; }); // Initiate record link click stat function thirstyFunctions.recordLinkStatEvents(); // Initialize uncloak links function thirstyFunctions.linkFixer(); }); ; jQuery(document).ready(function($){ /* ============================ * * Load More Articles * * ============================ */ /* If is single article or home page */ var offset = 19; var cnt = 0; var newsoffset = 6; /* if ($("#comments").length) { offset = 0; }*/ $("#read-more-button").click(function () { $('#readmoregrid').show(); $.ajax({ url: SdsAjax.ajaxurl, data: ({action : 'get_more_articles', offset: offset, cnt: cnt}), success: function(data) { $('#readmoregrid-container').append(data); offset = offset + 6; cnt = cnt + 1; y = $(window).scrollTop(); //your current y position on the page $("html, body").animate({ scrollTop: y + 300 }, 600); } }); if (offset == 43) { $('.readmore').hide(); } }); $("#viewmorenews").click(function () { $.ajax({ url: SdsAjax.ajaxurl, data: ({action : 'get_more_news', newsoffset: newsoffset, cnt: cnt}), success: function(data) { $('#news-container').append(data); newsoffset = newsoffset + 6; } }); }); });; /*! This file is auto-generated */ window.addComment=function(v){var I,C,h,E=v.document,b={commentReplyClass:"comment-reply-link",commentReplyTitleId:"reply-title",cancelReplyId:"cancel-comment-reply-link",commentFormId:"commentform",temporaryFormId:"wp-temp-form-div",parentIdFieldId:"comment_parent",postIdFieldId:"comment_post_ID"},e=v.MutationObserver||v.WebKitMutationObserver||v.MozMutationObserver,r="querySelector"in E&&"addEventListener"in v,n=!!E.documentElement.dataset;function t(){d(),e&&new e(o).observe(E.body,{childList:!0,subtree:!0})}function d(e){if(r&&(I=g(b.cancelReplyId),C=g(b.commentFormId),I)){I.addEventListener("touchstart",l),I.addEventListener("click",l);function t(e){if((e.metaKey||e.ctrlKey)&&13===e.keyCode)return C.removeEventListener("keydown",t),e.preventDefault(),C.submit.click(),!1}C&&C.addEventListener("keydown",t);for(var n,d=function(e){var t=b.commentReplyClass;e&&e.childNodes||(e=E);e=E.getElementsByClassName?e.getElementsByClassName(t):e.querySelectorAll("."+t);return e}(e),o=0,i=d.length;o