1jQuery(function($) { 2 3 "use strict"; 4 5 // yith wishlist counter 6 function getCookie(name) { 7 var dc = document.cookie; 8 var prefix = name + "="; 9 var begin = dc.indexOf("; " + prefix); 10 if (begin == -1) { 11 begin = dc.indexOf(prefix); 12 if (begin != 0) return null; 13 } 14 else 15 { 16 begin += 2; 17 var end = document.cookie.indexOf(";", begin); 18 if (end == -1) { 19 end = dc.length; 20 } 21 } 22 // because unescape has been deprecated, replaced with decodeURI 23 //return unescape(dc.substring(begin + prefix.length, end)); 24 return decodeURIComponent(decodeURIComponent((dc.substring(begin + prefix.length, end)))); 25 } 26 27 function getbowtied_update_wishlist_count(count) { 28 if ( ( typeof count === "number" && isFinite(count) && Math.floor(count) === count ) && count >=0 ) { 29 $('.wishlist_items_number').html(count); 30 } 31 } 32 33 if ($('.wishlist_items_number').length ) { 34 35 var wishlistCounter = 0; 36 37 /* 38 ** Check for Yith cookie 39 */ 40 var wlCookie = getCookie("yith_wcwl_products"); 41 42 if ( wlCookie != null ) { 43 wlCookie = wlCookie.slice(0, wlCookie.indexOf(']') + 1); 44 var products = JSON.parse(wlCookie); 45 wishlistCounter = Object.keys(products).length; 46 } else { 47 wishlistCounter = Number($('.wishlist_items_number').html()); 48 } 49 50 /* 51 ** Increment counter on add 52 */ 53 $('body').on( 'added_to_wishlist' , function(){ 54 wishlistCounter++; 55 getbowtied_update_wishlist_count(wishlistCounter); 56 }); 57 58 /* 59 ** Decrement counter on remove 60 */ 61 $('body').on( 'removed_from_wishlist' , function(){ 62 wishlistCounter--; 63 getbowtied_update_wishlist_count(wishlistCounter); 64 }); 65 66 getbowtied_update_wishlist_count(wishlistCounter); 67 } 68});
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.