first commit

This commit is contained in:
2024-11-11 18:46:54 +01:00
commit a630d17338
25634 changed files with 4923715 additions and 0 deletions

View File

@@ -0,0 +1,33 @@
/**
* Copyright since 2007 PrestaShop SA and Contributors
* PrestaShop is an International Registered Trademark & Property of PrestaShop SA
*
* NOTICE OF LICENSE
*
* This source file is subject to the Academic Free License 3.0 (AFL-3.0)
* that is bundled with this package in the file LICENSE.md.
* It is also available through the world-wide-web at this URL:
* https://opensource.org/licenses/AFL-3.0
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@prestashop.com so we can send you a copy immediately.
*
* @author PrestaShop SA <contact@prestashop.com>
* @copyright Since 2007 PrestaShop SA and Contributors
* @license https://opensource.org/licenses/AFL-3.0 Academic Free License 3.0 (AFL-3.0)
*/
import refreshSliders from './slider';
import {showOverlay, hideOverlay} from './overlay';
$(document).ready(() => {
prestashop.on('updateProductList', () => {
hideOverlay();
refreshSliders();
});
refreshSliders();
prestashop.on('updateFacets', () => {
showOverlay();
});
});

View File

@@ -0,0 +1,48 @@
/**
* Copyright since 2007 PrestaShop SA and Contributors
* PrestaShop is an International Registered Trademark & Property of PrestaShop SA
*
* NOTICE OF LICENSE
*
* This source file is subject to the Academic Free License 3.0 (AFL-3.0)
* that is bundled with this package in the file LICENSE.md.
* It is also available through the world-wide-web at this URL:
* https://opensource.org/licenses/AFL-3.0
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@prestashop.com so we can send you a copy immediately.
*
* @author PrestaShop SA <contact@prestashop.com>
* @copyright Since 2007 PrestaShop SA and Contributors
* @license https://opensource.org/licenses/AFL-3.0 Academic Free License 3.0 (AFL-3.0)
*/
#search_filters .facet .title {
display: flex;
}
#search_filters .facet .title .collapse-icons {
margin-left: auto;
}
#search_filters .facet .facet-title {
width: calc(100% - 30px);
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
#search_filters .facet .facet-label {
width: 100%;
text-align: left;
}
#search_filters .facet .facet-label .custom-checkbox,
#search_filters .facet .facet-label .custom-radio {
top: -7px;
margin-right: 0;
}
#search_filters .facet .facet-label .color {
margin-left: 0;
}
#search_filters .facet .facet-label a {
width: calc(100% - 30px);
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}/*# sourceMappingURL=facet.css.map */

View File

