1 2 3$(function () { 4 5 const methods = { 6 7 ToggleWishlist: function (args) { 8 9 10 let request = {}; 11 let request_url = "/Favorites/ToggleProductWishlist"; 12 13 request.productId = args.productId; 14 15 $.ajax(request_url, { 16 type: 'POST', 17 data: { id: request.productId }, 18 headers: { 'RequestVerificationToken': document.querySelector('input[name="__RequestVerificationToken"]')?.value }, 19 success: function (result, status, xhr) { 20 if (args != null && args.done != null) { 21 args.done.call(this, result); 22 } 23 }, 24 error: function (jqXhr, textStatus, errorMessage) { 25 if (args != null && args.fail != null) { 26 args.fail.apply(this); 27 } 28 } 29 }); 30 31 }, 32 33 GetFavorites: function (args) { 34 35 let request = {}; 36 let request_url = "/Favorites/Index"; 37 38 39 $.ajax({
40 type: 'POST', 41 url: request_url, 42 data: request, 43 headers: { 'RequestVerificationToken': document.querySelector('input[name="__RequestVerificationToken"]')?.value }, 44 }) 45 .done(function (result) { 46 if (args != null && args.done != null) { 47 args.done.call(this, result); 48 } 49 }) 50 .fail(function () { 51 if (args != null && args.fail != null) { 52 args.fail.apply(this); 53 } 54 }); 55 }, 56 57 } 58 59 $.noetikApi = methods; 60 61 62 63 /**************************************************************************************/ 64 /**************************************************************************************/ 65 66 67 HookBookmarkTriggers(); 68 SetBookmarks(); 69 70 71 /**************************************************************************************/ 72 /**************************************************************************************/ 73}); 74 75 76 77function HookBookmarkTriggers() { 78 79 $(".product-box-bookmark").click(function (event) { 80 event.preventDefault(); 81 82 let productId = 0; 83 let prodContainer = $(this).closest("[data-product-id]"); 84 if (prodContainer.length > 0) { 85 productId = parseInt(prodContainer.attr("data-product-id"), 10); 86 } 87 88 89 90 $.noetikApi.ToggleWishlist({ 91 "productId": productId, 92 //"variationId": variationId, 93 "done": function (results) { 94 SetBookmarks(); 95 }, 96 "fail": function () { 97 }, 98 }); 99 100 101 return false; 102 }); 103} 104 105function SetBookmarks() { 106 $(".product-box-bookmark").removeClass("product-box-bookmarked"); 107 $.noetikApi.GetFavorites({ 108 "done": function (results) { 109 if (results.ok) { 110 var data = results.data || []; 111 for (let i = 0; i < data.length; i++) { 112 let obj = data[i]; 113 let productId = obj.nodeId; 114 if (productId > 0) { 115 $(".product-box-bookmark[data-product-id='" + productId + "']") 116 .addClass("product-box-bookmarked"); 117 } 118 } 119 } 120 // Fade out wishlist items on the members area that are no longer bookmarked. 121 // Runs whether or not there are favorites so removing the last item also triggers it. 122 $('.dashboard-right .product-box-bookmark:not(.product-box-bookmarked)') 123 .closest('.single-wishlist-item').fadeOut("fast"); 124 }, 125 "fail": function () { 126 }, 127 }); 128}
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.