Spade
Mini Shell
var
phFilterNewUrlSet="",phFilterNewUrlRemove="",phFilterNewUrlSetPreviousParamWaiting=0,phFilterNewUrlRemovePreviousParamWaiting=0;function
phReplaceAll(e,r,t){return t.replace(new
RegExp(e,"gi"),r)}function phEscapeRegExp(e){return
e.replace(/([.*+?^=!:${}()|\[\]\/\\])/g,"\\$1")}function
phReplaceAll(e,r,t){return t.replace(new
RegExp(phEscapeRegExp(e),"g"),r)}function
phEncode(e){e=encodeURIComponent(e);return
e=phReplaceAll("%5B","[",e),e=phReplaceAll("%5D","]",e),e=phReplaceAll("%2C",",",e),e=phReplaceAll("%3A",":",e)}function
phArrayToString(e){e=phReplaceAll("[","(",e);return
e=phReplaceAll("]",")",e)}function
phStringToArray(e){e=phReplaceAll("(","[",e);return
e=phReplaceAll(")","]",e)}function
phCleanArray(e){for(var
r=[],t=0;t<e.length;t++)e[t]&&r.push(e[t]);return r}function
phCleanEmptyParams(e){return
e.replace(/&?[^&?]+=(?=(?:&|$))/g,"")}function
phCleanAloneQuestionMark(e){return"?&"==e&&(e="?"),"?"==e&&(e=""),e}function
phFilterValue(e){e=phReplaceAll("<","",e);return
e=phReplaceAll(">","",e)}function
phRemoveFilter(e,r,t,i,l,a,p,o){var
n=Joomla.getOptions("phParamsPC");e=phArrayToString(e);var
h,c=phArrayToString(c=jQuery.param.querystring()),m=""!==phFilterNewUrlRemove||1==phFilterNewUrlRemovePreviousParamWaiting?jQuery.deparam.querystring(phFilterNewUrlRemove):jQuery.deparam.querystring(c),u={},s=0;if(void
0!==m.start&&(u.start=0),void
0!==m.limitstart&&(u.limitstart=0),1!=a&&void
0!==m[e]?-1===(a=phCleanArray(a=(c=m[e]).split(","))).indexOf(r)||(-1<(r=a.indexOf(r))&&a.splice(r,1),(c=a.join())?u[e]=c:(delete
m[e],u=m,s=2)):(delete m[e],u=m,s=2),1==t&&1!=l||1!=t)return
h=i,document.location=h,1;if(h=location.search,""===phFilterNewUrlRemove&&1!=phFilterNewUrlRemovePreviousParamWaiting||(h=phFilterNewUrlRemove),h=phArrayToString(h),phFilterNewUrlRemove=jQuery.param.querystring(h,u,s),phFilterNewUrlRemove=phReplaceAll("%2C",",",phFilterNewUrlRemove),phFilterNewUrlRemove=phReplaceAll("%5B","[",phFilterNewUrlRemove),phFilterNewUrlRemove=phReplaceAll("%5D","]",phFilterNewUrlRemove),phFilterNewUrlRemove=phCleanAloneQuestionMark(phFilterNewUrlRemove=phStringToArray(phFilterNewUrlRemove=phReplaceAll("%3A",":",phFilterNewUrlRemove))),1==p){if((phFilterNewUrlRemovePreviousParamWaiting=1)==t&&1==n.ajaxSearchingFilteringItems)return
2}else{if(1==t&&1==n.ajaxSearchingFilteringItems)return
phUpdatePageAndParts(phFilterNewUrlRemove,o),phFilterNewUrlRemove="",phFilterNewUrlRemovePreviousParamWaiting=0,2;document.location=phFilterNewUrlRemove,phFilterNewUrlRemove=""}return
1}function phSetFilter(e,r,t,i,l,a,p,o){var
n=Joomla.getOptions("phParamsPC");r=phFilterValue(r),e=phArrayToString(e);var
h=phArrayToString(h=jQuery.param.querystring()),c=""!==phFilterNewUrlSet||1==phFilterNewUrlSetPreviousParamWaiting?(phFilterNewUrlSet=phArrayToString(phFilterNewUrlSet),jQuery.deparam.querystring(phFilterNewUrlSet)):jQuery.deparam.querystring(h),h={};if(void
0!==c.start&&(h.start=0),void
0!==c.limitstart&&(h.limitstart=0),1==a?h[e]=r:""===r||(void
0!==c[e]?(-1===(c=phCleanArray(c=(a=c[e]).split(","))).indexOf(r)&&(c.push(r),a=c.join()),h[e]=a):h[e]=r),i=1==t&&1!=l||1!=t?i:location.search,""===phFilterNewUrlSet&&1!=phFilterNewUrlSetPreviousParamWaiting||(i=phFilterNewUrlSet),i=phArrayToString(i),phFilterNewUrlSet=jQuery.param.querystring(i,h,0),phFilterNewUrlSet=phReplaceAll("%2C",",",phFilterNewUrlSet),phFilterNewUrlSet=phReplaceAll("%2C",",",phFilterNewUrlSet),phFilterNewUrlSet=phReplaceAll("%5B","[",phFilterNewUrlSet),phFilterNewUrlSet=phReplaceAll("%5D","]",phFilterNewUrlSet),phFilterNewUrlSet=phCleanAloneQuestionMark(phFilterNewUrlSet=phCleanEmptyParams(phFilterNewUrlSet=phStringToArray(phFilterNewUrlSet=phReplaceAll("%3A",":",phFilterNewUrlSet)))),1==p){if((phFilterNewUrlSetPreviousParamWaiting=1)==t&&1==n.ajaxSearchingFilteringItems)return
2}else{if(1==t&&1==n.ajaxSearchingFilteringItems)return
phUpdatePageAndParts(phFilterNewUrlSet,o),phFilterNewUrlSet="",phFilterNewUrlSetPreviousParamWaiting=0,2;document.location=phFilterNewUrlSet,phFilterNewUrlSet=""}return
1}function phChangeFilter(e,r,t,i,l,a,p){var
o=Joomla.getOptions("phVarsModPhocacartFilter"),n=Joomla.getOptions("phParamsModPhocacartFilter"),h=o.isItemsView,c=o.isSef,m=o.urlItemsView,u=o.urlItemsViewWithoutParams,o=1;"itemview"==i?(void
0===r&&(r=""),o=phSetFilter(e,r,1,0,1,l,a,p)):"text"==i?o=(1==t?phSetFilter:phRemoveFilter)(e,r,h,m,1,l,a,p):"category"==i?(m=u,1==n.removeParametersCat?document.location=m:(n=jQuery.param.querystring(),1==h?1==c?document.location=jQuery.param.querystring(m,n,2):phRemoveFilter(e,r,h,m,1,l,a,p):document.location=m)):o=(t.checked?phSetFilter:phRemoveFilter)(e,r,h,m,1,l,a,p),startFullOverlay(o)}function
phChangeSearch(e,r,t){var
i=Joomla.getOptions("phVarsModPhocacartSearch"),l=Joomla.getOptions("phParamsModPhocacartSearch"),a=(Joomla.getOptions("phParamsPC"),i.isItemsView),p=i.urlItemsView,o=i.urlItemsViewWithoutParams,n=1,i=a,n=1==t?(1==l.searchOptions?0<jQuery("#phSearchBoxSearchAllProducts:checked").length&&(p=o,i=0):i=0,phSetFilter(e,r,a,p,i,1,0,2)):phRemoveFilter(e,r,a,p,i,1,0,2);startFullOverlay(n)}function
phPriceFilterRange(){var
i=Joomla.getOptions("phParamsPC"),l=Joomla.getOptions("phLangPC");"function"==typeof
jQuery("#phPriceFilterRange").slider&&jQuery("#phPriceFilterRange").slider({range:!0,min:i.filterPriceMin,max:i.filterPriceMax,values:[i.filterPriceFrom,i.filterPriceTo],slide:function(e,r){jQuery("#phPriceFromTopricefrom").val(r.values[0]),jQuery("#phPriceFromTopriceto").val(r.values[1]),jQuery("#phPriceFilterPrice").html(l.COM_PHOCACART_PRICE+":
"+phGetPriceFormat(r.values[0])+" -
"+phGetPriceFormat(r.values[1]))}}),jQuery("#phPriceFilterPrice").html(l.COM_PHOCACART_PRICE+":
"+phGetPriceFormat(i.filterPriceFrom)+" -
"+phGetPriceFormat(i.filterPriceTo)),jQuery("#phPriceFromTopricefrom").on("change",function(e){var
r=jQuery("#phPriceFromTopricefrom").val(),t=jQuery("#phPriceFromTopriceto").val();""==t&&(t=i.filterPriceMax),""==r&&(r=i.filterPriceMin),Number(t)<Number(r)&&(t=r,jQuery("#phPriceFromTopriceto").val(t)),"function"==typeof
jQuery("#phPriceFilterRange").slider&&jQuery("#phPriceFilterRange").slider({values:[r,t]}),jQuery("#phPriceFilterPrice").html(l.COM_PHOCACART_PRICE+":
"+phGetPriceFormat(r)+" -
"+phGetPriceFormat(t))}),jQuery("#phPriceFromTopriceto").on("change",function(e){var
r=jQuery("#phPriceFromTopricefrom").val(),t=jQuery("#phPriceFromTopriceto").val();""==t&&(t=i.filterPriceMax),""==r&&(r=i.filterPriceMin),Number(t)<Number(r)&&(t=r,jQuery("#phPriceFromTopriceto").val(t)),"function"==typeof
jQuery("#phPriceFilterRange").slider&&jQuery("#phPriceFilterRange").slider({values:[r,t]}),jQuery("#phPriceFilterPrice").html(l.COM_PHOCACART_PRICE+":
"+phGetPriceFormat(r)+" - "+phGetPriceFormat(t))})}function
phClearField(e){jQuery(e).val("")}jQuery(document).ready(function(){jQuery(".collapse").on("shown.bs.collapse",function(){jQuery(this).parent().find(".glyphicon-triangle-right").removeClass("glyphicon-triangle-right").addClass("glyphicon-triangle-bottom"),jQuery(this).parent().find(".fa-caret-right").removeClass("fa-caret-right").addClass("fa-caret-down")}).on("hidden.bs.collapse",function(){jQuery(this).parent().find(".glyphicon-triangle-bottom").removeClass("glyphicon-triangle-bottom").addClass("glyphicon-triangle-right"),jQuery(this).parent().find(".fa-caret-down").removeClass("fa-caret-down").addClass("fa-caret-right")}),phPriceFilterRange()});