@@ -0,0 +1 @@
{"version":3,"sources":["facet.scss","facet.css"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;EAAA;AA2BI;EACE,aAAA;ACRN;ADSM;EACE,iBAAA;ACPR;ADWI;EAfF,wBAAA;EACA,gBAAA;EACA,uBAAA;EACA,mBAAA;ACOF;ADSI;EACE,WAAA;EACA,gBAAA;ACPN;ADQM;;EAEE,SAAA;EACA,eAAA;ACNR;ADQM;EACE,cAAA;ACNR;ADSM;EA/BJ,wBAAA;EACA,gBAAA;EACA,uBAAA;EACA,mBAAA;ACyBF","file":"facet.css","sourcesContent":["/**\r\n * Copyright since 2007 PrestaShop SA and Contributors\r\n * PrestaShop is an International Registered Trademark & Property of PrestaShop SA\r\n *\r\n * NOTICE OF LICENSE\r\n *\r\n * This source file is subject to the Academic Free License 3.0 (AFL-3.0)\r\n * that is bundled with this package in the file LICENSE.md.\r\n * It is also available through the world-wide-web at this URL:\r\n * https://opensource.org/licenses/AFL-3.0\r\n * If you did not receive a copy of the license and are unable to\r\n * obtain it through the world-wide-web, please send an email\r\n * to license@prestashop.com so we can send you a copy immediately.\r\n *\r\n * @author PrestaShop SA <contact@prestashop.com>\r\n * @copyright Since 2007 PrestaShop SA and Contributors\r\n * @license https://opensource.org/licenses/AFL-3.0 Academic Free License 3.0 (AFL-3.0)\r\n */\r\n@mixin text-ellipsis() {\r\n width: calc(100% - 30px);\r\n overflow: hidden;\r\n text-overflow: ellipsis;\r\n white-space: nowrap;\r\n}\r\n\r\n#search_filters {\r\n .facet {\r\n .title {\r\n display: flex;\r\n .collapse-icons {\r\n margin-left: auto;\r\n }\r\n }\r\n\r\n .facet-title {\r\n @include text-ellipsis();\r\n }\r\n\r\n .facet-label {\r\n width: 100%;\r\n text-align: left;\r\n .custom-checkbox,\r\n .custom-radio {\r\n top: -7px;\r\n margin-right: 0;\r\n }\r\n .color {\r\n margin-left: 0;\r\n }\r\n\r\n a {\r\n @include text-ellipsis();\r\n }\r\n }\r\n }\r\n}\r\n","/**\n * Copyright since 2007 PrestaShop SA and Contributors\n * PrestaShop is an International Registered Trademark & Property of PrestaShop SA\n *\n * NOTICE OF LICENSE\n *\n * This source file is subject to the Academic Free License 3.0 (AFL-3.0)\n * that is bundled with this package in the file LICENSE.md.\n * It is also available through the world-wide-web at this URL:\n * https://opensource.org/licenses/AFL-3.0\n * If you did not receive a copy of the license and are unable to\n * obtain it through the world-wide-web, please send an email\n * to license@prestashop.com so we can send you a copy immediately.\n *\n * @author PrestaShop SA <contact@prestashop.com>\n * @copyright Since 2007 PrestaShop SA and Contributors\n * @license https://opensource.org/licenses/AFL-3.0 Academic Free License 3.0 (AFL-3.0)\n */\n#search_filters .facet .title {\n display: flex;\n}\n#search_filters .facet .title .collapse-icons {\n margin-left: auto;\n}\n#search_filters .facet .facet-title {\n width: calc(100% - 30px);\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n}\n#search_filters .facet .facet-label {\n width: 100%;\n text-align: left;\n}\n#search_filters .facet .facet-label .custom-checkbox,\n#search_filters .facet .facet-label .custom-radio {\n top: -7px;\n margin-right: 0;\n}\n#search_filters .facet .facet-label .color {\n margin-left: 0;\n}\n#search_filters .facet .facet-label a {\n width: calc(100% - 30px);\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n}"]}

View File

@@ -0,0 +1,56 @@
/**
* Copyright since 2007 PrestaShop SA and Contributors
* PrestaShop is an International Registered Trademark & Property of PrestaShop SA
*
* NOTICE OF LICENSE
*
* This source file is subject to the Academic Free License 3.0 (AFL-3.0)
* that is bundled with this package in the file LICENSE.md.
* It is also available through the world-wide-web at this URL:
* https://opensource.org/licenses/AFL-3.0
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@prestashop.com so we can send you a copy immediately.
*
* @author PrestaShop SA <contact@prestashop.com>
* @copyright Since 2007 PrestaShop SA and Contributors
* @license https://opensource.org/licenses/AFL-3.0 Academic Free License 3.0 (AFL-3.0)
*/
@mixin text-ellipsis() {
width: calc(100% - 30px);
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
#search_filters {
.facet {
.title {
display: flex;
.collapse-icons {
margin-left: auto;
}
}
.facet-title {
@include text-ellipsis();
}
.facet-label {
width: 100%;
text-align: left;
.custom-checkbox,
.custom-radio {
top: -7px;
margin-right: 0;
}
.color {
margin-left: 0;
}
a {
@include text-ellipsis();
}
}
}
}

View File

@@ -0,0 +1,22 @@
/**
* Copyright since 2007 PrestaShop SA and Contributors
* PrestaShop is an International Registered Trademark & Property of PrestaShop SA
*
* NOTICE OF LICENSE
*
* This source file is subject to the Academic Free License 3.0 (AFL-3.0)
* that is bundled with this package in the file LICENSE.md.
* It is also available through the world-wide-web at this URL:
* https://opensource.org/licenses/AFL-3.0
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@prestashop.com so we can send you a copy immediately.
*
* @author PrestaShop SA <contact@prestashop.com>
* @copyright Since 2007 PrestaShop SA and Contributors
* @license https://opensource.org/licenses/AFL-3.0 Academic Free License 3.0 (AFL-3.0)
*/
import 'jquery-ui-touch-punch';
import './events';
import './slider.scss';
import './facet.scss';

View File

@@ -0,0 +1,57 @@
/**
* Copyright since 2007 PrestaShop SA and Contributors
* PrestaShop is an International Registered Trademark & Property of PrestaShop SA
*
* NOTICE OF LICENSE
*
* This source file is subject to the Academic Free License 3.0 (AFL-3.0)
* that is bundled with this package in the file LICENSE.md.
* It is also available through the world-wide-web at this URL:
* https://opensource.org/licenses/AFL-3.0
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@prestashop.com so we can send you a copy immediately.
*
* @author PrestaShop SA <contact@prestashop.com>
* @copyright Since 2007 PrestaShop SA and Contributors
* @license https://opensource.org/licenses/AFL-3.0 Academic Free License 3.0 (AFL-3.0)
*/
.faceted-overlay {
left: 0;
top: 0;
width: 100%;
height: 100%;
position: fixed;
background-color: rgba(25, 25, 25, 0.5);
z-index: 100;
}
.faceted-overlay .overlay__inner {
left: 0;
top: 0;
width: 100%;
height: 100%;
position: absolute;
}
.faceted-overlay .overlay__content {
left: 50%;
position: absolute;
top: 50%;
transform: translate(-50%, -50%);
}
.faceted-overlay .spinner {
width: 75px;
height: 75px;
display: inline-block;
border-width: 2px;
border-color: rgba(255, 255, 255, 0.05);
border-top-color: #fff;
animation: spin 1s infinite linear;
border-radius: 100%;
border-style: solid;
}
@keyframes spin {
100% {
transform: rotate(360deg);
}
}/*# sourceMappingURL=overlay.css.map */

View File

@@ -0,0 +1 @@
{"version":3,"sources":["overlay.scss","overlay.css"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;EAAA;AAkBA;EACE,OAAA;EACA,MAAA;EACA,WAAA;EACA,YAAA;EACA,eAAA;EACA,uCAAA;EACA,YAAA;ACCF;ADCE;EACE,OAAA;EACA,MAAA;EACA,WAAA;EACA,YAAA;EACA,kBAAA;ACCJ;ADEE;EACE,SAAA;EACA,kBAAA;EACA,QAAA;EACA,gCAAA;ACAJ;ADGE;EACE,WAAA;EACA,YAAA;EACA,qBAAA;EACA,iBAAA;EACA,uCAAA;EACA,sBAAA;EACA,kCAAA;EACA,mBAAA;EACA,mBAAA;ACDJ;;ADKA;EACE;IACE,yBAAA;ECFF;AACF","file":"overlay.css","sourcesContent":["/**\r\n * Copyright since 2007 PrestaShop SA and Contributors\r\n * PrestaShop is an International Registered Trademark & Property of PrestaShop SA\r\n *\r\n * NOTICE OF LICENSE\r\n *\r\n * This source file is subject to the Academic Free License 3.0 (AFL-3.0)\r\n * that is bundled with this package in the file LICENSE.md.\r\n * It is also available through the world-wide-web at this URL:\r\n * https://opensource.org/licenses/AFL-3.0\r\n * If you did not receive a copy of the license and are unable to\r\n * obtain it through the world-wide-web, please send an email\r\n * to license@prestashop.com so we can send you a copy immediately.\r\n *\r\n * @author PrestaShop SA <contact@prestashop.com>\r\n * @copyright Since 2007 PrestaShop SA and Contributors\r\n * @license https://opensource.org/licenses/AFL-3.0 Academic Free License 3.0 (AFL-3.0)\r\n */\r\n.faceted-overlay {\r\n left: 0;\r\n top: 0;\r\n width: 100%;\r\n height: 100%;\r\n position: fixed;\r\n background-color: rgba(25, 25, 25, 0.5);\r\n z-index: 100;\r\n\r\n .overlay__inner {\r\n left: 0;\r\n top: 0;\r\n width: 100%;\r\n height: 100%;\r\n position: absolute;\r\n }\r\n\r\n .overlay__content {\r\n left: 50%;\r\n position: absolute;\r\n top: 50%;\r\n transform: translate(-50%, -50%);\r\n }\r\n\r\n .spinner {\r\n width: 75px;\r\n height: 75px;\r\n display: inline-block;\r\n border-width: 2px;\r\n border-color: rgba(255, 255, 255, 0.05);\r\n border-top-color: #fff;\r\n animation: spin 1s infinite linear;\r\n border-radius: 100%;\r\n border-style: solid;\r\n }\r\n}\r\n\r\n@keyframes spin {\r\n 100% {\r\n transform: rotate(360deg);\r\n }\r\n}\r\n","/**\n * Copyright since 2007 PrestaShop SA and Contributors\n * PrestaShop is an International Registered Trademark & Property of PrestaShop SA\n *\n * NOTICE OF LICENSE\n *\n * This source file is subject to the Academic Free License 3.0 (AFL-3.0)\n * that is bundled with this package in the file LICENSE.md.\n * It is also available through the world-wide-web at this URL:\n * https://opensource.org/licenses/AFL-3.0\n * If you did not receive a copy of the license and are unable to\n * obtain it through the world-wide-web, please send an email\n * to license@prestashop.com so we can send you a copy immediately.\n *\n * @author PrestaShop SA <contact@prestashop.com>\n * @copyright Since 2007 PrestaShop SA and Contributors\n * @license https://opensource.org/licenses/AFL-3.0 Academic Free License 3.0 (AFL-3.0)\n */\n.faceted-overlay {\n left: 0;\n top: 0;\n width: 100%;\n height: 100%;\n position: fixed;\n background-color: rgba(25, 25, 25, 0.5);\n z-index: 100;\n}\n.faceted-overlay .overlay__inner {\n left: 0;\n top: 0;\n width: 100%;\n height: 100%;\n position: absolute;\n}\n.faceted-overlay .overlay__content {\n left: 50%;\n position: absolute;\n top: 50%;\n transform: translate(-50%, -50%);\n}\n.faceted-overlay .spinner {\n width: 75px;\n height: 75px;\n display: inline-block;\n border-width: 2px;\n border-color: rgba(255, 255, 255, 0.05);\n border-top-color: #fff;\n animation: spin 1s infinite linear;\n border-radius: 100%;\n border-style: solid;\n}\n\n@keyframes spin {\n 100% {\n transform: rotate(360deg);\n }\n}"]}

View File

@@ -0,0 +1,43 @@
/**
* Copyright since 2007 PrestaShop SA and Contributors
* PrestaShop is an International Registered Trademark & Property of PrestaShop SA
*
* NOTICE OF LICENSE
*
* This source file is subject to the Academic Free License 3.0 (AFL-3.0)
* that is bundled with this package in the file LICENSE.md.
* It is also available through the world-wide-web at this URL:
* https://opensource.org/licenses/AFL-3.0
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@prestashop.com so we can send you a copy immediately.
*
* @author PrestaShop SA <contact@prestashop.com>
* @copyright Since 2007 PrestaShop SA and Contributors
* @license https://opensource.org/licenses/AFL-3.0 Academic Free License 3.0 (AFL-3.0)
*/
import './overlay.scss';
const template = `<div class="faceted-overlay">
<div class="overlay__inner">
<div class="overlay__content"><span class="spinner"></span></div>
</div>
</div>`;
function show() {
if ($('.faceted-overlay').length === 1) {
return;
}
$('body').append(template);
}
function hide() {
$('.faceted-overlay').remove();
}
export {
show as showOverlay,
hide as hideOverlay,
};

View File

@@ -0,0 +1,60 @@
/**
* Copyright since 2007 PrestaShop SA and Contributors
* PrestaShop is an International Registered Trademark & Property of PrestaShop SA
*
* NOTICE OF LICENSE
*
* This source file is subject to the Academic Free License 3.0 (AFL-3.0)
* that is bundled with this package in the file LICENSE.md.
* It is also available through the world-wide-web at this URL:
* https://opensource.org/licenses/AFL-3.0
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@prestashop.com so we can send you a copy immediately.
*
* @author PrestaShop SA <contact@prestashop.com>
* @copyright Since 2007 PrestaShop SA and Contributors
* @license https://opensource.org/licenses/AFL-3.0 Academic Free License 3.0 (AFL-3.0)
*/
.faceted-overlay {
left: 0;
top: 0;
width: 100%;
height: 100%;
position: fixed;
background-color: rgba(25, 25, 25, 0.5);
z-index: 100;
.overlay__inner {
left: 0;
top: 0;
width: 100%;
height: 100%;
position: absolute;
}
.overlay__content {
left: 50%;
position: absolute;
top: 50%;
transform: translate(-50%, -50%);
}
.spinner {
width: 75px;
height: 75px;
display: inline-block;
border-width: 2px;
border-color: rgba(255, 255, 255, 0.05);
border-top-color: #fff;
animation: spin 1s infinite linear;
border-radius: 100%;
border-style: solid;
}
}
@keyframes spin {
100% {
transform: rotate(360deg);
}
}

View File

@@ -0,0 +1,34 @@
/**
* Copyright since 2007 PrestaShop SA and Contributors
* PrestaShop is an International Registered Trademark & Property of PrestaShop SA
*
* NOTICE OF LICENSE
*
* This source file is subject to the Academic Free License 3.0 (AFL-3.0)
* that is bundled with this package in the file LICENSE.md.
* It is also available through the world-wide-web at this URL:
* https://opensource.org/licenses/AFL-3.0
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@prestashop.com so we can send you a copy immediately.
*
* @author PrestaShop SA <contact@prestashop.com>
* @copyright Since 2007 PrestaShop SA and Contributors
* @license https://opensource.org/licenses/AFL-3.0 Academic Free License 3.0 (AFL-3.0)
*/
#search_filters .ui-slider-horizontal .ui-slider-handle {
margin-left: -1px;
cursor: pointer;
}
#search_filters .ui-widget-header {
background: #555;
}
#search_filters .ui-slider .ui-slider-handle {
top: -0.45em;
width: 0.4em;
background: #fff;
border: 1px solid #555;
}
#search_filters .ui-slider-horizontal {
height: 0.4em;
}/*# sourceMappingURL=slider.css.map */

View File

@@ -0,0 +1 @@
{"version":3,"sources":["slider.scss","slider.css"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;EAAA;AAoBI;EACE,iBAAA;EACA,eAAA;ACDN;ADIE;EACE,gBAAA;ACFJ;ADKI;EACE,YAAA;EACA,YAAA;EACA,gBAAA;EACA,sBAAA;ACHN;ADME;EACE,aAAA;ACJJ","file":"slider.css","sourcesContent":["/**\r\n * Copyright since 2007 PrestaShop SA and Contributors\r\n * PrestaShop is an International Registered Trademark & Property of PrestaShop SA\r\n *\r\n * NOTICE OF LICENSE\r\n *\r\n * This source file is subject to the Academic Free License 3.0 (AFL-3.0)\r\n * that is bundled with this package in the file LICENSE.md.\r\n * It is also available through the world-wide-web at this URL:\r\n * https://opensource.org/licenses/AFL-3.0\r\n * If you did not receive a copy of the license and are unable to\r\n * obtain it through the world-wide-web, please send an email\r\n * to license@prestashop.com so we can send you a copy immediately.\r\n *\r\n * @author PrestaShop SA <contact@prestashop.com>\r\n * @copyright Since 2007 PrestaShop SA and Contributors\r\n * @license https://opensource.org/licenses/AFL-3.0 Academic Free License 3.0 (AFL-3.0)\r\n */\r\n#search_filters {\r\n .ui-slider-horizontal {\r\n .ui-slider-handle {\r\n margin-left: -1px;\r\n cursor: pointer;\r\n }\r\n }\r\n .ui-widget-header {\r\n background: #555;\r\n }\r\n .ui-slider {\r\n .ui-slider-handle {\r\n top: -.45em;\r\n width: 0.4em;\r\n background: #fff;\r\n border: 1px solid #555;\r\n }\r\n }\r\n .ui-slider-horizontal {\r\n height: .4em;\r\n }\r\n}\r\n","/**\n * Copyright since 2007 PrestaShop SA and Contributors\n * PrestaShop is an International Registered Trademark & Property of PrestaShop SA\n *\n * NOTICE OF LICENSE\n *\n * This source file is subject to the Academic Free License 3.0 (AFL-3.0)\n * that is bundled with this package in the file LICENSE.md.\n * It is also available through the world-wide-web at this URL:\n * https://opensource.org/licenses/AFL-3.0\n * If you did not receive a copy of the license and are unable to\n * obtain it through the world-wide-web, please send an email\n * to license@prestashop.com so we can send you a copy immediately.\n *\n * @author PrestaShop SA <contact@prestashop.com>\n * @copyright Since 2007 PrestaShop SA and Contributors\n * @license https://opensource.org/licenses/AFL-3.0 Academic Free License 3.0 (AFL-3.0)\n */\n#search_filters .ui-slider-horizontal .ui-slider-handle {\n margin-left: -1px;\n cursor: pointer;\n}\n#search_filters .ui-widget-header {\n background: #555;\n}\n#search_filters .ui-slider .ui-slider-handle {\n top: -0.45em;\n width: 0.4em;\n background: #fff;\n border: 1px solid #555;\n}\n#search_filters .ui-slider-horizontal {\n height: 0.4em;\n}"]}

View File

@@ -0,0 +1,128 @@
/**
* Copyright since 2007 PrestaShop SA and Contributors
* PrestaShop is an International Registered Trademark & Property of PrestaShop SA
*
* NOTICE OF LICENSE
*
* This source file is subject to the Academic Free License 3.0 (AFL-3.0)
* that is bundled with this package in the file LICENSE.md.
* It is also available through the world-wide-web at this URL:
* https://opensource.org/licenses/AFL-3.0
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@prestashop.com so we can send you a copy immediately.
*
* @author PrestaShop SA <contact@prestashop.com>
* @copyright Since 2007 PrestaShop SA and Contributors
* @license https://opensource.org/licenses/AFL-3.0 Academic Free License 3.0 (AFL-3.0)
*/
import getQueryParameters from './urlparser';
import NumberFormatter from '../cldr/number-formatter';
const formatters = {};
const displayLabelBlock = (formatterId, displayBlock, min, max) => {
if (formatters[formatterId] === undefined) {
displayBlock.text(
displayBlock.text().replace(
/([^\d]*)(?:[\d\s.,]+)([^\d]+)(?:[\d\s.,]+)(.*)/,
`$1${min}$2${max}$3`,
),
);
} else {
displayBlock.text(
`${formatters[formatterId].format(min)} - ${formatters[formatterId].format(max)}`,
);
}
};
/**
* Refresh facets sliders
*/
const refreshSliders = () => {
$('.faceted-slider').each(function initializeSliders() {
const $el = $(this);
const values = $el.data('slider-values');
const specifications = $el.data('slider-specifications');
if (specifications !== null && specifications !== undefined) {
formatters[$el.data('slider-id')] = NumberFormatter.build(specifications);
}
displayLabelBlock(
$el.data('slider-id'),
$(`#facet_label_${$el.data('slider-id')}`),
values === null ? $el.data('slider-min') : values[0],
values === null ? $el.data('slider-max') : values[1],
);
$(`#slider-range_${$el.data('slider-id')}`).slider({
range: true,
min: $el.data('slider-min'),
max: $el.data('slider-max'),
values: [
values === null ? $el.data('slider-min') : values[0],
values === null ? $el.data('slider-max') : values[1],
],
stop(event, ui) {
const nextEncodedFacetsURL = $el.data('slider-encoded-url');
const urlsSplitted = nextEncodedFacetsURL.split('?');
let queryParams = [];
// Retrieve parameters if exists
if (urlsSplitted.length > 1) {
queryParams = getQueryParameters(urlsSplitted[1]);
}
let found = false;
queryParams.forEach((query) => {
if (query.name === 'q') {
found = true;
}
});
if (!found) {
queryParams.push({name: 'q', value: ''});
}
// Update query parameter
queryParams.forEach((query) => {
if (query.name === 'q') {
// eslint-disable-next-line
query.value += [
query.value.length > 0 ? '/' : '',
$el.data('slider-label'),
'-',
$el.data('slider-unit'),
'-',
ui.values[0],
'-',
ui.values[1],
].join('');
}
});
const requestUrl = [
urlsSplitted[0],
'?',
$.param(queryParams),
].join('');
prestashop.emit(
'updateFacets',
requestUrl,
);
},
slide(event, ui) {
displayLabelBlock(
$el.data('slider-id'),
$(`#facet_label_${$el.data('slider-id')}`),
ui.values[0],
ui.values[1],
);
},
});
});
};
export default refreshSliders;

View File

@@ -0,0 +1,40 @@
/**
* Copyright since 2007 PrestaShop SA and Contributors
* PrestaShop is an International Registered Trademark & Property of PrestaShop SA
*
* NOTICE OF LICENSE
*
* This source file is subject to the Academic Free License 3.0 (AFL-3.0)
* that is bundled with this package in the file LICENSE.md.
* It is also available through the world-wide-web at this URL:
* https://opensource.org/licenses/AFL-3.0
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@prestashop.com so we can send you a copy immediately.
*
* @author PrestaShop SA <contact@prestashop.com>
* @copyright Since 2007 PrestaShop SA and Contributors
* @license https://opensource.org/licenses/AFL-3.0 Academic Free License 3.0 (AFL-3.0)
*/
#search_filters {
.ui-slider-horizontal {
.ui-slider-handle {
margin-left: -1px;
cursor: pointer;
}
}
.ui-widget-header {
background: #555;
}
.ui-slider {
.ui-slider-handle {
top: -.45em;
width: 0.4em;
background: #fff;
border: 1px solid #555;
}
}
.ui-slider-horizontal {
height: .4em;
}
}

View File

@@ -0,0 +1,28 @@
/**
* Copyright since 2007 PrestaShop SA and Contributors
* PrestaShop is an International Registered Trademark & Property of PrestaShop SA
*
* NOTICE OF LICENSE
*
* This source file is subject to the Academic Free License 3.0 (AFL-3.0)
* that is bundled with this package in the file LICENSE.md.
* It is also available through the world-wide-web at this URL:
* https://opensource.org/licenses/AFL-3.0
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@prestashop.com so we can send you a copy immediately.
*
* @author PrestaShop SA <contact@prestashop.com>
* @copyright Since 2007 PrestaShop SA and Contributors
* @license https://opensource.org/licenses/AFL-3.0 Academic Free License 3.0 (AFL-3.0)
*/
const getQueryParameters = (params) => params.split('&').map((str) => {
const [key, val] = str.split('=');
return {
name: key,
value: decodeURIComponent(val).replace(/\+/g, ' '),
};
});
export default getQueryParameters;