PageSourceSearch

https://www.kupino.pl/assets/js/view_category.js

js kupino.pl collected 2026-10-09 23:27:08 UTC 14,635 bytes, 1 lines download raw bytes

1"use strict";var _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},_createClass=function(){function o(e,t){for(var n=0;n<t.length;n++){var o=t[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}return function(e,t,n){return t&&o(e.prototype,t),n&&o(e,n),e}}();function _classCallCheck(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}!function(n){var o={};function r(e){if(o[e])return o[e].exports;var t=o[e]={i:e,l:!1,exports:{}};return n[e].call(t.exports,t,t.exports,r),t.l=!0,t.exports}r.m=n,r.c=o,r.d=function(e,t,n){r.o(e,t)||Object.defineProperty(e,t,{configurable:!1,enumerable:!0,get:n})},r.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(t,"a",t),t},r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r.p="",r(r.s=8)}([function(e,t,n){var o=(_createClass(r,null,[{key:"request",value:function(o){if(o)return $.ajax({type:o.type||"POST",url:o.url,data:o.data,error:function(e){"function"==typeof o.error&&o.error(e)},beforeSend:function(e,t){"function"==typeof o.beforeSend&&o.beforeSend(e,t)},success:function(e,t,n){"function"==typeof o.success&&o.success(e,t,n)},complete:function(e,t){"function"==typeof o.complete&&o.complete(e,t)}})}}]),r);function r(){_classCallCheck(this,r)}t.a=o},function(e,t,n){var o=(_createClass(r,null,[{key:"viewportSetMaxScale",value:function(e){var t="width=device-width, initial-scale=1, minimum-scale=1, maximum-scale="+e+", user-scalable=no";$('meta[name="viewport"]').attr("content",t)}},{key:"viewportSetMaxScaleToDefault",value:function(){$('meta[name="viewport"]').attr("content","width=device-width, initial-scale=1, minimum-scale=1, maximum-scale=10, user-scalable=yes")}},{key:"clickAction",value:function(e,o){$(document).on("click",e,function(e){if(e.preventDefault(),"undefined"!==$(e.target).data("fn")){var t=$(e.target).closest("[data-fn]"),n=t.data("fn");"function"==typeof o[n]&&o[n](t)}})}},{key:"stopBodyScrolling",value:function(e){!0===e?document.body.addEventListener("touchmove",this.freezeVp,{passive:!1}):document.body.removeEventListener("touchmove",this.freezeVp,{passive:!1})}},{key:"freezeVp",value:function(e){e.preventDefault()}},{key:"tabAction",value:function(n){$(document).on("click",n,function(e){e.preventDefault(),$(n).removeClass("active"),$(e.target).addClass("active"),$(".tab").hide();var t=$(e.target).data("tab");t.length&&$("#"+t).show()})}},{key:"setFocusableElements",value:function(r){$(document).on("keydown",function(e){var t=$(r),n=-1,o=null;if(t.each(function(e){document.activeElement===this&&(n=e)}),null!==t&&0<t.length){switch(e.keyCode){case 40:e.preventDefault(),o=t[n+1];break;case 38:e.preventDefault(),o=t[n-1]}o&&o.focus()}})}}]),r);function r(){_classCallCheck(this,r)}t.a=o},function(e,t,n){var u=n(0),o=(_createClass(r,[{key:"loadMore",value:function(r){var e=this,t=r.request_url,n=r.postData,a=r.callback,s=r.beforeAppend,i=$(r.container),o=$(r.spinner);0===o.length&&(o=$(".spinner_wrap"));var l={url:t,data:n,beforeSend:function(){e.xhrPending=!0,o.length&&o.stop().fadeIn(),e.manual_loader&&e.manual_loader.hide()},success:function(e,t,n){"function"==typeof e.replace&&0===e.replace(/\s/g,"").length&&$(r.load_trigger).length&&$(r.load_trigger).remove();var o=e;"application/json"===n.getResponseHeader("content-type")&&e.template&&(o=e.template),200===n.status&&(i.length?(r.append_type&&"reload"===r.append_type&&i.html(""),s&&"function"==typeof s&&s(),r.append_after?i.last().after(o):i.append(o),void 0!==e.isNext&&!1===e.isNext&&(r.load_trigger="")):r.load_trigger="",a&&"function"==typeof a&&a())},error:function(){},complete:function(){e.xhrPending=!1,o.length&&o.stop().fadeOut(),e.manual_loader&&e.manual_loader.show()}};u.a.request(l)}},{key:"onScrollLoad",value:function(t){var n=this;$(t.load_trigger).length&&$(document).on("scroll",function(){if(!t.disabled){var e=$
1(t.load_trigger).offset();"object"===(void 0===e?"undefined":_typeof(e))&&e.hasOwnProperty("top")&&e.top-$(window).outerHeight()<$(window).scrollTop()&&(n.xhrPending||t&&t.postData&&n.loadMore(t))}})}}]),r);function r(e){_classCallCheck(this,r),this.xhrPending=!1}t.a=o},function(e,t,n){var o=n(4);function r(){_classCallCheck(this,r),this.stickyScrollRightColumn($(".right_column")),this.fixedHeader(),this.hidePopupsOnClick(),this.headerWhisperer(),this.headingHandler(),this.toggleHeaderMenu()}new(_createClass(r,[{key:"toggleHeaderMenu",value:function(){$(".nav_toggle_wrap").click(function(){$("#head_nav_hdn_wrap").slideToggle(300)})}},{key:"headerWhisperer",value:function(){new o.a({main_form:"#head_search"})}},{key:"headingHandler",value:function(){$(".heading_toggler").click(function(e){e.preventDefault(),$(".heading_block").toggleClass("mobile-collapsed"),$(".heading_toggler").toggleClass("heading_toggler--less")})}},{key:"fixedHeader",value:function(e){var t=e||$("#head_wrapper"),n=$("#head_fixed_start");t.length&&$(window).on("scroll resize load",function(){$("#head_search.fullscreen").length||($(window).scrollTop()>n.offset().top?(t.addClass("fixed"),n.css({height:t.outerHeight()})):(t.removeClass("fixed"),n.attr("style","")))})}},{key:"stickyScrollRightColumn",value:function(e){var o=e||$("#right_column");if(o.length){var r=o.find(".scroll_content"),a=$("#head_wrapper").outerHeight();
1$(window).on("scroll resize",function(){var e=$("#content_wrapper"),t=e.offset().top+e.outerHeight(),n=$(window).scrollTop()+a;$(".right_column_clear").outerHeight()>$(".right_column").outerHeight()&&(n>o.find(".scroll_starter").offset().top?n+r.outerHeight()<=t-30?(r.addClass("fixed"),r.css({top:33+a})):r.css({top:-(n-33-a+r.outerHeight()-(t-30))}):(r.removeClass("fixed"),r.attr("style","")))})}}},{key:"hidePopupsOnClick",value:function(){$(document).on("click",function(e){var o=$(e.target).closest(".popup_el");$(".popup_el").each(function(e,t){var n=$(t);o[0]!==n[0]&&n.hide()})})}}]),r)},function(e,t,n){var r=n(0),s=n(1),o=(n(5),_createClass(a,[{key:"init",value:function(){var t=this,o=this,r=$(this.mainForm);if(!r.length)return!1;var a=r.find("input[type=text]"),e=$("<div/>",{id:"whisp_results",class:"results_list popup_el",style:"display : none;"});r.append(e),o.resultContainer=e,$(o.mainForm).on("touchmove",function(e){t.handleTouchMove(e,t)}),$(o.mainForm).on("touchend",function(e){t.handleTouchEnd(e,t)}),$(o.mainForm).on("touchstart",function(e){t.handleTouchStart(e,t)}
1),$(window).on("resize load",function(){var e=$('[data-fn="closeFullscreenWhisperer"]');if(o.windowWidth!==$(window).outerWidth()&&e.length&&e.click(),$(window).outerWidth()<=640){var t=r.find('[data-fn="submitWhisperer"]');t.data("fn","openFullscreenWhisperer"),t.attr("data-fn","openFullscreenWhisperer")}else{var n=r.find('[data-fn="openFullscreenWhisperer"], [data-fn="closeFullscreenWhisperer"]');n.data("fn","submitWhisperer"),n.attr("data-fn","submitWhisperer")}o.windowWidth=$(window).outerWidth()}),$(a).on("keydown",function(e){13===e.keyCode&&(e.preventDefault(),o.submitWhisperer())}),$(a).on("keyup",function(e){var t=a.val(),n=t.replace(/\s/g,"").length;clearTimeout(o.typingTimeout),o.typingTimeout=setTimeout(function(){-1===o.ignoreKeys.indexOf(e.keyCode)&&0<t.length&&0<n&&o.sendRequest()},240)}),$(a).on("focus",function(e){$(a).attr("placeholder","")}),$(a).on("blur",function(e){$(a).attr("placeholder",$(a).data("placeholder"))}),$(document).on("keydown",function(e){27===e.keyCode&&$(o.mainForm).find(".results_list").hide()}),s.a.setFocusableElements("#head_search .result_item:visible")}},{key:"sendRequest",value:function(){var o=this,e=$(this.mainForm),t=e.find("input[type=text]").val();this.currentXhr&&this.currentXhr.abort();var n={data:{query:t},url:o.requestUrl,beforeSend:function(){o.xhrPending=!0,e.addClass("idle")},success:function(e,t,n){200===n.status&&(o.currentResults=e,o.showCurrentResults())},error:function(e){"abort"===e.statusText||alert(o.ERR_MSG)},complete:function(){o.xhrPending=!1,o.currentXhr=null,e.removeClass("idle")}};this.currentXhr=r.a.request(n)}},{key:"submitWhisperer",value:function(){var e=this.resultContainer.find(".result_item:visible");e.length&&(e[0].focus(),e[0].click())}},{key:"openFullscreenWhisperer",value:function(e){s.a.viewportSetMaxScale(1),s.a.stopBodyScrolling(!0);var t=$("#head_wrapper"),n=$("body, html");$(this.mainForm).addClass("fullscreen"),this.resultContainer.removeClass("popup_el"),this.resultContainer.show(),t.addClass("fixed"),n.addClass("overflow-hide"),$(e).data("fn","closeFullscreenWhisperer"),$(e).attr("data-fn","closeFullscreenWhisperer"),$(this.mainForm).find("input[type=text]").focus()}},{key:"closeFullscreenWhisperer",value:function(e){var t=$("#head_wrapper"),n=$("body, html");$(this.mainForm).removeClass("fullscreen"),this.resultContainer.addClass("popup_el"),this.resultContainer.hide(),t.removeClass("fixed"),n.removeClass("overflow-hide"),$(e).data("fn","openFullscreenWhisperer"),$(e).attr("data-fn","openFullscreenWhisperer"),s.a.viewportSetMaxScaleToDefault(),s.a.stopBodyScrolling(!1),$(window).trigger("scroll")}},{key:"parseJSONtoHTML",value:function(e,r,a){var s="",t=[];if("function"==typeof e.forEach)t=e;else{var n=0;for(var o in e)t[n]=e[o],n++}return t.forEach(function(e,t){if(t<a){var n=e,o=r;Object.keys(n).forEach(function(e){var t=new RegExp("%"+e+"%","g");o=o.replace(t,n[e])}),s+=o}}),s}},{key:"renderResults",value:function(e,t){var n='<a href="%url%" title="%phrase%" class="result_item">\n                        <span class="name no_price">%phrase%</span>\n                       </a>',o=e.leaflets&&Object.keys(e.leaflets).length?Object.keys(e.leaflets).length:null,r=e.products&&Object.keys(e.products).length?Object.keys(e.products).length:null,a=e.shops&&Object.keys(e.shops).length?Object.keys(e.shops).length:null,s=e.producers&&Object.keys(e.producers).length?Object.keys(e.producers).length:null,i=this.resultContainer;if(this.resultContainer.find(".sbar_content").length&&(i=this.resultContainer.find(".sbar_content")),i.html(""),o){var l=t||this.maxResults;i.append(this.renderHeading("leaflets",o)),i.append(this.parseJSONtoHTML(e.leaflets,n,l))}if(a){var u=t||this.maxResults;i.append(this.renderHeading("shops",a)),i.append(this.parseJSONtoHTML(e.shops,n,u))}if(s){var c=t||this.maxResults;i.append(this.renderHeading("producers",s)),i.append(this.parseJSONtoHTML(e.producers,n,c))}if(r){var h=t||this.maxResults;i.append(this.renderHeading("products",r)),i.append(this.parseJSONtoHTML(e.products,n,h))}if(!(o||r||a||s))return i.append('<h4 class="txt-l pad-lr-8 mar-0 results_heading no_results">'+Msg.getMsg("no_results")+"</h4>"),void i.show();this.resultContainer.show()}},{key:"renderHeading",value:function(e,t){var n=$("<div/>",{class:"txt-l pad-lr-8 mar-0 results_heading",html:"<span>"+Msg.getMsg(e)+"</span>"}),o=$("<a/>",{class:"clr-blue flt-r",role:"button",href:"#","data-fn":"showMoreResults","data-type":e,text:Msg.getMsg("next")}),r=$("<a/>",{class:"clr-blue flt-r",role:"button",href:"#","data-fn":"showCurrentResults","data-type":e,text:Msg.getMsg("back")});return t>this.maxResults&&n.append(o),n.append(r),n}},{key:"showMoreResults",value:function(e){var t=this,n=$(e).data("type"),o={};this.currentResults&&this.currentResults[n]&&(o[n]=this.currentResults[n],setTimeout(function(){t.renderResults(o,999),$("[data-fn=showCurrentResults]").show(),$("[data-fn=showMoreResults]").hide()},60))}},{key:"showCurrentResults",value:function(e){var t=this;setTimeout(function(){t.renderResults(t.currentResults),$("[data-fn=showCurrentResults]").hide(),$("[data-fn=showMoreResults]").show()},60)}},{key:"triggerSearchAction",value:function(){if(-1!==window.location.search.indexOf(this.initTriggerSearch)){var e=$
1('[name="main_search"]'),t=$("#head_search").find('button[type="submit"]');if(!t.length)throw"triggerSearchButton is not";if(!e.length)throw"searchInput is not";if("function"!=typeof this.openFullscreenWhisperer)throw"openFullscreenWhisperer is not function";e.is(":hidden")?this.openFullscreenWhisperer(t):e.focus(),t=e=null}}},{key:"handleTouchStart",value:function(e,t){e.touches&&e.touches.length&&(t.touchPosition.lastY=e.touches[0].clientY,t.touchPosition.y=e.touches[0].clientY)}},{key:"handleTouchEnd",value:function(e,t){}},{key:"handleTouchMove",value:function(e,t){e.touches&&e.touches.length&&(t.touchPosition.y=e.touches[0].clientY);var n=t.touchPosition.y-t.touchPosition.lastY;document.getElementById("whisp_results").scrollTop-=n,t.touchPosition.lastY=t.touchPosition.y}}]),a);function a(e){_classCallCheck(this,a),this.ERR_MSG=Msg.getMsg("err_try_again"),this.mainForm=e.main_form,this.requestUrl=$(this.mainForm).data("route"),this.xhrPending=!1,this.currentXhr=null,this.typingTimeout=null,this.ignoreKeys=[9,13,16,17,20,27,37,38,39,40],this.windowWidth=$(window).outerWidth(),this.currentResults=null,this.maxResults=5,this.initTriggerSearch="amp-search",this.touchPosition={lastX:0,lastY:0,x:0,y:0},s.a.clickAction("[data-fn]",this),this.init();try{this.triggerSearchAction()}catch(e){console.log(e)}}t.a=o},function(e,t,n){n(2);function o(e){_classCallCheck(this,o)}_createClass(o,null,[{key:"init",value:function(e){if(!$(e).length)return!1;$(window).on("mousemove",function(e){e.originalEvent&&e.originalEvent.movementX});var t=$("<div/>",{class:"sbar_content relative",style:"top: 0; transition: top .3s ease;","data-scroll":"0"});t.html($(e).html()),$(e).html(t),$(e).addClass("sbar_inited");var n=$("<div/>",{class:"sbar_bar"});return $(e).append(n),o.handleMousewheel(e),t}},{key:"handleMousewheel",value:function(n){$(n).on("mousewheel",function(e){if(e.preventDefault(),e.originalEvent&&e.originalEvent.wheelDelta){var t=e.originalEvent.wheelDelta;o.scrollContent(n,t)}})}},{key:"scrollContent",value:function(e,t){var n=$(e).find(".sbar_content"),o=n.closest(".sbar_inited"),r=n.position().top,a=parseInt(o.css("padding-top"))+parseInt(o.css("padding-bottom")),s=r+t,i=n.outerHeight()-o.outerHeight()+a;s=(s=0<s?0:s)<(i=i<0?0:-1*i)?i:s,n.css({top:s})}}])},,,function(e,t,n){Object.defineProperty(t,"__esModule",{value:!0});n(3);var o=n(2);window.Category=function e(t){var n=this;_classCallCheck(this,e),this.loaderConfig={request_url:t.url_load_leaflets,postData:{page:2,categorySlug:t.category},container:".leaflets_main_category",load_trigger:".load_more",callback:function(){n.loaderConfig.postData.page+=1}},t.load_more_leaflets&&(this.loader=new o.a,this.loader.onScrollLoad(this.loaderConfig))}}]);

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.