(function() { try { if(window.jQuery) { function pictureCategories(config, overrideIcons, iconCache, appTranslations) { this.translation = typeof appTranslations == 'undefined' ? {} : appTranslations; this.config = {}; this.overrideIcons = []; this.cacheIcons = []; this.categories = {}; this.categoryMap = {}; this.tmpCategories = []; this.isMobile = (/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent) || navigator.userAgent.match(/iPad/i) != null || navigator.userAgent.match(/iPod/i) != null || navigator.userAgent.match(/iPhone/i) != null); var configJson = window.shoper.base64.decode(config); function parseCfgInt(cfgVal, toBool){ var out = parseInt(cfgVal); if(typeof toBool != 'undefined' && toBool == true){ out = out > 0 ? true : false; } return out; } if (configJson) { cfg = jQuery.parseJSON(configJson); this.config = { /*'ready': cfg['ready'], 'template': cfg['template'],*/ 'downloadMode': cfg['mainTpl'].length <= 0 ? "grid" : "classic", 'mainPageHtml': cfg['mainTpl'].length > 0 ? cfg['mainTpl'] : cfg['ready'], 'otherPageHtml': cfg['otherTpl'], 'custom_module_id': cfg['custom_module_id'], 'show_in_custom_module': parseCfgInt(cfg['show_in_custom_module'], true), 'main_all_categories': parseCfgInt(cfg['main_all_categories'], true), 'imageWidth': '300', 'imageHeight': '300' }; if(parseCfgInt(cfg['main_all_categories']) == false){ this.config['main_categories'] = cfg['main_categories']; } } else { return; } var overrideIconsJson = window.shoper.base64.decode(overrideIcons); if (overrideIconsJson) { this.overrideIcons = jQuery.parseJSON(overrideIconsJson); } if (iconCache) { var cacheIconsJson = window.shoper.base64.decode(iconCache); if (cacheIconsJson) { this.cacheIcons = jQuery.parseJSON(cacheIconsJson); } } if (this.config.show_in_custom_module && $('#'+this.config.custom_module_id).length == 0) { return; } this.showModule(); }; pictureCategories.prototype = (function(){ var _downloadCategories = function(categoryId, page, htmlMode) { if (categoryId === 0) { window.frontAPI.getRootCategoryTree(function (mainCategories){ if (typeof mainCategories.list != 'undefined' && mainCategories.list.length > 0) { this.tmpCategories = this.tmpCategories.concat(mainCategories.list); } if (mainCategories.page >= mainCategories.pages) { _handleCategories.call(this, this.tmpCategories, htmlMode); } else { _downloadCategories.call(this, categoryId, ++page, htmlMode); } }.bind(this), { urlParams: '?limit=50&page='+page }); } else { window.frontAPI.getCategoryChildrens(function (categories){ if (typeof categories.list != 'undefined' && categories.list.length > 0) { this.tmpCategories = this.tmpCategories.concat(categories.list); } if (categories.page >= categories.pages) { _handleCategories.call(this, this.tmpCategories, htmlMode); } else { _downloadCategories.call(this, categoryId, ++page, htmlMode); } }.bind(this), { id: categoryId, urlParams: '?limit=50&page='+page }); } }; var _handleCategories = function(categories, htmlMode){ if (this.config.show_in_custom_module && categories.length === 0) { $('#'+this.config.custom_module_id).removeClass('loading'); $('#'+this.config.custom_module_id).addClass('none'); } if (categories.length === 0) { return; } for (var i = 0; i < categories.length; i++) { var category = categories[i]; category.subcategories = []; category.subcategories_count = 0; category.items = 0; category.image = ''; if (this.cacheIcons.hasOwnProperty(String(category.category_id))) { category.items = this.cacheIcons[String(category.category_id)]['count']; category.image = this.cacheIcons[String(category.category_id)]['image']; } if ($.inArray(String(category.category_id), this.overrideIcons) !== -1) { category.image = window.shoper.url('public/assets/images/categories/category_'+category.category_id+'.jpg'); } var category_id = category.category_id; var categoryIndex = Object.keys(this.categories).length; this.categories[categoryIndex] = category; this.categoryMap[category_id] = categoryIndex; } if(typeof htmlMode == 'string' && typeof this.config[htmlMode] != 'undefined'){ _displayCategoriesClassic.call(this, this.config[htmlMode]); } else if(typeof htmlMode == 'string' && htmlMode == ""){ setupGrid.call(this); } }; var setupGrid = function(){ var self = this; var $tiles = $("#wce_pictureCategories .wce_tile[data-category-id]"); var $images = $("#wce_pictureCategories .wce_tile[data-category-id] img[data-src]"); var $counters = $("#wce_pictureCategories .wce_tile[data-category-id] .wce_count"); if($tiles.length <= 0){ return; } if(this.isMobile){ $("#wce_pictureCategories").addClass('wce_app-mobile'); } $images.each(function(){ var $tile = $(this).parents("[data-category-id]").eq(0); var cid = $tile.attr("data-category-id"); var index = self.categoryMap[cid]; var category = self.categories[index]; if(typeof category != 'undefined'){ $(this).attr("alt", category.translation.name); } }); useIntersectionObserver.call(this, { target: $images, observeConstantly: false, callbackVisible: function($img, obs){ var newSrc = $img.attr("data-src"); $img.attr("src", newSrc); $img.load(function(){ removeFromLazyAttr.call(self, $(this).parents("[data-lazy-content]"), "[image]"); }); } }); useIntersectionObserver.call(this, { target: $counters, observeConstantly: false, callbackVisible: function($counter, obs){ var cid = $counter.parents("[data-category-id]").attr("data-category-id"); if(typeof self.categoryMap[cid] === 'undefined'){ removeFromLazyAttr.call(self, $counter.parents("[data-lazy-content]"), "[count]"); return false; } window.frontAPI.getProductsFromCategory(function (products) { if(typeof products !== 'undefined'){ $counter.text(products.count); } else{ $counter.addClass("none"); } removeFromLazyAttr.call(self, $counter.parents("[data-lazy-content]"), "[count]"); }, { id: cid }); } }); var $subcategoriesContainer = $("#wce_pictureCategories template.wce_subcategories-template"); useIntersectionObserver.call(this, { target: $tiles, observeConstantly: false, callbackVisible: function($tile, obs){ var cid = $tile.attr("data-category-id"); var $links = $tile.find(".wce_links"); var index = self.categoryMap[cid]; var category = self.categories[index]; if(typeof category === 'undefined'){ $tile.addClass("wce_category-inactive"); removeFromLazyAttr.call(self, $tile, "[subcategories]"); $tile.find(".wce_name a:not(.wce_showSublist), a.wce_image-link, .wce_subCategories .wce_more a").attr("href", null); return false; } $tile.find(".wce_name a:not(.wce_showSublist), a.wce_image-link, .wce_subCategories .wce_more a").attr("href", category.url); var $nameToReload = $tile.find(".wce_name a.wce_name-text[data-reload-category='true']"); if($nameToReload.length > 0){ $nameToReload.text(category.translation.name); $nameToReload.attr("data-reload-category", null); } if($subcategoriesContainer.length > 0){ var limit = parseInt( $tile.attr("data-subcategories-limit") ); window.frontAPI.getCategoryChildrens(function (categories) { if(categories.count > 0){ $tile.addClass("wce_hasSublist"); $tile.find(".wce_showSublist").removeClass("none"); var subcategoriesContainer = $subcategoriesContainer[0].content.cloneNode(true); if($tile.find(".wce_cube-side-2").length > 0){ $tile.find(".wce_cube-side-2").append(subcategoriesContainer); } else{ $tile.append(subcategoriesContainer); } for(var idx in categories.list){ var cat = categories.list[idx]; $tile.find(".wce_subCategories li").eq(idx).removeClass("none"); $tile.find(".wce_subCategories a").eq(idx).attr("href", cat.url); $tile.find(".wce_subCategories a").eq(idx).text(cat.translation.name); } if(categories.count <= limit){ $tile.find(".wce_subCategories .wce_more").remove(); } else{ $tile.find(".wce_subCategories .wce_more a").attr("href", category.url); $tile.find(".wce_subCategories .wce_more a").text(self.translation['more']); } } else if($tile.find(".wce_cube-side-2").length > 0){ $tile.find(".wce_cube-side-2").addClass("none"); } $tile.find(".wce_subCategories li.none").remove(); removeFromLazyAttr.call(self, $tile, "[subcategories]"); }, { urlParams: '?limit='+limit, id: cid }); } } }); eventsForGrid.call(this); }; var removeFromLazyAttr = function($el, key){ if(typeof $el.attr("data-lazy-content") == "undefined"){ return; } var lazyAttr = $el.attr("data-lazy-content").replace(key, ""); $el.attr("data-lazy-content", lazyAttr); }; var injectContent = function(boxContent){ if(typeof boxContent == "undefined" || boxContent.length <= 0){ return; } if (this.config.show_in_custom_module) { var $box = $('#'+this.config.custom_module_id); if ($box.find('.innerbox').length > 0) { $box.find('.innerbox').append(boxContent); } else { $box.append(boxContent); } $box.removeClass('loading'); $box.addClass('wce_box-ready'); } else { if ($('div.main div.centercol').length > 0) { $('div.main div.centercol').prepend(boxContent); } } }; var displayOtherPageLayout = function(){ injectContent.call(this, this.config['otherPageHtml']); }; var displayMainPageLayout = function(){ injectContent.call(this, this.config['mainPageHtml']); }; var useIntersectionObserver = function(options){ /* * options: { * target: string selector | jQueryObj, * observeConstantly: boolean, * callbackVisible: function($(element.target), observer){}, * callbackInvisible: function($(element.target), observer){}, * observerOptions: object (https://developer.mozilla.org/en-US/docs/Web/API/Intersection_Observer_API) * } */ var $targetObj = null; var observeConstantly = false; var _observerOptions = {threshold: 0.3}; if(typeof options.target == 'string' && $(options.target).length > 0){ $targetObj = $(options.target); } else if(typeof options.target == 'object' && options.target.length > 0){ $targetObj = options.target; } else{ return; } if(typeof options.observeConstantly == 'boolean'){ observeConstantly = options.observeConstantly; } if(typeof options.observerOptions == 'object'){ $.extend( true, _observerOptions, options.observerOptions); } if ("IntersectionObserver" in window) { var observer = new IntersectionObserver(function (entries, observer) { entries.forEach(function (element) { if (element.isIntersecting) { if(observeConstantly == false){ observer.unobserve(element.target); } if(typeof options.callbackVisible == 'function'){ options.callbackVisible( $(element.target), observer ); } } else if(typeof options.callbackInvisible == 'function'){ options.callbackInvisible( $(element.target), observer ); } }); }, _observerOptions); $targetObj.each(function () { observer.observe(this); }); } }; var _displayCategoriesClassic = function(htmlStamp){ if (this.categories.length === 0) { if (this.config.show_in_custom_module == true) { $('#'+this.config.custom_module_id).addClass('wce_box-ready wce_box-empty'); } return; } var self = this; var $htmlStamp = $(htmlStamp); var $tileStamp = $htmlStamp.find(".wce_tile").clone(); var $categoriesUl = $htmlStamp.find("ul.wce_categoriesImg"); $htmlStamp.find(".wce_tile").remove(); if (navigator.userAgent.indexOf(".NET") >= 0) { if($htmlStamp.hasClass(".box")){ $htmlStamp.find("#wce_pictureCategories").addClass('wce_ieFix'); } else{ $htmlStamp.addClass('wce_ieFix'); } } if(this.isMobile){ $htmlStamp.find("#wce_pictureCategories").addClass('wce_app-mobile'); if($htmlStamp.hasClass(".box")){ $htmlStamp.find("#wce_pictureCategories").addClass('wce_app-mobile'); } else{ $htmlStamp.addClass('wce_app-mobile'); } } if(typeof this.config.main_categories != 'undefined' && this.config.main_categories != null && this.config.main_categories.length > 0 && $("body.shop_index").length > 0){ var useMainLimit = true; } else { var useMainLimit = false; } for (var idx in this.categories) { var category = this.categories[idx]; if (typeof category !== 'undefined' && (useMainLimit === false || (useMainLimit && $.inArray(String(category.category_id), this.config.main_categories) !== -1))) { var $thisTile = $tileStamp.clone(); $thisTile.attr("data-category-id", category.category_id); $categoriesUl.append($thisTile); if(typeof category != 'undefined'){ $thisTile.find("img").attr("alt", category.translation.name); } } } injectContent.call(this, $htmlStamp); eventsForClassic.call(this); eventsForSlider.call(this); useIntersectionObserver.call(this, { target: $("#wce_pictureCategories .wce_categoriesImg .wce_tile"), observeConstantly: false, callbackVisible: function($tile, obs){ var cid = $tile.attr("data-category-id"); var index = self.categoryMap[cid]; var category = self.categories[index]; fillTileByData.call(self, category, $tile); } }); }; var fillTileByData = function(category, $tile){ $tile.find(".wce_name a:not(.wce_showSublist)").text(category.translation.name); $tile.find("a.wce_image-link").attr("title", category.translation.name); $tile.find(".wce_name a:not(.wce_showSublist), a.wce_image-link, .wce_subCategories .wce_more a").attr("href", category.url); $tile.find(".wce_subCategories .wce_more a").text(this.translation['more']); var $img = $tile.find("img"); var $counter = $tile.find(".wce_count"); var useDefaultImg = true; $img.load(function(){ if($(this).attr("src").indexOf("data:image/gif;") < 0){ removeFromLazyAttr.call(self, $(this).parents("[data-lazy-content]"), "[image]"); } }); if(category.image != ''){ $img.attr("src", category.image); useDefaultImg = false; } if(category.items > 0 && $counter.length > 0){ $counter.text(category.items); removeFromLazyAttr.call(self, $tile, "[count]"); } if( ($counter.length > 0 && category.items == 0) || category.image == ''){ window.frontAPI.getProductsFromCategory(function (products) { if(useDefaultImg === true){ if (typeof products.count && products.count > 0) { $img.attr("src", _generateImageUrl.call(this, products.list[0].main_image, products.list[0].main_image_filename)); } else{ $img.attr("src", _generateImageUrl.call(this, '', '')); } } if($counter.length > 0){ $counter.text(products.count); removeFromLazyAttr.call(self, $tile, "[count]"); } }.bind(this), { urlParams: '?limit=1', id: category.category_id }); } if($tile.find(".wce_subCategories").length > 0){ var $subcategories = $tile.find(".wce_subCategories"); var subcategoriesLimit = parseInt($tile.attr("data-subcategories-limit")); if(!$subcategories.parent().hasClass("wce_cube-side-2")){ $subcategories.hide(); } window.frontAPI.getCategoryChildrens(function (subcategories) { if (subcategories.count) { $tile.addClass('wce_hasSublist'); var $liStamp = $subcategories.find("li:not(.wce_more)").clone(); var $liMoreStamp = $subcategories.find("li.wce_more").clone(); $subcategories.find("li").remove(); if(subcategories.count > 8){ $subcategories.addClass("wce_overflow-auto"); } for (var i = 0; i < subcategories.list.length; i++) { var subcategory = subcategories.list[i]; var $li = $liStamp.clone(); $li.find("a").attr("href", subcategory.url); $li.find("a").text(subcategory.translation.name); $subcategories.append($li); } if (subcategories.count > subcategoriesLimit) { $subcategories.append($liMoreStamp); } } else{ $subcategories.remove(); $tile.find(".wce_showSublist").remove(); $tile.find(".wce_cube-side-2").remove(); } removeFromLazyAttr.call(this, $tile, "[subcategories]"); }.bind(this), { urlParams: '?limit=' + subcategoriesLimit, id: category.category_id }); } }; var _generateImageUrl = function(main_image, main_image_filename){ var src = window.shoper.url('environment/cache/images/'+this.config.imageWidth+'_'+this.config.imageHeight+'_productGfx___overlay.jpg'); if(typeof main_image_filename === 'string' && main_image_filename.length > 0){ src = window.shoper.url('environment/cache/images/'+this.config.imageWidth+'_'+this.config.imageHeight+'_productGfx_'+main_image_filename); } else if(typeof main_image === 'string' && main_image.length > 0) { src = window.shoper.url('environment/cache/images/'+this.config.imageWidth+'_'+this.config.imageHeight+'_productGfx_'+main_image+'.jpg'); } return src; }; var eventsForClassic = function(){ if(this.isMobile){ $("body").on("click", "#wce_pictureCategories:not([data-wce-grid]) .wce_categoriesImg:not(.wce_3d-fx) .wce_tile.wce_hasSublist .wce_name", function(e){ return false; }); $("body").on("touchend", "#wce_pictureCategories:not([data-wce-grid]) .wce_categoriesImg:not(.wce_3d-fx) .wce_tile .wce_name", function(e){ e.stopPropagation(); var $el = $(e.currentTarget); var $subCategories = $el.parents(".wce_tile").eq(0).find(".wce_subCategories"); var $subCategoriesTrigger = $el.parents(".wce_tile").eq(0).find(".wce_showSublist"); if($subCategoriesTrigger.hasClass("wce_rotate")){ $subCategories.stop().slideUp(300); $subCategoriesTrigger.removeClass("wce_rotate"); } else{ $("#wce_pictureCategories:not([data-wce-grid]) .wce_categoriesImg:not(.wce_3d-fx) .wce_tile .wce_subCategories").stop().slideUp(300); $("#wce_pictureCategories:not([data-wce-grid]) .wce_categoriesImg:not(.wce_3d-fx) .wce_tile .wce_showSublist").removeClass("wce_rotate"); $subCategories.stop().slideDown(300); $subCategoriesTrigger.addClass("wce_rotate"); } }); } else{ $("body").on("mouseenter", "#wce_pictureCategories:not([data-wce-grid]) .wce_categoriesImg:not(.wce_3d-fx) .wce_tile .wce_name", function(e){ var $el = $(e.currentTarget); var $tile = $el.parents(".wce_tile").eq(0); $tile.find(".wce_subCategories").stop().slideDown(300); $tile.find(".wce_showSublist").addClass("wce_rotate"); }); $("body").on("mouseleave", "#wce_pictureCategories:not([data-wce-grid]) .wce_categoriesImg:not(.wce_3d-fx) .wce_tile", function(e){ var $el = $(e.currentTarget); $el.find(".wce_subCategories").stop().slideUp(300); $el.find(".wce_showSublist").removeClass("wce_rotate"); }); } eventsCommon.call(this); }; var eventsForGrid = function(){ eventsCommon.call(this); }; var eventsCommon = function(){ var self = this; var mobileClosingTimeout = null; $("body").on("click", "#wce_pictureCategories .wce_categoriesImg .wce_tile .wce_showSublist", function(e){ var $el = $(e.currentTarget); var $tile = $el.parents(".wce_tile").eq(0); if($tile.hasClass("wce_opened")){ $tile.removeClass("wce_opened"); } else{ $("#wce_pictureCategories[data-wce-grid] .wce_categoriesImg .wce_tile.wce_opened").removeClass("wce_opened"); $tile.addClass("wce_opened"); if(self.isMobile){ mobileClosingTimeout = setTimeout(function(){ $tile.removeClass("wce_opened"); }, 5000); } } }); $("body").on("click", function(e){ var $el = $(e.target); if($el.parents("#wce_pictureCategories").length <= 0){ $("#wce_pictureCategories .wce_categoriesImg .wce_tile.wce_opened").removeClass("wce_opened"); } }); $("body").on("mouseleave", "#wce_pictureCategories .wce_categoriesImg.wce_3d-fx .wce_tile", function(e){ var $el = $(e.currentTarget); $el.removeClass("wce_opened"); }); $("body").on("mouseenter", "#wce_pictureCategories .wce_categoriesImg.wce_3d-fx .wce_tile .wce_cube-side-2", function(e){ var $el = $(e.currentTarget); $el.parents(".wce_tile").addClass("wce_opened"); }); if(this.isMobile){ $("body").on("touchstart", "#wce_pictureCategories .wce_categoriesImg .wce_tile .wce_subCategories", function(e){ if(mobileClosingTimeout != null){ clearTimeout(mobileClosingTimeout); } }); $("body").on("touchend", "#wce_pictureCategories .wce_categoriesImg .wce_tile .wce_subCategories", function(e){ var $el = $(e.currentTarget); var $tile = $el.parents(".wce_tile").eq(0); mobileClosingTimeout = setTimeout(function(){ $tile.removeClass("wce_opened"); }, 5000); }); } }; var eventsForSlider = function(){ if($("#wce_pictureCategories .wce_slider-scroll-container").length <= 0){ return; } var self = this; this.$scrollingContainer = $("#wce_pictureCategories .wce_slider-scroll-container"); $("#wce_pictureCategories .wce_slider-scroll-container").scrollLeft(0); this.scrollInterval = null; this.step = 100; /* px */ $("body").on("click", "#wce_pictureCategories .wce_category-slider-nav.wce_prev", function(e){ var $el = $(e.currentTarget); sliderStop.call(self); if($el.hasClass("wce_disabled")){ return; } sliderMove.call(self, "-=", (4*self.step)); }); $("body").on("click", "#wce_pictureCategories .wce_category-slider-nav.wce_next", function(e){ var $el = $(e.currentTarget); sliderStop.call(self); if($el.hasClass("wce_disabled")){ return; } sliderMove.call(self, "+=", (4*self.step)); }); if(self.isMobile == false){ $("body").on("mouseenter", "#wce_pictureCategories .wce_category-slider-nav.wce_prev", function(e){ var $el = $(e.currentTarget); sliderMove.call(self, "-="); }); $("body").on("mouseenter", "#wce_pictureCategories .wce_category-slider-nav.wce_next", function(e){ var $el = $(e.currentTarget); sliderMove.call(self, "+="); }); $("body").on("mouseleave", "#wce_pictureCategories .wce_category-slider-nav", function(e){ var $el = $(e.currentTarget); sliderStop.call(self); }); } useIntersectionObserver.call(this, { target: $(".wce_categoriesImg .wce_tile:first-child"), observeConstantly: true, callbackVisible: function ($edge, observer) { $("#wce_pictureCategories .wce_category-slider-nav.wce_prev").addClass("wce_disabled"); sliderStop.call(self); }, callbackInvisible: function ($edge, observer) { $("#wce_pictureCategories .wce_category-slider-nav.wce_prev").removeClass("wce_disabled"); }, observerOptions: { threshold: 1 } }); useIntersectionObserver.call(this, { target: $(".wce_categoriesImg .wce_tile:last-child"), observeConstantly: true, callbackVisible: function ($edge, observer) { $("#wce_pictureCategories .wce_category-slider-nav.wce_next").addClass("wce_disabled"); sliderStop.call(self); }, callbackInvisible: function ($edge, observer) { $("#wce_pictureCategories .wce_category-slider-nav.wce_next").removeClass("wce_disabled"); }, observerOptions: { threshold: 1 } }); }; var sliderStop = function () { if (this.scrollInterval != null) { clearInterval(this.scrollInterval); this.$scrollingContainer.stop(); } }; var sliderMove = function(direction, firstStep){ var self = this; var _firstStep = (this.isMobile == false && typeof firstStep == 'number') ? firstStep : this.step; this.$scrollingContainer.stop().animate({ scrollLeft: direction + _firstStep.toString() }, 1000, "linear"); if(self.isMobile == false){ this.scrollInterval = setInterval(function(){ self.$scrollingContainer.stop().animate({ scrollLeft: direction + self.step.toString() }, 1000, "linear"); }, 1000); } }; return { constructor:pictureCategories, showModule: function () { if (this.config.show_in_custom_module) { /*$('#'+this.config.custom_module_id).addClass('loading');*/ } if ($('body').hasClass('shop_index')) { if(this.config.downloadMode == "grid"){ displayMainPageLayout.call(this); _downloadCategories.call(this, 0, 1, ""); } else if(this.config.downloadMode == "classic"){ _downloadCategories.call(this, 0, 1, "mainPageHtml"); } } else if ($('body').hasClass('shop_product_list') && $('body').attr('id') !== 'shop_category0' && !$('body').hasClass('shop_product_promo') && !$('body').hasClass('shop_product_new') && !$('body').hasClass('shop_product_producer')) { var catId = $('body').attr('id'); catId = catId.replace('shop_category', ''); /*displayOtherPageLayout.call(this);*/ _downloadCategories.call(this, catId, 1, "otherPageHtml"); } else { if (this.config.show_in_custom_module) { $('#'+this.config.custom_module_id).removeClass('loading'); $('#'+this.config.custom_module_id).addClass('none'); } } }, getCategory: function(categoryId) { categoryId = parseInt(categoryId); if (isNaN(categoryId)) { return false; } if ($.inArray(String(categoryId), this.overrideIcons) !== -1) { return {'image':window.shoper.url('public/assets/images/categories/category_'+categoryId+'.jpg')}; } if (typeof this.categoryMap[categoryId] === 'undefined') { return false; } var categoryIndex = this.categoryMap[categoryId]; var category = this.categories[categoryIndex]; return category; } }; })(); var appTranslations = { more: "więcej" }; var wcePictureCategories_loaded = false; function wcePictureCategoriesInit() { if (wcePictureCategories_loaded) { return; } if(window.frontAPI && window.shoper){ wcePictureCategories_loaded = true; window.wcePictureCategories = new pictureCategories('eyJzaG93X2luX2N1c3RvbV9tb2R1bGUiOiIwIiwiY3VzdG9tX21vZHVsZV9pZCI6IiIsInVzZV9jYWNoZSI6IjAiLCJncmlkX3R5cGUiOiIwIiwibWFpbl9tb2RlIjoiMCIsIm1haW5fYWxsX2NhdGVnb3JpZXMiOiIxIiwibWFpbl9zaG93X21vYmlsZV9zY3JvbGwiOiIwIiwibWFpbl9zaG93X2Rlc2t0b3Bfc2Nyb2xsIjoiMCIsIm1haW5fM2RfZWZmZWN0IjoiMSIsIm1haW5fY29sdW1uc19taW4iOiIxIiwibWFpbl9jYXRlZ29yaWVzIjpudWxsLCJtYWluX3Nob3dfY2F0ZWdvcnlfbmFtZSI6IjEiLCJsaXN0X3Nob3dfcHJvZHVjdF9jb3VudCI6IjAiLCJsaXN0X3Nob3dfc3ViY2F0ZWdvcmllcyI6IjEiLCJsaXN0X3Nob3dfbW9iaWxlX3Njcm9sbCI6IjAiLCJsaXN0X3Nob3dfZGVza3RvcF9zY3JvbGwiOiIwIiwibGlzdF8zZF9lZmZlY3QiOiIxIiwibGlzdF9zdWJjYXRlZ29yeV9saW1pdCI6IjYiLCJsaXN0X2NvbHVtbnNfbWluIjoiMSIsImxpc3RfY29sdW1uc19tYXgiOiI0IiwibGlzdF9pbWFnZV9wcm9wb3J0aW9ucyI6IndjZV9ociIsImxpc3RfdGhlbWUiOiIwIiwibGlzdF9jb2xvcl9iYWNrZ3JvdW5kIjoicmdiYSgyNTUsMjU1LDI1NSIsImxpc3RfY29sb3JfdGV4dCI6InJnYmEoMjU1LDI1NSwyNTUiLCJsaXN0X2NvbG9yX2Jvcm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oMyBjbGFzcz1cIndjZV9uYW1lIHdjZV90cmFuc2l0aW9uXCI+IDxhIGhyZWY9XCIjXCI+PFwvYT4gPGEgY2xhc3M9XCJ3Y2Vfc2hvd1N1Ymxpc3Qgd2NlX3RyYW5zaXRpb24gZmEgZmEtYW5nbGUtcmlnaHRcIj48XC9hPiA8XC9oMz4gPFwvZGl2PiA8XC9kaXY+IDxkaXYgY2xhc3M9XCJ3Y2VfY3ViZS1zaWRlLTJcIj48dWwgY2xhc3M9XCJ3Y2Vfc3ViQ2F0ZWdvcmllc1wiPjxsaT48YSBjbGFzcz1cImJsb2NrXCIgaHJlZj1cIiNcIj48XC9hPjxcL2xpPjxsaSBjbGFzcz1cIndjZV9tb3JlXCI+PGEgY2xhc3M9XCJibG9ja1wiIGhyZWY9XCIjXCI+PFwvYT48XC9saT48XC91bD48XC9kaXY+IDxcL2Rpdj4gPFwvbGk+IDxcL3VsPiA8XC9kaXY+ICJ9', 'WyI0NjciLCI0NzAiLCI0ODYiLCI0OTYiLCI0OTkiLCI1MTAiLCI1MjAiLCI1MjEiLCI1MzMiLCI1MzQiLCI1MzUiLCI1NTciLCI1NTgiLCI1NjEiLCI1NzAiLCI1NzMiLCI1ODgiLCI1OTEiLCI2MTkiLCI2MjEiLCI2NjAiLCI2ODciLCI2OTEiLCI2OTIiLCI2OTQiLCI3MDQiLCI3NDQiLCI3NDUiLCI3NTMiLCI3NTUiLCI3ODYiLCI3ODgiLCI4NDIiXQ==', '', appTranslations); } else { console.log('App PictureCategories: FrontApi or Shoper not initialized yet'); setTimeout(function(){ wcePictureCategoriesInit();}, 2000); } } wcePictureCategoriesInit(); } else { console.log('No jQuery'); } } catch (e) { console.log(e); } })();