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 {object} options - Ustawienia dla hotspotu (required).
|
||||
* @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.addToCompare - Czy włączać dodawanie do porównywania
|
||||
* @property {boolean|string} options.addToBasket - Obsługa koszyka:
|
||||
|
||||
35
klasa.js
35
klasa.js
@@ -409,14 +409,21 @@ class IdmHotspot{
|
||||
// ============================
|
||||
static idmDefaultHotspotOptions = {
|
||||
options: {
|
||||
lazy: true,
|
||||
addToBasket: true, // true, false, "range"
|
||||
addToFavorites: false,
|
||||
addToCompare: false,
|
||||
swiper: true,
|
||||
callbackFn: ()=>{},
|
||||
swiperScrollbar: false,
|
||||
omnibusTooltip: false,
|
||||
lazy: true,
|
||||
devMode: false,
|
||||
callbackFn: ()=>{},
|
||||
omnibusTooltip: false,
|
||||
// opinions: false
|
||||
// DODAWANIE
|
||||
addToBasket: true, // true, false, "range"
|
||||
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";
|
||||
if (document.querySelector(compareContainerQuery)) {
|
||||
app_shop.fn.load(
|
||||
app_shop.fn?.load(
|
||||
window.location.pathname,
|
||||
[[compareContainerQuery, compareContainerQuery]],
|
||||
function () {},
|
||||
@@ -1116,6 +1123,12 @@ class IdmHotspot{
|
||||
* Główna metoda inicjalizująca hotspot (lazy lub natychmiast).
|
||||
*/
|
||||
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.options?.lazy) this.handleObserveHotspotOnce();
|
||||
@@ -1286,7 +1299,7 @@ function idmHideTooltip(tooltipEl){
|
||||
}
|
||||
|
||||
|
||||
document.addEventListener("DOMContentLoaded", ()=>{
|
||||
// document.addEventListener("DOMContentLoaded", ()=>{
|
||||
document.body.addEventListener("click", e=>{
|
||||
const tooltipEl = e.target.closest(".idm_tooltip");
|
||||
if(!e.target.closest(".idm_tooltip__info_icon") || !tooltipEl) return;
|
||||
@@ -1294,7 +1307,7 @@ document.addEventListener("DOMContentLoaded", ()=>{
|
||||
e.preventDefault();
|
||||
idmShowTooltip(tooltipEl);
|
||||
});
|
||||
});
|
||||
// });
|
||||
// new IdmHotspot({
|
||||
// id: "idmTestHotspot1",
|
||||
// title: "tescik",
|
||||
|
||||
Reference in New Issue
Block a user