{"version":3,"sources":["categoryList.js","filter.js"],"names":["initFooterMenuToggle","mainCont","$","click","hiddenCont","this","siblings","toggleClass","hasClass","removeClass","find","addClass","accordion","window","width","resize","show","hide","initInfoPopUp","length","cookie","trigger","expires","Vendd","Scripts","load","isTouch","setTimeout"],"mappings":"AAYA,SAAAA,uBACA,IAAAC,SAAAC,EAAA,yCACAA,EAAA,mCAAAC,MAAA,WCdA,IAAAC,WAAAF,EAAAG,MAAAC,SAAA,sBACAJ,EAAAG,MAAAE,YAAA,6CACAH,WAAAI,SAAA,UACAJ,WAAAK,YAAA,WAEAR,SAAAS,KAAA,WAAAD,YAAA,UAAAH,SAAA,cAAAC,YAAA,6CACAH,WAAAO,SAAA,aAIA,IAAAC,WAAA,EAEAV,EAAAW,QAAAC,SAAA,MACAF,WAAA,GAGAV,EAAAW,QAAAE,OAAA,WACAb,EAAAW,QAAAC,QAAA,IACAF,YACAV,EAAA,qBAAAD,UAAAQ,YAAA,UAAAO,OACAJ,WAAA,GAIAA,YACAV,EAAA,qBAAAD,UAAAgB,OAAAX,SAAA,cAAAK,SAAA,yBAAAF,YAAA,uBACAG,WAAA,KAMA,SAAAM,gBAEAhB,EAAA,kBAEAiB,OAAA,GAGAjB,EAAAkB,OAAA,qBAGAlB,EAAA,uBAAAmB,QAAA,SACAnB,EAAAkB,OAAA,kBAAA,OAAA,CAAAE,QAAA,KD3CAC,MAAAC,QAAAC,KAAA,WACAC,WACA1B,uBAKA2B,WAAA,WACAT,iBACA","file":"footer.js","sourcesContent":["Vendd.Scripts.load(function () {\n\n\tvar $wrapper = $('.x-category-list');\n\n\tif ($wrapper.length < 1)\n\t\treturn;\n\n\tif ($wrapper.hasClass(\"js-lazyload\") && typeof $.fn.lazyload === \"function\") {\n\t\t$wrapper.find(\"img[data-lazyload]\").lazyload({\n\t\t\teffect: 'fadeIn',\n\t\t\tthreshold: 50,\n\t\t\tskip_invisible: false\n\t\t}).removeAttr(\"data-lazyload\");\n\t};\n});","Vendd.Scripts.load(function () {\n var $wrapper = $('.js-filters-wrapper'),\n wrapper,\n $configuration, configuration,\n selectedFiltersUrl = document.URL,\n isAjaxLoad = $wrapper.data('ajax-load') === \"True\";\n\n if ($wrapper.length < 1)\n return;\n\n wrapper = $wrapper.get(0);\n\n $configuration = $('#configuration', $wrapper);\n configuration = $configuration.text();\n $configuration.remove();\n\n function UpdateQueryString(key, value, url) {\n\n if (!url) url = window.location.href;\n\n // dirty fix for new url rewriter, remove page number to go back to page 1\n url = url.replace(/\\/{1}p{1}[0-9]+/, '');\n\n\n //Vendd.MessageBus.publishAsync(wrapper, new Vendd.FilterProduct.Messages.GetNextFilter());\n\n var re = new RegExp(\"([?|&])\" + key + \"=.*?(&|#|$)\", \"gi\");\n\n if (url.match(re)) {\n if (value)\n var value = url.replace(re, '$1' + key + \"=\" + value + '$2');\n else\n var value = url.replace(re, '$2');\n\n if (value.indexOf('?') == -1) { // convert first paramter separator to query params separator\n var pos = value.indexOf('&');\n if (pos != -1) // has at least one parameter\n value = value.substring(0, pos - 1) + '?' + value.substring(pos + 1, value.length);\n }\n return value;\n }\n else {\n if (value) {\n var separator = url.indexOf('?') !== -1 ? '&' : '?',\n hash = url.split('#');\n url = hash[0] + separator + key + '=' + value;\n if (hash[1]) url += '#' + hash[1];\n return url;\n }\n else\n return url;\n }\n };\n\n function getQueryStringValueByName(name) {\n name = name.replace(/[\\[]/, \"\\\\\\[\").replace(/[\\]]/, \"\\\\\\]\");\n var regexS = \"[\\\\?&]\" + name + \"=([^&#]*)\";\n var regex = new RegExp(regexS);\n var results = regex.exec(window.location.search);\n if (results == null)\n return \"\";\n else\n return decodeURIComponent(results[1].replace(/\\+/g, \" \"));\n };\n\n function removeValueFromCommaSeparatedString(list, value, separator) {\n separator = separator || \",\";\n var values = list.split(separator);\n for (var i = 0; i < values.length; i++) {\n if (values[i] == value.replace(/\\s+/g, '-')) {\n values.splice(i, 1);\n return values.join(separator);\n }\n }\n return list;\n };\n\n function loopThrough() {\n $('.x-control[data-control=\"filter\"][data-type=\"range\"]').each(function (i, rangeFilter) {\n var $wrapper = $(rangeFilter);\n var $slider = $wrapper.find('*[data-slider]');\n var $from = $wrapper.find('input[data-text].from');\n var $to = $wrapper.find('input[data-text].to');\n\n var isPagerAjax = $wrapper.data('ajax');\n var connectedList = $wrapper.data('list');\n\n var urlMask = $slider.data('mask');\n urlMask = urlMask.split('?')[1];\n var textMaskFrom = $from.data('mask');\n var textMaskTo = $to.data('mask');\n\n var minValue = Math.floor($slider.data('min'));\n var maxValue = Math.ceil($slider.data('max'));\n var currentMinValue = Math.floor($slider.data('from'));\n var currentMaxValue = Math.ceil($slider.data('to'));\n\n $slider.slider({\n range: true,\n min: minValue,\n max: maxValue,\n values: [currentMinValue, currentMaxValue],\n slide: function (event, ui) {\n $from.val(textMaskFrom.replace(\"((from))\", ui.values[0]));\n $to.val(textMaskTo.replace(\"((to))\", ui.values[1]));\n },\n stop: function (event, ui) {\n if (isPagerAjax) {\n if (connectedList === undefined)\n throw 'Connected list not declared for filter ' + $wrapper.attr('id');\n\n var $connectedList = $('.x-control[data-control=\"list\"][data-list=\"' + connectedList + '\"]').first();\n\n var config = $connectedList.get(0).getConfiguration();\n\n var filterIdentifier = 'Price';\n\n var filter = $.Enumerable.From(config.LoaderData.Filters)\n .Where(function (x) { return x.Key == filterIdentifier; })\n .DefaultIfEmpty(null).FirstOrDefault();\n\n if (filter === null) {\n throw 'Filter not found on connected list: ' + filterIdentifier;\n }\n if (ui.values[0] === minValue && ui.values[1] === maxValue) {\n filter.FromValue = null;\n filter.ToValue = null;\n }\n else {\n filter.FromValue = ui.values[0];\n filter.ToValue = ui.values[1];\n }\n $connectedList.get(0).load(config);\n }\n else {\n var queryNameFrom = 'price-from';\n var queryValueFrom = ui.values[0];\n var queryNameTo = 'price-to';\n var queryValueTo = ui.values[1];\n selectedFiltersUrl = UpdateQueryString(queryNameFrom, queryValueFrom, selectedFiltersUrl);\n selectedFiltersUrl = UpdateQueryString(queryNameTo, queryValueTo, selectedFiltersUrl);\n\n $('.apply-button', $('.js-filters-wrapper')).addClass('pulse-button');\n\n return false;\n }\n }\n });\n\n if (isPagerAjax) {\n if (connectedList === undefined)\n throw 'Connected list not declared for filter ' + $wrapper.attr('id');\n\n var $list = $('.x-control[data-control=\"list\"][data-list=\"' + connectedList + '\"]').first();\n $list.get(0).bind('dataload', function (control, response) {\n // here load self to get the new minValue && maxValue!\n // as a filter, load self with the query of all the rest filters without the self ones!\n });\n }\n\n $from.val(textMaskFrom.replace(\"((from))\", $slider.slider(\"values\", 0)));\n $to.val(textMaskTo.replace(\"((to))\", $slider.slider(\"values\", 1)));\n\n });\n }\n\n function addClickHandlers() {\n // Single Value Allowed\n $('select', $wrapper).sSelect().change(function () {\n var $this = $(this);\n var $selected = $(\"option:selected\", $this);\n var queryName = $selected.attr(\"data-query\");\n var queryValue = $selected.attr(\"data-value\");\n var items = getQueryStringValueByName(queryName);\n selectedFiltersUrl = UpdateQueryString(queryName, queryValue, selectedFiltersUrl);\n\n if ($wrapper.hasClass('js-auto-submit')) {\n window.location.href = selectedFiltersUrl;\n } else {\n $('.apply-button', $wrapper).addClass('pulse-button')\n }\n\n return false;\n });\n\n $(\".js-apply-filters\").click(function(e) {\n e.preventDefault;\n window.location.href = selectedFiltersUrl;\n });\n\n $(\".js-clear-all\").click(function (e) {\n\t\t\te.preventDefault();\n\t\t\tvar url = this.href;\n var href = url.substring(0,url.indexOf('?'))\n if (href) {\n window.location.href = href;\n }else {\n window.location.href = url;\n }\n });\n\n\n wrapper.open = function () {\n $('.js-filter-toggle-btn', $wrapper).removeClass('icon-plus2').addClass('icon-minus active');\n $('.js-filter-container',$wrapper).addClass('opened');\n };\n\n wrapper.close = function () {\n $('.js-filter-toggle-btn', $wrapper).removeClass('icon-minus active').addClass('icon-plus2');\n $('.js-filter-container',$wrapper).removeClass('opened');\n };\n\n $wrapper.on('click', '.js-filter-toggle-btn', function (e) {\n e.preventDefault();\n var $this = $(this);\n\n if ($this.hasClass('active')) {\n wrapper.close();\n } else {\n wrapper.open();\n }\n });\n }\n\n // if ($(window).width() < 960) {\n // closeExpandedFilters();\n // }\n\n // $(window).resize(_.debounce(function () {\n // initFilterExpander();\n // }, 50));\n\n function initFilterExpander() {\n if ($(window).width() < 960) {\n if (!$wrapper.hasClass('mobile')){\n closeExpandedFilters();\n $wrapper.addClass('mobile');\n }\n } else {\n if ($wrapper.hasClass('mobile')) {\n $('.filter', $wrapper).addClass('expanded').find('.title').removeClass('icon-arrow-down').addClass('icon-arrow-up');\n $wrapper.removeClass('mobile');\n }\n\n }\n }\n\n function closeExpandedFilters() {\n $('.filter.expanded', $wrapper).removeClass('expanded').find('.title').removeClass('icon-arrow-up').addClass('icon-arrow-down');\n $wrapper.addClass('mobile');\n }\n\n function seeMoreToggle(numOfVisible) {\n $('.filters .filter').each(function () {\n if ($(this).find('.twoColumns.wider').children('li').length > numOfVisible) {\n $(this).find(\".show-more\").addClass('visible');\n }\n });\n $(\".filter-toggle-btn\").click(function () {\n if ($(this).hasClass('show-more'))\n $(this).removeClass('show-more icon-arrow-down').addClass('show-less icon-arrow-up').closest('.filter').addClass('show-all');\n else {\n $(this).removeClass('show-less icon-arrow-up').addClass('show-more icon-arrow-down').closest('.filter').removeClass('show-all');\n }\n });\n }\n\n if (isAjaxLoad) {\n\n var model = null;\n wrapper.loading = function loading(loading) {\n if (loading) {\n $wrapper.addClass('x-loading');\n } else {\n $wrapper.removeClass('x-loading');\n };\n };\n\n wrapper.update = function update() {\n wrapper.loading(true);\n\n var html = Vendd.Handlebars.parse(\"filters\", JSON.parse(model));\n wrapper.bind(html, model);\n\n loopThrough();\n addClickHandlers();\n\n wrapper.loading(false);\n };\n\n\n wrapper.bind = function bind(html, bindModel) {\n $wrapper.html(html);\n };\n\n\n Vendd.MessageBus.subscribe(Vendd.FilterProduct.Messages.Changed, wrapper, function (envelope) {\n model = envelope.message.data;\n wrapper.update();\n });\n\n Vendd.MessageBus.subscribe(Vendd.FilterProduct.Messages.Failed, wrapper, function (envelope) {\n wrapper.loading(false);\n });\n\n //Vendd.MessageBus.subscribe(Vendd.FilterProduct.Messages.ShowMessages, wrapper, function (envelope) {\n\n // var messages = envelope.message.data.resultMessages;\n // if (messages.length > 0) {\n // var message = messages.join('\\n');\n // alert(message);\n // }\n //});\n\n Vendd.MessageBus.publishAsync(wrapper, new Vendd.FilterProduct.Messages.GetModel(configuration));\n\n } else {\n\n loopThrough();\n\n addClickHandlers();\n\n // seeMoreToggle(12);\n\n }\n\n});\n\n"]}