1 2$(document).ready(function () { 3 4 $(".wishblock").clone().addClass('wishmobile').insertAfter("nav #menu-icon"); 5 6 7 $('#nicewishlist-nb').text(nicewishlist.nbProducts); 8 9 $('body').on('click', '.js-nicewishlist-add', function (event) { 10 var self = this; 11 prestashop.emit('clickNiceWishlistAdd', { 12 dataset: self.dataset, 13 self: self 14 }); 15 event.preventDefault(); 16 }); 17 18 $('body').on('click', '.js-nicewishlist-remove', function (event) { 19 20 var self = this; 21 prestashop.emit('clickNiceWishlistRemove', { 22 dataset: self.dataset 23 }); 24 event.preventDefault(); 25 }); 26 27 prestashop.on('clickNiceWishlistAdd', function (elm) { 28 29 var data = { 30 'process': 'add', 31 'ajax': 1, 32 'idProduct': elm.dataset.idProduct, 33 'idProductAttribute': elm.dataset.idProductAttribute 34 }; 35 36 $.post(elm.dataset.url, data, null, 'json').then(function (resp) { 37 38 if (!resp.success && resp.data.type == 'notLogged') { 39 40 var quickModal = $('.modal.quickview').first(); 41 42 if (quickModal.length) { 43 $(quickModal).modal('hide'); 44 $(quickModal).on('hidden.bs.modal', function (e) { 45 $('#nicewishlist-modal').modal('show'); 46 }); 47 } else { 48 $('#nicewishlist-modal').modal('show'); 49 } 50 51 return; 52 } 53 54 if (!resp.success && resp.data.type == 'inWishlist') { 55 56 57 58 var $notification = $('#wishnotif'); 59 $notification.addClass('nw-show'); 60 61 62 setTimeout(function () {
63 $notification.removeClass('nw-show'); 64 }, 3500); 65 66 } 67 $(elm.self).addClass('nicewishlist-added'); 68 if (resp.success) { 69 (function () { 70 nicewishlist.nbProducts++; 71 72 var $notification = $('#wishnotif'); 73 $notification.addClass('nw-show'); 74 75 76 setTimeout(function () { 77 $notification.removeClass('nw-show'); 78 }, 3500); 79 80 81 })(); 82 } 83 }).fail(function (resp) { 84 prestashop.emit('handleError', { eventType: 'clickNiceWishlistAdd', resp: resp }); 85 }); 86 }); 87 88 prestashop.on('clickNiceWishlistRemove', function (elm) { 89 90 var data = { 91 'process': 'remove', 92 'ajax': 1, 93 'idProduct': elm.dataset.idProduct 94 }; 95 96 $.post(elm.dataset.url, data, null, 'json').then(function (resp) { 97 console.log('#nicewishlist-product-' + elm.dataset.idProduct); 98 $('#nicewishlist-product-' + elm.dataset.idProduct).remove(); 99 nicewishlist.nbProducts--; 100 $('#nicewishlist-nb').text(nicewishlist.nbProducts); 101 102 if (nicewishlist.nbProducts == 0) { 103 $('#nicewishlist-warning').removeClass('hidden-xs-up'); 104 $('#nicewishlist-crosseling, #nicewishlist-share').addClass('hidden-xs-up'); 105 } 106 }).fail(function (resp) { 107 prestashop.emit('handleError', { eventType: 'clickNiceWishlistRemove', resp: resp }); 108 }); 109 }); 110 111 prestashop.on('updatedProduct', function (elm) { 112 $('#nice-wishlist-product-btn').data('id-product-attribute', elm.id_product_attribute); 113 $('#nice-wishlist-product-btn').attr('data-id-product-attribute', elm.id_product_attribute); 114 }); 115 116 $('#nicewishlist-clipboard-btn').on('click', function () { 117 118 var $btn = $(this); 119 120 var copyInput = $btn.closest('.input-group').children('input.js-to-clipboard'); 121 copyInput.select(); 122 123 try { 124 var successful = document.execCommand('copy'); 125 if (successful) { 126 $btn.text($btn.data('textCopied')); 127 setTimeout(function () { 128 $btn.text($btn.data('textCopy')); 129 }, 1500); 130 } 131 } catch (err) { 132 console.log('Oops, unable to copy'); 133 } 134 }); 135 });
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.