PageSourceSearch

https://www.astratex.pl/Js/ColorChanger.min.js?v=67

js astratex.pl collected 2026-09-26 11:43:27 UTC 12,722 bytes, 1 lines download raw bytes

1var __awaiter=this&&this.__awaiter||function(e,t,i,s){function n(e){return e instanceof i?e:new i(function(t){t(e)})}return new(i||(i=Promise))(function(i,a){function r(e){try{c(s.next(e))}catch(e){a(e)}}function o(e){try{c(s.throw(e))}catch(e){a(e)}}function c(e){e.done?i(e.value):n(e.value).then(r,o)}c((s=s.apply(e,t||[])).next())})},__generator=this&&this.__generator||function(e,t){function i(e){return function(t){return s([e,t])}}function s(i){if(n)throw new TypeError("Generator is already executing.");for(;o&&(o=0,i[0]&&(c=0)),c;)try{if(n=1,a&&(r=2&i[0]?a.return:i[0]?a.throw||((r=a.return)&&r.call(a),0):a.next)&&!(r=r.call(a,i[1])).done)return r;switch(a=0,r&&(i=[2&i[0],r.value]),i[0]){case 0:case 1:r=i;break;case 4:return c.label++,{value:i[1],done:!1};case 5:c.label++,a=i[1],i=[0];continue;case 7:i=c.ops.pop(),c.trys.pop();continue;default:if(r=c.trys,!(r=r.length>0&&r[r.length-1])&&(6===i[0]||2===i[0])){c=0;continue}if(3===i[0]&&(!r||i[1]>r[0]&&i[1]<r[3])){c.label=i[1];break}if(6===i[0]&&c.label<r[1]){c.label=r[1],r=i;break}if(r&&c.label<r[2]){c.label=r[2],c.ops.push(i);break}r[2]&&c.ops.pop(),c.trys.pop();continue}i=t.call(e,c)}catch(e){i=[6,e],a=0}finally{n=r=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}var n,a,r,o,c={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]};return o={next:i(0),throw:i(1),return:i(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o},__read=this&&this.__read||function(e,t){var i="function"==typeof Symbol&&e[Symbol.iterator];if(!i)return e;var s,n,a=i.call(e),r=[];try{for(;(void 0===t||t-- >0)&&!(s=a.next()).done;)r.push(s.value)}catch(e){n={error:e}}finally{try{s&&!s.done&&(i=a.return)&&i.call(a)}finally{if(n)throw n.error}}return r};$(document).on("click",".productBox_product .colors img, .ParamVariant2 img",function(e){var t=$(this),i=new ColorChanger(t);i.initialized&&(i.setActive(),i.changeMainImage())}),$(document).on("click",function(e){if(e.target instanceof HTMLElement){var t=e.target,i=!$(t).closest(".availSizes").length,s=!$(t).closest(".productBox_product .colors img"),n=t.classList.contains("close"),a=$(".availSizes").length;(i&&s||n)&&a&&setTimeout(function(){$(".availSizes").remove(),$(".open-size").removeClass("open-size"),$(".product-color.active").removeClass("active")},0)}}),$(document).on("click","[data-click=hoversize]",function(e){e.preventDefault(),trackGaq("Katalog","kliknuti",$(this).text())&&(window.location.href=$(this).attr("href"))});var ColorChanger=function(){function e(t){if(this.initialized=!1,this._restSizes=0,0===t.closest(".detail__infoForm").length){e.lineSize=isMobile?3:4,this._element=t,this._pic=this._element.attr("data-foto-path"),this._title=this._element.attr("title"),this._alt=this._element.attr("alt"),this._element.closest(".productBox_product").length?this._wrapper=this._element.closest(".productBox_product"):this._element.parents("article").length?this._wrapper=this._element.parents("article"):this._element.parents(".body-item.body-mob").length?this._wrapper=this._element.parents(".body-item").find("#DetailImgGalery"):this._wrapper=this._element.parents("section");var i=this._wrapper.find("p.product-name a");this._productName=i.text(),void 0!==i.attr("href")&&(this._productUrl=i.attr("href").split("?")[0]),this.replacePictureParam(),this.initialized=!0}}return e.getRestSizesText=function(e){return 1===e?GetTextDynamic("color_changer_rest_size_1"):e>1&&e<5?GetTextDynamic("color_changer_rest_size_2_4"):GetTextDynamic("color_changer_rest_size_5")},e.prototype.replacePictureParam=function(){this._element.closest("#CrossSell")&&(this._pic=this._pic.replace("prg12","prg11"))},e.prototype.getAdviceJetSize=function(){var e=decodeURIComponent(getCookie("advice"));if(0===e.length)return"";var t=JSON.parse(e);return null!==t&&void 0!==t?null!==t.ResultSize&&t.ResultSize.length?t.ResultSize:null!=t.ClientResultSize?t.ClientResultSize:"":""},e.prototype.getSizeLink=function(e){return void 0==e?"":'<a href="'.concat(this._productUrl,"?size=").concat(e.size,"&color=").concat(this._title,'" title="').concat(this._productName," - ").concat(this._title," - ").concat(e.presentationSize,'" data-click="hoversize">').concat(e.presentationSize,"</a>")},e.prototype.getClientInnerHtml=function(e,t){var i=t.findIndex(function(t){return-1!==t.size.
1indexOf(e)}),s=i>0,n=i<t.length-1,a="";return isMobile?s&&n?(a+='<div class="sizes-row active"><span class="active">'.concat(this.getSizeLink(t[i]),'</span></div><div class="sizes-row"><span>').concat(this.getSizeLink(t[i-1]),"</span><span>").concat(this.getSizeLink(t[i+1]),"</span></div>"),this._restSizes-=3):!s&&n?(a+='<div class="sizes-row active"><span class="active">'.concat(this.getSizeLink(t[i]),'</span></div><div class="sizes-row"><span>').concat(this.getSizeLink(t[i+1]),"</span>"),this._restSizes-=2,i+2<t.length&&(a+="<span>".concat(this.getSizeLink(t[i+2]),"</span>"),this._restSizes-=1),a+="</div>"):s&&!n?(a+='<div class="sizes-row active"><span class="active">'.concat(this.getSizeLink(t[i]),'</span></div><div class="sizes-row">'),i-2>-1&&(a+="<span>".concat(this.getSizeLink(t[i-2]),"</span>"),this._restSizes-=1),a+="<span>".concat(this.getSizeLink(t[i-1]),"</span></div>"),this._restSizes-=2):(a+='<div class="sizes-row active"><span class="active">'.concat(this.getSizeLink(t[i]),"</span></div>"),this._restSizes-=1):s&&n?(a+="<span>".concat(this.getSizeLink(t[i-1]),'</span><span class="active">').concat(this.getSizeLink(t[i]),"</span><span>").concat(this.getSizeLink(t[i+1]),"</span>"),this._restSizes-=3):!s&&n?(a+='<span class="active">'.concat(this.getSizeLink(t[i]),"</span><span>").concat(this.getSizeLink(t[i+1]),"</span>"),this._restSizes-=2,i+2<t.length&&(a+="<span>".concat(this.getSizeLink(t[i+2]),"</span>"),this._restSizes-=1)):s&&!n?(i-2>-1&&(a+="<span>".concat(this.getSizeLink(t[i-2]),"</span>"),this._restSizes-=1),a+="<span>".concat(this.getSizeLink(t[i-1]),'</span><span class="active">').concat(this.getSizeLink(t[i]),"</span>"),this._restSizes-=2):(a+='<span class="active">'.concat(this.getSizeLink(t[i]),"</span>"),this._restSizes-=1),a},e.prototype.getBestSizesInnerHtml=function(t){var i,s="",n=this._element.data("product-code").toString(),a=parseInt(this._element.data("variant-id"));if(0!==e.bestSizesCount)if(EshopService("GetBestSellerSizeByColour",{productC
1ode:n,variantId:a},!1,function(e){if(0===e.ErrorLevel){var t=e.Message.split("|");i=t.map(function(e){var t=__read(e.split(";"),2);return{size:t[0],presentationSize:t[1]}})}}),0===i.length){var r=e.lineSize*e.lines;r>=t.length&&(r=t.length-1),t=t.slice(0,r)}else if(1===e.bestSizesCount)t=this.getBestSizes(t,i[0]);else if(i.length>0){var o=e.bestSizesCount;o>i.length&&(o=i.length),t=i.slice(0,o)}for(var c=!1,l=0;l<t.length;l++)c||(s+="<div class='sizes-row'>",c=!0),s+="<span>".concat(this.getSizeLink(t[l]),"</span>"),l>0&&(l+1)%e.lineSize==0&&(s+="</div>",c=!1);return c&&(s+="</div>"),this._restSizes-=t.length,s},e.prototype.getSizes=function(e,t){return __awaiter(this,void 0,void 0,function(){return __generator(this,function(i){return[2,new Promise(function(i,s){EshopService("GetCommoditySizeByColour",{productId:e,variantId:t},!0,function(e){if(0===e.ErrorLevel){var t=e.Message.split("|"),s=t.map(function(e){var t=e.split(";"),i=t[0];return{size:i,presentationSize:t.length>1?t[1]:i}});i(s)}})})]})})},e.prototype.getBestSizes=function(t,i){var s=t.length,n=t.indexOf(i),a=Math.round(s/e.lineSize),r=Math.floor(n/e.lineSize),o=Math.floor(e.lines/2),c=Math.round(e.lines/2)-1,l=r-o,p=r+c;l<0&&(p+=-1*l,l=0),p>a&&(l>0&&l>p-a&&(l-=p-a),p=a);var h=(p+1)*e.lineSize;if(h>s){l-=Math.ceil((h-s)/e.lineSize),l<0&&(l=0),h=s}var d=l*e.lineSize;return t.slice(d,h)},e.prototype.scrollCarouselItem=function(){var e=this._wrapper.find(".f-carousel"),t=this._pic.replace("prg11","prg12").replace("/21","/01"),i=e.find(".f-carousel__slide"),s=e.find('.f-carousel__slide img[src="'+t+'"]').first(),n=s.closest(".f-carousel__slide"),a=i.index(n),r=e[0].Carousel,o=Array.from(r.getVisibleSlides().values()),c=o[0].index;a>-1&&a!=c&&r.slideTo(a)},e.prototype.setActive=function(){this._wrapper.find(".ParamVariant2 .active").removeClass("active"),this._element.addClass("active"),this._element.closest("li").addClass("active")},e.prototype.changeMainImage=function(e){if(this._wrapper.find(".product-image a.mainImage img").length&&!this._wrapper.hasClass("quickviewsection")){this._wrapper.find(".product-image a.mainImage img:not(.product-image-hover)").length>1&&this._wrapper.find(".product-image a.mainImage img:not(.product-image-hover)").each(function(e,t){e>0&&$(this).remove()});var t=this._wrapper.find(".product-image a.mainImage img:not(.product-image-hover)").first();t.removeAttr("style").removeClass("newimg"),e&&e(this._pic);var i=t.clone();i.attr("src",this._pic),i.addClass("newimg").attr("style","display: none").attr("loading","eager"),i.on("load",function(e){$(e.target).fadeIn("slow"),t.fadeOut("slow",function(){$(this).parent().find(".newimg").removeClass("newimg"),$(this).remove()})}),this._wrapper.find(".product-image a.mainImage").append(i),i.attr("title","".concat(this._productName," ").concat(this._title)),i.attr("alt","".concat(this._productName," ").concat(this._alt))}else this._wrapper.find(".f-carousel").length&&this.scrollCarouselItem()},e.prototype.preRenderSizes=function(){var e=parseInt(this._element.data("product-id")),t=parseInt(this._element.data("variant-id"));if(!isNaN(e)&&!isNaN(t)){$(".availSizes").remove(),$(".product-color.active").removeClass("active");var i=document.createElement("div");if(i.className="availSizes",isMobile){var s=window.innerWidth/2;this._wrapper[0].offsetWidth+this._wrapper[0].offsetLeft<=s?i.className="availSizes show-right":i.className="availSizes show-left"}var n="<span class='close'></span>";n+='<div class="headline"></div><div class="sizes sizes-wrapper" style="text-align: center"">',n+='<img class="preload" src="https://i.astratex.cz/Ig/SVG/preload_32.svg"/>',n+='</div><div class="more">',n+="</div>",i.innerHTML=n,this._element.parents(".colors").append(i),this.ClickOutsideSize(),this.getSizesString(e,t)}},e.prototype.getSizesString=function(e,t){return __awaiter(this,void 0,void 0,function(){var i;return __generator(this,function(s){switch(s.label){case 0:return[4,this.getSizes(e,t)];case 1:return i=s.sent(),this.openSizes(i),[2]}})})},e.prototype.openSizes=function(t){if(null!==this._element&&($(".availSizes").remove(),$(".product-color.active").removeClass("active"),this._element.hasClass("open-size")&&this._element.removeClass("open-size"),void 0!==this._element.attr("data-avail-sizes"))){this._element.addClass("open-size"),this._element.parent(".product-color").addClass("active");var i=t;this._restSizes=i.length;var s=this.getAdviceJetSize(),n=isMobile?"":" | ",a=isMobile?"":":",r=document.createElement("div");if(r.className="availSizes",isMobile){var o=window.innerWidth/2;this._wrapper[0].offsetWidth+this._wrapper[0].offsetLeft<=o?r.className="availSizes show-right":r.className="availSizes show-left"}else{var c=$(".product-color.active");if(c.length){var l=c.position(),p=l.top+28.5;r.style.transform="translateY(".concat(p,"px)")}}var h=s.length>0&&i.findIndex(function(e){return-1!==e.size.indexOf(s)})>-1?GetTextDynamic("color_changer_in_your_size"):GetTextDynamic("color_changer_best_sellers"),d="<span class='close'></span>";d+='<div class="headline"><span class="color-name">'.concat(this._title,"</span>").concat(n,'<span class="color-text">
1').concat(h).concat(a,'</span></div><div class="sizes sizes-wrapper">'),s.length>0&&i.findIndex(function(e){return-1!==e.size.indexOf(s)})>-1?d+='<div class="sizes sizes-personal">'.concat(this.getClientInnerHtml(s,i),"</div>"):d+='<div class="sizes sizes-bestseller">'.concat(this.getBestSizesInnerHtml(i),"</div>"),d+='</div><div class="more">',this._restSizes>0&&(d+='<a href="'.concat(this._productUrl,'" title="').concat(this._productName,'">+ ').concat(this._restSizes," ").concat(e.getRestSizesText(this._restSizes),"</a>")),d+="</div>",r.innerHTML=d;var u=this._element.parents(".color-premium-line");if(u.length)return void u.append(r);this._element.parents(".colors").append(r),this.ClickOutsideSize()}},e.prototype.ClickOutsideSize=function(){document.addEventListener("click",function e(t){var i=!1;t.composedPath().forEach(function(t){if(t instanceof Element){if(t.classList.contains("availSizes"))return void(i=!0);if(t.classList.contains("product-color"))return i=!0,void document.removeEventListener("click",e)}}),i||($(".availSizes").remove(),$(".product-color.active").removeClass("active"),document.removeEventListener("click",e))})},e.lines=4,e.lineSize=4,e.bestSizesCount=1,e}();

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.