1(function ($) { 2 "use strict"; 3 $(function () { 4 5 /** 6 * If prevent caching is on we update all likes number on page load 7 */ 8 $(document).ready(function(){ 9 if ( locals.load_likes_with_ajax == true ) { 10 $('.pixlikes-box').each( function(){ 11 var likebox = this, 12 post_id = $(likebox).data('id'); 13 14 // reload likes number 15 jQuery.ajax({ 16 type: "post",url: locals.ajax_url,data: { action: 'pixlikes', _ajax_nonce: locals.ajax_nounce, type: 'get', post_id: post_id}, 17 //beforeSend: function() {jQuery("#loading").show("slow");}, //show loading just when link is clicked 18 //complete: function() { jQuery("#loading").hide("fast");}, //stop showing loading when the process is complete 19 success: function( response ){ 20 var result = JSON.parse(response); 21 if ( result.success ) { 22 $(likebox).find('.likes-count').text(result.likes_number); 23 } 24 } 25 }); 26 }); 27 } 28 }); 29 30 $.support.touch = 'ontouchend' in document; 31 32 var touch = $.support.touch ? true : false; 33 34 if ( locals.like_on_action == 'click' || touch) { 35 /** 36 * On each click check if the user can like 37 */ 38 $(document).on('click', '.pixlikes-box.likeable .like-link', function(e){ 39 40 e.preventDefault(); 41 var likebox = $(this).parent('.pixlikes-box'); 42 likebox.addClass('animate'); 43 like_this( likebox ); 44 }); 45 46 } else if ( locals.like_on_action == 'hover' ) { 47 var delay_timer; 48 49 $(document).on('mouseenter', '.pixlikes-box.likeable .like-link', function(){ 50 var likebox = $(this).parent('.pixlikes-box'); 51 52 var $iElem = $(likebox).find('i'); 53 likebox.addClass('animate'); 54 55 delay_timer = setTimeout(function() { 56 like_this( likebox ); 57 }, locals.hover_time); 58 59 }).on('mouseleave', '.pixlikes-box.likeable .like-link', function(){ 60 61 clearTimeout(delay_timer); 62 63 var likebox = $(this).parent('.pixlikes-box'); 64 var $iElem = $(likebox).find('i'); 65 likebox.removeClass('animate') 66 }); 67 } 68 69 70 var like_this = function( likebox ){ 71 var post_id = $(likebox).data('id'); 72 // if there is no post to like or the user already voted we should return 73 if ( typeof post_id === 'undefined' || ( !locals.free_votes && getCookie("pixlikes_"+post_id) ) ) return; 74 $(likebox).addClass('complete liked').removeClass('likeable animate'); 75 jQuery.ajax({ 76 type: "post",url: locals.ajax_url,data: { action: 'pixlikes', _ajax_nonce: locals.ajax_nounce, type: 'increment', post_id: post_id}, 77 //beforeSend: function() {jQuery("#loading").show("slow");}, //show loading just when link is clicked 78// complete: function() {}, //stop showing loading when the process is complete 79 success: function( response ){ //so, if data is retrieved, store it in result 80 var result = JSON.parse(response); 81 if ( result.success ) { 82 $(likebox).find('.likes-count').text( result.likes_number ); 83 $(likebox).trigger('like_succeed', result.msg); 84 } 85 } 86 }); 87 88 setTimeout(function() { 89 $(likebox).removeClass('complete'); 90 }, 2000); 91 92 }; 93 94 /** 95 * Utility functions 96 */ 97 function getCookie(c_name) 98 { 99 var c_value = document.cookie; 100 var c_start = c_value.indexOf(" " + c_name + "="); 101 if (c_start == -1) 102 { 103 c_start = c_value.indexOf(c_name + "="); 104 } 105 if (c_start == -1) 106 { 107 c_value = null; 108 } 109 else 110 { 111 c_start = c_value.indexOf("=", c_start) + 1; 112 var c_end = c_value.indexOf(";", c_start); 113 if (c_end == -1) 114 { 115 c_end = c_value.length; 116 } 117 c_value = unescape(c_value.substring(c_start,c_end)); 118 } 119 return c_value; 120 } 121 122 }); 123}(jQuery));
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.