Advertisement
EduardET

Js error

Nov 23rd, 2017
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 2.64 KB | None | 0 0
  1. <script type="text/javascript">
  2.             var swpClickTracking = false; var swp_nonce = "71db6deea7";
  3. function parentIsEvil() { var html = null; try { var doc = top.location.pathname; } catch(err){ }; if(typeof doc === "undefined") { return true } else { return false }; }; if (parentIsEvil()) { top.location = self.location.href; };var url = "https://www.coffeeloversmag.com/";if(url.indexOf("stfi.re") != -1) { var canonical = ""; var links = document.getElementsByTagName("link"); for (var i = 0; i < links.length; i ++) { if (links[i].getAttribute("rel") === "canonical") { canonical = links[i].getAttribute("href")}}; canonical = canonical.replace("?sfr=1", "");top.location = canonical; console.log(canonical);};        var within_timelimit;
  4.         swp_admin_ajax = 'https://www.coffeeloversmag.com/wp-admin/admin-ajax.php';
  5.         var swp_buttons_exist = !!document.getElementsByClassName( 'nc_socialPanel' );
  6.         if ( swp_buttons_exist ) {
  7.             jQuery( document ).ready( function() {
  8.                 var swp_check_for_js = setInterval( function() {
  9.                     if( 'undefined' !== typeof socialWarfarePlugin) {
  10.                         clearInterval(swp_check_for_js);
  11.                                                 var swp_cache_data = {
  12.                             'action': 'swp_cache_trigger',
  13.                             'post_id': 71,
  14.                             'timestamp': 1511502254                     };
  15.                                                 // if( !swp_cache_data.timestamp ){ // error handling}
  16.                         console.log( "Server Timestamp is " + swp_cache_data.timestamp );
  17.                         var browser_date = Date.now();
  18.                         if( !browser_date )
  19.                             browser_date = new Date().getTime();
  20.                         browser_date = Math.floor( browser_date / 1000 );
  21.                         console.log( "Browser Timestamp is " + browser_date );
  22.                         var elapsed_time = ( browser_date - swp_cache_data.timestamp );
  23.                         if( elapsed_time > 60 ){
  24.                             console.log( "Elapsed time since server timestamp is greater than 60 seconds -- " + elapsed_time + "seconds" );
  25.                             within_timelimit = false;
  26.                         } else {
  27.                             console.log( "Elapsed time since server timestamp is less than 60 seconds -- " + elapsed_time + "seconds"  );
  28.                             within_timelimit = true;
  29.                         }
  30.  
  31.                         if( within_timelimit === true ){
  32.                             jQuery.post( swp_admin_ajax, swp_cache_data, function( response ) {
  33.                                 console.log(response);
  34.                             });
  35.  
  36.                             socialWarfarePlugin.fetchShares();
  37.                         }
  38.                     }
  39.                 } , 250 );
  40.             });
  41.             swp_post_id='71';
  42.             swp_post_url='https://www.coffeeloversmag.com/';
  43.             swp_post_recovery_url = '';
  44.  
  45.             //    socialWarfarePlugin.fetchShares();
  46.         }
  47.         </script>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement