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