dev=true dla ramek rekomendacji
This commit is contained in:
@@ -95,6 +95,7 @@ new IdmHotspot({
|
|||||||
* @property {Function} query.graphFn - Funkcja do pobierania danych.
|
* @property {Function} query.graphFn - Funkcja do pobierania danych.
|
||||||
* @property {object} options - Ustawienia dla hotspotu (required).
|
* @property {object} options - Ustawienia dla hotspotu (required).
|
||||||
* @property {boolean} options.lazy - Czy wczytywać w trybie lazy.
|
* @property {boolean} options.lazy - Czy wczytywać w trybie lazy.
|
||||||
|
* @property {boolean} options.devMode - Czy wczytywać ramki tylko dla stron z dev=true.
|
||||||
* @property {boolean} options.addToFavorites - Czy włączać dodawanie do ulubionych(DZIAŁA TYLKO PO ZMIANACH SZABLONOWYCH)
|
* @property {boolean} options.addToFavorites - Czy włączać dodawanie do ulubionych(DZIAŁA TYLKO PO ZMIANACH SZABLONOWYCH)
|
||||||
* @property {boolean} options.addToCompare - Czy włączać dodawanie do porównywania
|
* @property {boolean} options.addToCompare - Czy włączać dodawanie do porównywania
|
||||||
* @property {boolean|string} options.addToBasket - Obsługa koszyka:
|
* @property {boolean|string} options.addToBasket - Obsługa koszyka:
|
||||||
|
|||||||
35
klasa.js
35
klasa.js
@@ -409,14 +409,21 @@ class IdmHotspot{
|
|||||||
// ============================
|
// ============================
|
||||||
static idmDefaultHotspotOptions = {
|
static idmDefaultHotspotOptions = {
|
||||||
options: {
|
options: {
|
||||||
lazy: true,
|
lazy: true,
|
||||||
addToBasket: true, // true, false, "range"
|
devMode: false,
|
||||||
addToFavorites: false,
|
callbackFn: ()=>{},
|
||||||
addToCompare: false,
|
omnibusTooltip: false,
|
||||||
swiper: true,
|
// opinions: false
|
||||||
callbackFn: ()=>{},
|
// DODAWANIE
|
||||||
swiperScrollbar: false,
|
addToBasket: true, // true, false, "range"
|
||||||
omnibusTooltip: false,
|
addToFavorites: false, // Wymaga zmian szablonowych
|
||||||
|
addToCompare: false,
|
||||||
|
// WYBÓR
|
||||||
|
// selectSize: false,
|
||||||
|
// selectVersion: false,
|
||||||
|
// SWIPER
|
||||||
|
swiper: true,
|
||||||
|
swiperScrollbar: false,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
@@ -836,7 +843,7 @@ class IdmHotspot{
|
|||||||
|
|
||||||
const compareContainerQuery = "#menu_compare_product";
|
const compareContainerQuery = "#menu_compare_product";
|
||||||
if (document.querySelector(compareContainerQuery)) {
|
if (document.querySelector(compareContainerQuery)) {
|
||||||
app_shop.fn.load(
|
app_shop.fn?.load(
|
||||||
window.location.pathname,
|
window.location.pathname,
|
||||||
[[compareContainerQuery, compareContainerQuery]],
|
[[compareContainerQuery, compareContainerQuery]],
|
||||||
function () {},
|
function () {},
|
||||||
@@ -1116,6 +1123,12 @@ class IdmHotspot{
|
|||||||
* Główna metoda inicjalizująca hotspot (lazy lub natychmiast).
|
* Główna metoda inicjalizująca hotspot (lazy lub natychmiast).
|
||||||
*/
|
*/
|
||||||
async init(){
|
async init(){
|
||||||
|
const queryString = window.location.search;
|
||||||
|
const urlParams = new URLSearchParams(queryString);
|
||||||
|
const dev = urlParams.get('dev')
|
||||||
|
|
||||||
|
if(this.options?.devMode && dev !== "true") return console.error(`Brak włączonego devMode. Ramka ${this.id} nie mogła zostać utworzona!`);
|
||||||
|
|
||||||
if(!this.hotspotEl || !document.contains(this.hotspotEl)) this.initHotspotContainer();
|
if(!this.hotspotEl || !document.contains(this.hotspotEl)) this.initHotspotContainer();
|
||||||
|
|
||||||
if(this.options?.lazy) this.handleObserveHotspotOnce();
|
if(this.options?.lazy) this.handleObserveHotspotOnce();
|
||||||
@@ -1286,7 +1299,7 @@ function idmHideTooltip(tooltipEl){
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
document.addEventListener("DOMContentLoaded", ()=>{
|
// document.addEventListener("DOMContentLoaded", ()=>{
|
||||||
document.body.addEventListener("click", e=>{
|
document.body.addEventListener("click", e=>{
|
||||||
const tooltipEl = e.target.closest(".idm_tooltip");
|
const tooltipEl = e.target.closest(".idm_tooltip");
|
||||||
if(!e.target.closest(".idm_tooltip__info_icon") || !tooltipEl) return;
|
if(!e.target.closest(".idm_tooltip__info_icon") || !tooltipEl) return;
|
||||||
@@ -1294,7 +1307,7 @@ document.addEventListener("DOMContentLoaded", ()=>{
|
|||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
idmShowTooltip(tooltipEl);
|
idmShowTooltip(tooltipEl);
|
||||||
});
|
});
|
||||||
});
|
// });
|
||||||
// new IdmHotspot({
|
// new IdmHotspot({
|
||||||
// id: "idmTestHotspot1",
|
// id: "idmTestHotspot1",
|
||||||
// title: "tescik",
|
// title: "tescik",
|
||||||
|
|||||||
Reference in New Issue
Block a user