1Flatsome.behavior('wishlist', { 2 attach: function (context) { 3 jQuery('.wishlist-button', context).each(function (index, element) { 4 'use strict' 5 6 jQuery(element).on('click', function (e) { 7 var $this = jQuery(this) 8 // Browse wishlist 9 if ($this.parent().find('.yith-wcwl-wishlistexistsbrowse, .yith-wcwl-wishlistaddedbrowse').length) { 10 window.location.href = $this.parent().find('.yith-wcwl-wishlistexistsbrowse a, .yith-wcwl-wishlistaddedbrowse a').attr('href') 11 return 12 } 13 $this.addClass('loading') 14 // Delete or add item (only one of both is present). 15 $this.parent().find('.delete_item').click() 16 $this.parent().find('.add_to_wishlist').click() 17 18 e.preventDefault() 19 }) 20 }) 21 22 markAdded() 23 } 24}) 25 26jQuery(document).ready(function () { 27 var flatsomeAddToWishlist = function () { 28 jQuery('.wishlist-button').removeClass('loading') 29 markAdded() 30 31 jQuery.ajax({ 32 beforeSend: function () { 33 34 }, 35 complete: function () { 36 37 }, 38 data: { 39 action: 'flatsome_update_wishlist_count', 40 }, 41 success: function (data) { 42 var $icon = jQuery('i.wishlist-icon') 43 $icon.addClass('added') 44 if (data == 0) { 45 $icon.removeAttr('data-icon-label') 46 } 47 else if (data == 1) { 48 $icon.attr('data-icon-label', '1') 49 } 50 else { 51 $icon.attr('data-icon-label', data) 52 } 53 setTimeout(function () { 54 $icon.removeClass('added') 55 }, 500) 56 }, 57 58 url: yith_wcwl_l10n.ajax_url, 59 }) 60 } 61 62 jQuery('body').on('added_to_wishlist removed_from_wishlist', flatsomeAddToWishlist) 63}) 64 65function markAdded () { 66 jQuery('.wishlist-icon').each(function () { 67 var $this = jQuery(this) 68 if ($this.find('.yith-wcwl-wishlistexistsbrowse, .yith-wcwl-wishlistaddedbrowse').length) { 69 $this.find('.wishlist-button').addClass('wishlist-added') 70 } 71 }) 72}
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.