1$(function(){ 2 3 var quick_view_class = "product-quick-view"; 4 var $quick_view_trigger; 5 var ind; 6 7 $(document).on("click", ".quick-view-trigger", function (e) { 8 e.preventDefault(); 9 if (!$quick_view_trigger) { 10 $quick_view_trigger = $(".quick-view-trigger"); 11 }; 12 var $this = $(this); 13 var url = $this.attr("data-url") || $this.attr("href"); 14 ind = $quick_view_trigger.index($this); 15 16 loadProduct(url, function (){ 17 checkQuickViews(ind); 18 }); 19 }); 20 21 $(document).on("click", ".quick-view-trigger-modification", function (e) { 22 e.preventDefault(); 23 var $this = $(this); 24 var url = $this.attr("data-url") || $this.attr("href"); 25 loadProduct(url, function (){ 26 checkQuickViews(ind); 27 }); 28 }); 29 30 if (shop2 && shop2.product && shop2.product._reload) { 31 var reload = shop2.product._reload; 32 //console.log(reload); 33 34 shop2.product._reload = function(node) { 35 var args = Array.prototype.slice.call(arguments, 0); 36 var popoverDiv = $(node).closest("." + quick_view_class); 37 if (popoverDiv.length) { 38 reloadProduct(node); 39 } else { 40 reload.apply(this, args); 41 } 42 } 43 } 44 45 function loadProduct (url, callback) { 46 if (!myo) return false; 47 if (myo.stack.length && myo.stack[myo.stack.length-1].wrapDiv.hasClass(quick_view_class)) { 48 myo.close(); 49 }; 50 51 myo.open({ 52 ajax: url, 53 ajaxData: {"products_only": 1, "shop2_mode": shop2.mode}, 54 wrapClass: quick_view_class, 55 onContentLoad: function () { 56 var win = myo.stack[myo.stack.length-1]; 57 win.bodyDiv.find("img").load(function () { 58 win.setPosition(); 59 }); 60 var thumbs = win.bodyDiv.find(".gal-thumb"); 61 if (thumbs.length) { 62 thumbs.scrollerM({ 63 liquid: false, 64 infinite: false, 65 autoScroll: false, 66 stopOnHover: false, 67 waitLoad: true, 68 movecount: 1, 69 vertical: !(thumbs.closest(".product-left").hasClass("horizontal")) 70 }); 71 }; 72 console.log('okok1') 73 $('.popover-body .product-image-wrap').slick({ 74 slidesToShow: 1, 75 slidesToScroll: 1, 76 arrows: true 77 }); 78 79 80 if ($.isFunction(callback)) { 81 callback(); 82 }; 83 } 84 }); 85 } 86 87 function reloadProduct(node) { 88 var $node = $(node), 89 kinds = shop2.product.getNodeData(node, 'kinds', true), 90 paramName = shop2.product.getNodeData(node, 'name'), 91 paramValue = shop2.product.getNodeData(node, 'value'), 92 $form = $node.closest('form'), 93 form = $form.get(0), 94 meta, kind_id, product_id; 95 96 if (kinds && $.type(paramName) !== 'undefined' && $.type(paramValue) !== 'undefined' && form) { 97 98 if (form.elements.meta) { 99 meta = $.parseJSON(form.elements.meta.value); 100 } 101 102 product_id = form.elements.product_id.value; 103 104 $form.find('[name=submit]').prop('disabled', true); 105 106 kind_id = shop2.product.findKindId(product_id, kinds, paramName, paramValue, meta); 107 108 if (kind_id === 0) return false; 109 110 // url = document.location.href.replace(/\/folder\/(.+)/i, '/product/' + kind_id); 111 112 var url = window.location.protocol + "//" + window.location.host + shop2.uri + "/product/" + kind_id; 113 114 loadProduct(url, function () { 115 checkQuickViews(ind); 116 }); 117 } 118 } 119 120 function checkQuickViews (ind) { 121 var prev_product = ind-1 >= 0 ? $quick_view_trigger.eq(ind-1) : null, 122 next_product = ind+1 < $quick_view_trigger.length ? $quick_view_trigger.eq(ind+1) : null, 123 prev_product_caller, 124 next_product_caller; 125 126 myo.stack[myo.stack.length-1].bodyDiv.append('<div class="prev_product_caller hide"></div><div class="next_product_caller hide"></div>'); 127 prev_product_caller = myo.stack[myo.stack.length-1].bodyDiv.find(".prev_product_caller"); 128 next_product_caller = myo.stack[myo.stack.length-1].bodyDiv.find(".next_product_caller"); 129 130 if (prev_product) { 131 prev_product_caller.removeClass("hide").on("click", function () { 132 prev_product.trigger("click"); 133 }); 134 }; 135 if (next_product) { 136 next_product_caller.removeClass("hide").on("click", function () { 137 next_product.trigger("click"); 138 }); 139 }; 140 } 141});
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.