1(function($,Plugin){"use strict";$(document).ready(function(){initCompare();openCompare();initBestprice();initRating();doRating();initSearch();openSearch();initMore();initCart();displayMoreMerchants();initProgress();initMark();displayCoupon();displayCouponCondition();initTooltip();autoResize();adFree();analytics();woocommerceCompare()});$('body').on('WinamazInfinitScroll','.infinite-scroll a',function(){initCompare();openCompare();initSearch();openSearch();autoResize()});function autoResize(){$('.winamaz-bestseller-horizontal-wrapper').each(function(){if($(this).parent().width()<parseInt(Plugin.breakpoint)){$(this).find('.winamaz-bestseller-horizontal-row').css('flex-direction','column');$(this).find('.winamaz-bestseller-horizontal-row').css('align-items','center');$(this).find('.winamaz-bestseller-horizontal-row').css('margin','0')}});$('.winamaz-newest-horizontal-wrapper').each(function(){if($(this).parent().width()<parseInt(Plugin.breakpoint)){$(this).find('.winamaz-newest-horizontal-row').css('flex-direction','column');$(this).find('.winamaz-newest-horizontal-row').css('align-items','center');$(this).find('.winamaz-newest-horizontal-row').css('margin','0')}});$('.winamaz-variation-horizontal-wrapper').each(function(){if($(this).parent().width()<parseInt(Plugin.breakpoint)){$(this).find('.winamaz-variation-horizontal-row').css('flex-direction','column');$(this).find('.winamaz-variation-horizontal-row').css('align-items','center');$(this).find('.winamaz-variation-horizontal-row').css('margin','0')}});$('.winamaz-single-horizontal-wrapper').each(function(){if($(this).parent().width()<parseInt(Plugin.breakpoint)){$(this).find('.winamaz-single-horizontal-row').css('flex-direction','column');$(this).find('.winamaz-single-horizontal-row').css('align-items','center');$(this).find('.winamaz-single-horizontal-row').css('margin','0')}});$('.winamaz-search-horizontal-wrapper').each(function(){if($(this).parent().width()<parseInt(Plugin.breakpoint)){$(this).find('.winamaz-search-horizontal-row').css('flex-direction','column');$(this).find('.winamaz-search-horizontal-row').css('align-items','center');$(this).find('.winamaz-search-horizontal-row').css('margin','0')}})} 2function displayMoreMerchants(){$(document).on('click','.winamaz-display-more',function(){var status=$(this).attr('opened');if(status=='false'){$(this).attr('opened','true');$(this).find('span').html(Plugin.strings.compare.less);$(this).find('.winamaz-arrow').removeClass('winamaz-down-arrow').addClass('winamaz-up-arrow');$(this).parents('.winamaz-compare').find('.hidden-merchant').show()}else{$(this).attr("opened","false");$(this).find("span").html(Plugin.strings.compare.more);$(this).find('.winamaz-arrow').removeClass("winamaz-up-arrow").addClass("winamaz-down-arrow");$(this).parents('.winamaz-compare').find(".hidden-merchant").hide()}})} 3function displayCoupon(){if($('.winamaz-coupon .display-coupon-code').length){var current=window.location.href;var url=new URL(current);var id=url.searchParams.get('coupon');var coupon=$('.winamaz-coupon-button[data-id="'+id+'"]');var html='<input type="text" value="'+coupon.attr('data-code')+'" class="winamaz-coupon-code" readonly>';coupon.html(html);coupon.next('.winamaz-coupon-alert').show()} 4$('.winamaz-coupon .display-coupon-code').on('click',function(e){e.preventDefault();var parent=$(this).parents('.winamaz-coupon-button');var target=$(this).attr('href');var code=parent.attr('data-code');var id=parent.attr('data-id');var html='<input type="text" value="'+code+'" class="winamaz-coupon-code" readonly>';parent.html(html);parent.next('.winamaz-coupon-alert').show();var tmp=document.createElement('textarea');document.body.appendChild(tmp);tmp.value=code;tmp.select();document.execCommand('copy');document.body.removeChild(tmp);var url=window.location.href;if(url!==target){var external=new URL(target);if(window.location.hostname==external.hostname){window.open(target+'?coupon='+id,'_blank')}else{window.open(target,'_blank')}}else{window.location.href=url+'?coupon='+id}})} 5function displayCouponCondition(){$('.winamaz-coupon .winamaz-coupon-display-condition').on('click',function(){var parent=$(this).parents('.winamaz-coupon');var condition=parent.find('.winamaz-coupon-condition');if(condition.attr('opened')=='false'){condition.show();condition.attr('opened','true');parent.find('.winamaz-arrow').removeClass('winamaz-down-arrow').addClass('winamaz-up-arrow')}else{condition.hide();condition.attr('opened','false');parent.find('.winamaz-arrow').removeClass('winamaz-up-arrow').addClass('winamaz-down-arrow')}})} 6function initMark(){$('.winamaz-compare-mark').each(function(){var total=0,count=$(this).find('.winamaz-mark-progress').length;$($(this).find('.winamaz-mark-progress')).each(function(){total+=parseFloat($(this).attr('data'))/count});if(total==0){$(this).find('.winamaz-mark-count').html('-')}else{$(this).find('.winamaz-mark-count').html(total.toPrecision(2)+' /10')}})} 7function initProgress(){$('.winamaz-mark-progress').each(function(){var percent=$(this).attr('data')*10+'%';
7$(this).find('.progress-bar').css("width",percent)})} 8function initCompare(){$('.winamaz-product-wrapper').each(function(){var product=$(this);var compare=product.find('.winamaz-compare');var preloading=!1;if(compare.attr('data-preloading')=='true'){preloading=!0;product.find('.winamaz-compare-switcher').attr('data-ajax','false');doCompare(product)} 9if(compare.attr('data-force')=='true'){compare.removeClass('winamaz-closed-compare');if(!preloading){doCompare(product)}}})} 10function openCompare(){$('.winamaz-product-wrapper .winamaz-compare-switcher').on('click',function(e){e.preventDefault();var button=$(this);var product=button.closest('.winamaz-product-wrapper'),compare=product.find('.winamaz-compare');compare.toggleClass('winamaz-closed-compare');if(compare.hasClass('winamaz-closed-compare')==!1){if(button.attr('data-ajax')!=='false'){button.attr('data-ajax','false');doCompare(product)}}})} 11function doCompare(element){var keyword=element.attr('data-keyword');var atts=element.attr('data-atts');if(!keyword||!atts)return;var settings={"action":Plugin.namespace+'-doCompare',"nonce":element.attr('data-nonce'),"keyword":keyword,"atts":atts};$.ajax({"type":'GET',"data":$.param(settings),"dataType":'JSON',"url":Plugin.ajaxurl,"timeout":Plugin.timeout,"cache":!0,success:function(response){if(response.status=='success'){element.find('.winamaz-loader-wrapper').remove();element.find('.winamaz-compare').html('');element.find('.winamaz-compare').append(response.content.output);element.find('.winamaz-update-date').html(response.content.date);element.removeAttr('data-atts');initTooltip()}else if(response.status=='inqueue'){element.find('.winamaz-string').html(Plugin.strings.request.inqueue);setTimeout(function(){doCompare(element)},5000)}else if(response.status=='error'){element.find('.winamaz-compare .winamaz-loading').remove();element.find('.winamaz-compare .winamaz-string').html(Plugin.strings.request.soon)}else{if(element.hasClass('winamaz-listsimple-wrapper')||element.hasClass('winamaz-simple-wrapper')){element.find('.winamaz-compare .winamaz-loading').remove();element.find('.winamaz-compare .winamaz-string').html(Plugin.strings.request.soon)}else{element.find('.winamaz-compare-switcher').remove();element.find('.winamaz-compare').remove();element.removeAttr('data-atts')}}},error:function(data){var response=parseResponse(data);if(response){element.find('.winamaz-loader-wrapper').remove();element.find('.winamaz-compare').html('');element.find('.winamaz-compare').append(response.content.output);element.find('.winamaz-update-date').html(response.content.date);element.removeAttr('data-atts');initTooltip()}else{element.find('.winamaz-compare .winamaz-loading').remove();element.find('.winamaz-compare .winamaz-string').html(Plugin.strings.request.soon)}}})} 12function initRating(){if($('.winamaz-rating[loading="false"]').length){$('.winamaz-rating[loading="false"]').each(function(){var rating=$(this).attr('rating');var starTotal=5,starPercent=rating/starTotal*100,starPercentRounded=Math.round(starPercent/10)*10+'%';$(this).children('.winamaz-rating-star').css('width',starPercentRounded)})}} 13function doRating(){if($('.winamaz-rating[loading="true"]').length){$('.winamaz-rating[loading="true"]').each(function(){var rating=$(this);var product=rating.parents('.winamaz-product-wrapper,.winamaz-search-wrapper');var keyword=product.attr('data-keyword');var atts=product.attr('data-atts');if(!keyword||!atts)return;var settings={"action":Plugin.namespace+'-doRating',"nonce":product.attr('data-nonce'),"keyword":keyword,"atts":atts};$.ajax({"type":'GET',"data":$.param(settings),"dataType":'JSON',"url":Plugin.ajaxurl,"timeout":Plugin.timeout,cache:!0,success:function(response){if(response.status=='success'){var parent=rating.parents('.winamaz-rating-wrapper');parent.html(response.content.output);parent.find('.winamaz-rating').attr('rating',response.content.rating.value);parent.find('.winamaz-rating').attr('loading','false');parent.find('.winamaz-rating-count').html('('+response.content.rating.count+')');initRating()}else if(response.status=='inqueue'){setTimeout(function(){doRating()},5000)}else if(response.status=='error'){rating.remove()}else{rating.remove()}},error:function(data){rating.remove()}})})}} 14function initBestprice(){$('.winamaz-bestprice-wrapper').each(function(){doBestprice($(this))})} 15function doBestprice(element){var keyword=element.attr('data-keyword');var atts=element.attr('data-atts');if(!keyword||!atts)return;var settings={"action":Plugin.namespace+'-doBestprice',"nonce":element.attr('data-nonce'),"keyword":keyword,"atts":atts};$.ajax({"type":'GET',"data":$.param(settings),"dataType":'JSON',"url":Plugin.ajaxurl,"timeout":Plugin.timeout,"cache":!0,success:function(response){if(response.status=='success'){element.find('.winamaz-loader-wrapper').remove();element.find('.winamaz-bestprice').html('');element.find('.winamaz-bestprice').append(response.content.output);element.removeAttr('data-atts')}else if(response.status=='inqueue'){element.find('.winamaz-string').html(Plugin.strings.request.inqueue);setTimeout(function(){doBestprice(element)},5000)}else if(response.status=='error'){element.find('.winamaz-bestprice .winamaz-loading').remove();element.find('.winamaz-bestprice .winamaz-string').html(Plugin.strings.request.soon)}else{element.find('.winamaz-bestprice').remove();element.removeAttr('data-atts')}},error:function(data){var response=parseResponse(data);if(response){element.find('.winamaz-loader-wrapper').remove();element.find('.winamaz-bestprice').html('');element.find('.winamaz-bestprice').append(response.content.output);element.removeAttr('data-atts')}else{element.find('.winamaz-bestprice .winamaz-loading').remove();element.find('.winamaz-bestprice .winamaz-string').html(Plugin.strings.request.soon)}}})} 16function initSearch(){$('.winamaz-search-wrapper').each(function(){var search=$(this);var compare=search.find('.winamaz-compare');var preloading=!1;if(compare.attr('data-preloading')=='true'){preloading=!0;search.find('.winamaz-compare-switcher').attr('data-ajax','false');doSearch(search)} 17if(compare.attr('data-force')=='true'){compare.removeClass('winamaz-closed-compare');if(!preloading){doSearch(search)}}})} 18function openSearch(){$('.winamaz-search-wrapper .winamaz-compare-switcher').on('click',function(e){e.preventDefault();var button=$(this);var search=button.closest('.winamaz-search-wrapper'),compare=search.find('.winamaz-compare');compare.toggleClass('winamaz-closed-compare');if(compare.hasClass('winamaz-closed-compare')==!1){if(button.attr('data-ajax')!=='false'){button.attr('data-ajax','false');doSearch(search)}}})} 19function doSearch(element){var keyword=element.attr('data-keyword');var atts=element.attr('data-atts');if(!keyword||!atts)return;var settings={"action":Plugin.namespace+'-doSearch',"nonce":element.attr('data-nonce'),"keyword":keyword,"atts":atts};$.ajax({"type":'GET',"data":$.param(settings),"dataType":'JSON',"url":Plugin.ajaxurl,"timeout":Plugin.timeout,"cache":!0,success:function(response){if(response.status=='success'){element.find('.winamaz-loader-wrapper').remove();element.find('.winamaz-compare').html('');element.find('.winamaz-compare').append(response.content.output);element.find('.winamaz-update-date').html(response.content.date);element.removeAttr('data-atts');initTooltip()}else if(response.status=='inqueue'){element.find('.winamaz-string').html(Plugin.strings.request.inqueue);setTimeout(function(){doSearch(element)},5000)}else if(response.status=='error'){element.find('.winamaz-compare .winamaz-loading').remove();element.find('.winamaz-compare .winamaz-string').html(Plugin.strings.request.soon)}else{if(element.hasClass('winamaz-search-listsimple-wrapper')||element.hasClass('winamaz-search-simple-wrapper')){element.find('.winamaz-compare .winamaz-loading').remove();element.find('.winamaz-compare .winamaz-string').html(Plugin.strings.request.soon)}else{element.find('.winamaz-compare-switcher').remove();element.find('.winamaz-compare').remove();element.removeAttr('data-atts')}}},error:function(data){var response=parseResponse(data);if(response){element.find('.winamaz-loader-wrapper').remove();element.find('.winamaz-compare').html('');element.find('.winamaz-compare').append(response.content.output);element.find('.winamaz-update-date').html(response.content.date);element.removeAttr('data-atts');initTooltip()}else{element.find('.winamaz-compare .winamaz-loading').remove();element.find('.winamaz-compare .winamaz-string').html(Plugin.strings.request.soon)}}})} 20function initMore(){$(document).on('click','.winamaz-more',function(){let button=$(this);let parent=button.parents('.winamaz-more-container');parent.attr('data-loading','true');doMore(button)})} 21function doMore(element){let keyword=element.attr('data-keyword');let page=element.attr('data-page');let atts=element.attr('data-atts');if(!keyword||!page||!atts)return;let parent=element.parents('.winamaz-more-container');let settings={"action":Plugin.namespace+'-doMore',"nonce":element.attr('data-nonce'),"keyword":keyword,"page":page,"atts":atts};$.ajax({"type":'GET',"data":$.param(settings),"dataType":'JSON',"url":Plugin.ajaxurl,"timeout":Plugin.timeout,"cache":!0,success:function(response){if(response.status=='success'){parent.attr('data-loading','false');element.attr('data-page',response.content.page);let shortcode=response.content.shortcode;let template=response.content.template;let target=parent.prev('.winamaz-'+shortcode+'-'+template+'-container');target.append(response.content.output);initTooltip()}else if(response.status=='inqueue'){setTimeout(function(){doMore(element)},5000)}else{parent.remove();element.removeAttr('data-atts')}},error:function(data){parent.remove();element.removeAttr('data-atts')}})} 22function initCart(){$(document).on('click','.winamaz-cart .winamaz-button',function(){doCart($(this))})} 23function doCart(element){const parent=element.parents('.winamaz-cart');const button=parent.find('.winamaz-button');const keyword=parent.find('input[name="keyword"]').val();const quantity=parent.find('input[name="quantity"]').val();const trackid=parent.find('input[name="trackid"]').val();if(!keyword||!quantity)return;button.addClass('icon-loading');const settings={"action":Plugin.namespace+'-doCart',"nonce":parent.attr('data-nonce'),"keyword":keyword,"quantity":quantity,"trackid":trackid};$.ajax({"type":'GET',"data":$.param(settings),"dataType":'JSON',"url":Plugin.ajaxurl,"timeout":Plugin.timeout,"cache":!0,success:function(response){if(response.status=='success'){window.open(response.content.url,'_blank')}},complete:function(){button.removeClass('icon-loading')},error:function(data){}})} 24function woocommerceCompare(){$('.winamaz-woocommerce-button').on('click',function(){$([document.documentElement,document.body]).animate({"scrollTop":$('.winamaz-woocommerce-container').offset().top-200},1000)})} 25function analytics(){if(Plugin.analytics=='true'){$('.winamaz-button,.winamaz-tooltip').on('click',function(){var parent=$(this).parents('.winamaz-product-wrapper,.winamaz-search-wrapper');var keyword=parent.attr('data-keyword');var title=parent.find('.winamaz-title').text();gtag('event','Winamaz product click',{'Product name':title,'ASIN / EAN':keyword})})}} 26function adFree(){setTimeout(function(){$('.winamaz-product').find('.ezoic-ad').remove();$('.winamaz-product').find('iframe').remove();$('.winamaz-product').find('.code-block').remove()},2000)} 27function initTooltip(){$('.winamaz-tooltip:not(".tooltipstered")').tooltipster({maxWidth:300,zIndex:100000})} 28function parseResponse(data){if(data.responseText){var match=data.responseText.match('\{.*\:\{.*\:.*\}\}');if(match){var json=match[0];if(json!==''){var response=JSON.parse(json);if(response&&response.status=='success'){return response}}}} 29return!1}})(jQuery,winamazPlugin||{});function openWinamazModal(k){jQuery('.winamaz-modal-'+k).modal({escapeClose:!0,clickClose:!1,showClose:!1})} 30function closeWinamazModal(){jQuery.modal.close()} 31function openTarget(t){if(t==undefined){t='/'} 32window.open(atob(t),'_blank')}
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.