1/** 2 * updates the view counter thru ajax 3 */ 4 5/* global jQuery:{} */ 6/* global td_ajax_url:string */ 7 8var tdAjaxCount = {}; 9 10(function(){ 11 12 'use strict'; 13 14 tdAjaxCount = { 15 16 //td_get_views_counts_ajax : function( page_type, array_ids ) { 17 tdGetViewsCountsAjax : function( postType, arrayIds ) { 18 //what function to call based on postType 19 var pageTypeAction = 'td_ajax_get_views';//postType = page 20 if ( 'post' === postType ) { 21 pageTypeAction = 'td_ajax_update_views'; 22 jQuery.ajax({ 23 type: 'POST', 24 url: '/wp-admin/admin-ajax.php', 25 cache: true, 26 data: { 27 action: pageTypeAction, 28 td_post_ids: arrayIds 29 }, 30 success: function( data, textStatus, XMLHttpRequest ) { 31 32 var tdAjaxPostCounts = jQuery.parseJSON( data );//get the return dara 33 //check the return var to be object 34 if ( tdAjaxPostCounts instanceof Object ) { 35 //alert('value is Object!'); 36 37 //iterate throw the object 38 jQuery.each( tdAjaxPostCounts, function( idPost, value ) { 39 //alert(id_post + ": " + value); 40 41 //this is the count placeholder in witch we write the post count 42 var currentPostCount = '.td-nr-views-single-' + idPost; 43 44 jQuery( currentPostCount ).html( value ); 45 //console.log(current_post_count + ': ' + value); 46 }); 47 } 48 }, 49 error: function( MLHttpRequest, textStatus, errorThrown ) { 50 //console.log(errorThrown); 51 } 52 }); 53 54 } else { 55 jQuery.ajax({ 56 type: 'POST', 57 url: '/wp-admin/admin-ajax.php', 58 cache: true, 59 data: { 60 action: pageTypeAction, 61 td_post_ids: arrayIds 62 }, 63 success: function( data, textStatus, XMLHttpRequest ) { 64 65 var tdAjaxPostCounts = jQuery.parseJSON( data );//get the return dara 66 //check the return var to be object 67 if ( tdAjaxPostCounts instanceof Object ) { 68 //alert('value is Object!'); 69 70 //iterate throw the object 71 jQuery.each( tdAjaxPostCounts, function( idPost, value ) { 72 //alert(id_post + ": " + value); 73 74 //this is the count placeholder in witch we write the post count 75 var currentPostCount = '.td-nr-views-' + idPost; 76 77 jQuery( currentPostCount ).html( value ); 78 //console.log(current_post_count + ': ' + value); 79 }); 80 } 81 }, 82 error: function( MLHttpRequest, textStatus, errorThrown ) { 83 //console.log(errorThrown); 84 } 85 }); 86 } 87 88 89 } 90 }; 91})();
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.