@dreher-media/dm-js-lib 0.3.1 → 0.3.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/dm-js-lib.min.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
/*! dm-js-lib v0.3.
|
|
2
|
-
!function(){"use strict";function e(e){const t=e.dataset.langLink;if(t)return t;const o=e.textContent?.trim().toLowerCase();return o||null}function t(t){sessionStorage.setItem("selected_lang",t),document.querySelectorAll("[data-lang-content]").forEach(e=>{const o=e;o.dataset.langContent===t?(o.style.display="",o.classList.add("lang-active")):(o.style.display="none",o.classList.remove("lang-active"))}),document.querySelectorAll(`.biography-text:not(.${t})`).forEach(e=>{e.style.display="none"}),document.querySelectorAll(`.biography-text.${t}`).forEach(e=>{e.style.display="block"}),document.querySelectorAll("[data-lang-link]").forEach(o=>{const n=o;e(n)===t?n.classList.add("active"):n.classList.remove("active")}),document.querySelectorAll(`.biography-lang-links .tab-link:not([data-lang="${t}"])`).forEach(e=>{e.classList.remove("active")}),document.querySelectorAll(`.biography-lang-links .tab-link[data-lang="${t}"]`).forEach(e=>{e.classList.add("active")})}function o(e){const t=e.match(/^([a-z]{2})(?:-|$)/i);return t?t[1].toLowerCase():null}function n(e){if(document.querySelector(`[data-lang-link="${e}"]`))return!0;if(document.querySelector(`[data-lang-content="${e}"]`))return!0;if(document.querySelector(`.biography-lang-links .tab-link[data-lang="${e}"]`))return!0;return!!document.querySelector(`.biography-text.${e}`)}function a(){let e=sessionStorage.getItem("selected_lang");if(!e){const t=function(){if(navigator.languages&&navigator.languages.length>0)for(const e of navigator.languages){const t=o(e);if(t)return t}return navigator.language?o(navigator.language):null}();if(t&&n(t))e=t;else{if(!n("en"))return;e="en"}}if(e){const o=document.querySelector(`[data-lang-link="${e}"]`);if(o)return void o.click();const n=document.querySelector(`.biography-lang-links .tab-link[data-lang="${e}"]`);if(n)return void n.click();t(e)}}function r(e,t="script"){return new Promise((o,n)=>{const a="script"===t?`script[src="${e}"]`:`link[rel="stylesheet"][href="${e}"]`;if(document.querySelector(a))o();else if("script"===t){const t=document.createElement("script");t.src=e,t.async=!0,t.onload=()=>o(),t.onerror=()=>n(new Error(`Failed to load script: ${e}`)),document.head.appendChild(t)}else if("stylesheet"===t){const t=document.createElement("link");t.rel="stylesheet",t.href=e,t.onload=()=>o(),t.onerror=()=>n(new Error(`Failed to load stylesheet: ${e}`)),document.head.appendChild(t)}else n(new Error(`Unsupported resource type: ${t}`))})}function l(e){return r(e,"script")}function i(e){const t=document.querySelectorAll(".youtube");return Array.from(t).some(t=>t.dataset.type===e)}!function(){let e=!1;const t=()=>{window.FsCC?(e||(window.FsCC.consentController.on("updateconsents",()=>{t()}),e=!0),document.querySelectorAll("[fs-cc-reject]").forEach(e=>{const t=e.getAttribute("fs-cc-reject");if(!t)return;const o=window.FsCC?.store.consents[t]??!1,n=document.querySelector(`[fs-cc="${t}"]`);o?(e.style.display="none",n&&(n.style.display="block")):(e.style.display="block",n&&(n.style.display="none"))})):setTimeout(t,200)};document.addEventListener("DOMContentLoaded",t)}(),void 0!==window.Webflow&&window.Webflow.push(()=>{document.querySelectorAll(".copyright-year").forEach(e=>{e.textContent=(new Date).getFullYear().toString()})}),function(){const e=e=>{const t=(e||"").replace(/\/+$/,"").replace(/\.html?$/i,"");return""===t?"/":t};window.addEventListener("load",()=>{const t=e(window.location.pathname);document.querySelectorAll("a[href]").forEach(o=>{const n=o.getAttribute("href");if(!n)return;if(n.startsWith("#")||n.toLowerCase().startsWith("javascript:"))return;let a;try{a=new URL(n,window.location.href)}catch{return}if(a.origin!==window.location.origin)return;e(a.pathname)===t&&o.classList.add("w--current")})})}(),document.addEventListener("DOMContentLoaded",()=>{document.querySelectorAll("[data-separator]").forEach(e=>{const t=e.getAttribute("data-separator");if(!t)return;const o=Array.from(e.children);o.forEach((e,n)=>{if(n<o.length-1){const o=document.createElement("span");o.innerHTML=` ${t} `,e.insertAdjacentElement("afterend",o)}})})}),document.addEventListener("DOMContentLoaded",()=>{const e=e=>{const t=e.dataset.tabTarget;if(t)return t;const o=e.getAttribute("href");return o?.startsWith("#")?o.slice(1):null},t=e=>document.querySelector(`[data-tab-content="${e}"]`);document.querySelectorAll(".tab-link, [data-tab-link]").forEach(o=>{o.addEventListener("click",o=>{o.preventDefault();const n=o.currentTarget,a=n.dataset.tabGroup,r=e(n),l=r?t(r):null;if(a)document.querySelectorAll(`.tab-link[data-tab-group="${a}"], [data-tab-link][data-tab-group="${a}"]`).forEach(e=>{e.classList.remove("active")}),(t=>{const o=[];return document.querySelectorAll(`.tab-link[data-tab-group="${t}"], [data-tab-link][data-tab-group="${t}"]`).forEach(t=>{const n=e(t);n&&o.push(n)}),o})(a).forEach(e=>{const o=t(e);o&&(o.style.display="none",o.classList.remove("active"))});else{const o=n.parentNode;if(o){o.querySelectorAll(".tab-link, [data-tab-link]").forEach(e=>{e.classList.remove("active")});const n=(t=>{const o=[];return t.querySelectorAll(".tab-link, [data-tab-link]").forEach(t=>{const n=e(t);n&&o.push(n)}),o})(o);n.forEach(e=>{const o=t(e);o&&(o.style.display="none",o.classList.remove("active"))})}}n.classList.add("active"),l&&(l.style.display="block",l.classList.add("active"))})})}),document.addEventListener("DOMContentLoaded",()=>{document.querySelectorAll("[data-lang-link]").forEach(o=>{o.addEventListener("click",o=>{o.preventDefault();const n=e(o.currentTarget);n&&t(n)})}),document.querySelectorAll(".biography-lang-links .tab-link[data-lang]").forEach(e=>{e.addEventListener("click",e=>{e.preventDefault();const o=e.currentTarget,n=o.dataset?.lang;n&&t(n)})}),a()}),"interactive"!==document.readyState&&"complete"!==document.readyState||a(),document.addEventListener("DOMContentLoaded",()=>{let e=[];const t=document.querySelectorAll(".youtube"),o={};let n=!1;const a=document.querySelectorAll("._init-plyr").length>0,c=i("youtube"),s=i("vimeo"),d=i("dailymotion"),u=()=>{void 0!==window.Plyr&&(e=window.Plyr.setup("._init-plyr"),e.forEach(e=>{e.on("play",()=>{y(),"undefined"!=typeof videoSwipers&&videoSwipers&&videoSwipers.forEach(e=>{e.autoplay.stop()})}),e.on("pause",()=>{"undefined"!=typeof videoSwipers&&videoSwipers&&videoSwipers.forEach(e=>{e.autoplay.start()})})}))},y=(t=null)=>{e.forEach(e=>{e.pause()});for(const[e,n]of Object.entries(o))t!==e&&("youtube"===n.type?n.player.pauseVideo():("vimeo"===n.type||"dailymotion"===n.type)&&n.player.pause())},p=e=>{y(e),"undefined"!=typeof videoSwipers&&videoSwipers&&videoSwipers.forEach(e=>{e.autoplay.stop()})},f=e=>{"undefined"!=typeof videoSwipers&&videoSwipers&&videoSwipers.forEach(e=>{e.autoplay.start()})},m=()=>{n||(n=!0,t.forEach(e=>{e.addEventListener("click",()=>{const t=e.querySelector("[data-custom-embed]");t&&(e.innerHTML=t.innerHTML);const n=e,a=`player_${n.dataset.id}`,r=n.dataset.type,l=n.dataset.videoId,i=parseInt(n.dataset.time||"0",10);if(l&&r)if(p(a),"youtube"===r&&window.YT){const e=new window.YT.Player(a,{videoId:l,playerVars:{start:i},events:{onReady:e=>{e.target.playVideo()},onStateChange:e=>{e.data===window.YT.PlayerState.PLAYING?p(a):e.data!==window.YT.PlayerState.PAUSED&&e.data!==window.YT.PlayerState.ENDED||f()}}});o[a]={type:r,player:e}}else if("vimeo"===r&&window.Vimeo){const e=document.getElementById(a);e&&(e.innerHTML="");const t=new window.Vimeo.Player(a,{id:l,autoplay:!0,start:i});t.on("play",()=>p(a)),t.on("pause",()=>f()),o[a]={type:r,player:t}}else"dailymotion"===r&&window.dailymotion&&window.dailymotion.createPlayer(a,{video:l,params:{autoplay:1,start:i,mute:!1}}).then(e=>{e.on("play",()=>p(a)),e.on("pause",()=>f()),e.on("ended",()=>f()),o[a]={type:"dailymotion",player:e}}).catch(e=>{console.error("Error initializing Dailymotion player:",e)})})}))};c&&(window.onYouTubeIframeAPIReady=()=>{m()});const w=[];var h;a&&w.push(window.Plyr&&"function"==typeof window.Plyr.setup?Promise.resolve():Promise.all([(h="https://cdn.plyr.io/3.7.8/plyr.css",r(h,"stylesheet")),l("https://cdn.plyr.io/3.7.8/plyr.polyfilled.js")]).then(()=>{}).catch(e=>{throw console.error("Failed to load Plyr resources:",e),e})),c&&w.push(window.YT&&"function"==typeof window.YT.Player?Promise.resolve():l("https://www.youtube.com/iframe_api").catch(e=>{console.error("Failed to load YouTube API:",e)})),s&&w.push(window.Vimeo&&"function"==typeof window.Vimeo.Player?Promise.resolve():l("https://player.vimeo.com/api/player.js").catch(e=>{console.error("Failed to load Vimeo API:",e)})),d&&w.push(window.dailymotion&&"function"==typeof window.dailymotion.createPlayer?Promise.resolve():l("https://api.dmcdn.net/all.js").catch(e=>{console.error("Failed to load Dailymotion API:",e)})),w.length>0?Promise.all(w).then(()=>{a&&u(),c?setTimeout(()=>{n||m()},1e3):setTimeout(()=>{m()},100)}).catch(e=>{console.error("Error loading video player APIs:",e),a&&void 0!==window.Plyr&&u(),setTimeout(()=>{m()},500)}):(a&&void 0!==window.Plyr&&u(),m()),"undefined"!=typeof videoSwipers&&videoSwipers&&videoSwipers.forEach(e=>{e.on("slideChange",()=>{y()})})}),document.addEventListener("DOMContentLoaded",()=>{const e=["maxresdefault","sddefault","hqdefault","mqdefault","default"],t=(o,n=0)=>{if(o.naturalWidth>120)return;if(n>=e.length)return;const a=e[n],r=o.src,l=new Image;l.onload=()=>{l.naturalWidth>120?o.src=l.src:t(o,n+1)},l.onerror=()=>{t(o,n+1)},l.src=r.replace(/maxresdefault/,a)};document.querySelectorAll(".youtube img").forEach(e=>{t(e)})}),document.addEventListener("DOMContentLoaded",()=>{document.querySelectorAll("[data-download-href]").forEach(e=>{e.addEventListener("click",t=>{t.preventDefault(),t.stopPropagation();const o=e.getAttribute("data-download-href"),n=e.getAttribute("data-download-filename");o&&((e,t)=>{const o=document.createElement("a");o.href=e,o.download=t||e.split("/").pop()||"download",document.body.appendChild(o),o.click(),document.body.removeChild(o)})(o,n)})})})}();
|
|
1
|
+
/*! dm-js-lib v0.3.3 */
|
|
2
|
+
!function(){"use strict";function e(e){const t=e.dataset.langLink;if(t)return t;const o=e.textContent?.trim().toLowerCase();return o||null}function t(t){sessionStorage.setItem("selected_lang",t),document.querySelectorAll("[data-lang-content]").forEach(e=>{const o=e;o.dataset.langContent===t?(o.style.display="",o.classList.add("lang-active")):(o.style.display="none",o.classList.remove("lang-active"))}),document.querySelectorAll(`.biography-text:not([data-lang-content]):not(.${t})`).forEach(e=>{e.style.display="none"}),document.querySelectorAll(`.biography-text:not([data-lang-content]).${t}`).forEach(e=>{e.style.display="block"}),document.querySelectorAll("[data-lang-link]").forEach(o=>{const n=o;e(n)===t?n.classList.add("active"):n.classList.remove("active")}),document.querySelectorAll(`.biography-lang-links .tab-link[data-lang]:not([data-lang-link]):not([data-lang="${t}"])`).forEach(e=>{e.classList.remove("active")}),document.querySelectorAll(`.biography-lang-links .tab-link[data-lang]:not([data-lang-link])[data-lang="${t}"]`).forEach(e=>{e.classList.add("active")})}function o(e){const t=e.match(/^([a-z]{2})(?:-|$)/i);return t?t[1].toLowerCase():null}function n(e){if(document.querySelector(`[data-lang-link="${e}"]`))return!0;if(document.querySelector(`[data-lang-content="${e}"]`))return!0;if(document.querySelector(`.biography-lang-links .tab-link[data-lang]:not([data-lang-link])[data-lang="${e}"]`))return!0;return!!document.querySelector(`.biography-text.${e}`)}function a(){let e=sessionStorage.getItem("selected_lang");if(!e){const t=function(){if(navigator.languages&&navigator.languages.length>0)for(const e of navigator.languages){const t=o(e);if(t)return t}return navigator.language?o(navigator.language):null}();if(t&&n(t))e=t;else{if(!n("en"))return;e="en"}}if(e){const o=document.querySelector(`[data-lang-link="${e}"]`);if(o)return void o.click();const n=document.querySelector(`.biography-lang-links .tab-link[data-lang]:not([data-lang-link])[data-lang="${e}"]`);if(n)return void n.click();t(e)}}function r(e,t="script"){return new Promise((o,n)=>{const a="script"===t?`script[src="${e}"]`:`link[rel="stylesheet"][href="${e}"]`;if(document.querySelector(a))o();else if("script"===t){const t=document.createElement("script");t.src=e,t.async=!0,t.onload=()=>o(),t.onerror=()=>n(new Error(`Failed to load script: ${e}`)),document.head.appendChild(t)}else if("stylesheet"===t){const t=document.createElement("link");t.rel="stylesheet",t.href=e,t.onload=()=>o(),t.onerror=()=>n(new Error(`Failed to load stylesheet: ${e}`)),document.head.appendChild(t)}else n(new Error(`Unsupported resource type: ${t}`))})}function l(e){return r(e,"script")}function i(e){const t=document.querySelectorAll(".youtube");return Array.from(t).some(t=>t.dataset.type===e)}!function(){let e=!1;const t=()=>{window.FsCC?(e||(window.FsCC.consentController.on("updateconsents",()=>{t()}),e=!0),document.querySelectorAll("[fs-cc-reject]").forEach(e=>{const t=e.getAttribute("fs-cc-reject");if(!t)return;const o=window.FsCC?.store.consents[t]??!1,n=document.querySelector(`[fs-cc="${t}"]`);o?(e.style.display="none",n&&(n.style.display="block")):(e.style.display="block",n&&(n.style.display="none"))})):setTimeout(t,200)};document.addEventListener("DOMContentLoaded",t)}(),void 0!==window.Webflow&&window.Webflow.push(()=>{document.querySelectorAll(".copyright-year").forEach(e=>{e.textContent=(new Date).getFullYear().toString()})}),function(){const e=e=>{const t=(e||"").replace(/\/+$/,"").replace(/\.html?$/i,"");return""===t?"/":t};window.addEventListener("load",()=>{const t=e(window.location.pathname);document.querySelectorAll("a[href]").forEach(o=>{const n=o.getAttribute("href");if(!n)return;if(n.startsWith("#")||n.toLowerCase().startsWith("javascript:"))return;let a;try{a=new URL(n,window.location.href)}catch{return}if(a.origin!==window.location.origin)return;e(a.pathname)===t&&o.classList.add("w--current")})})}(),document.addEventListener("DOMContentLoaded",()=>{document.querySelectorAll("[data-separator]").forEach(e=>{const t=e.getAttribute("data-separator");if(!t)return;const o=Array.from(e.children);o.forEach((e,n)=>{if(n<o.length-1){const o=document.createElement("span");o.innerHTML=` ${t} `,e.insertAdjacentElement("afterend",o)}})})}),document.addEventListener("DOMContentLoaded",()=>{const e=e=>{const t=e.dataset.tabTarget;if(t)return t;const o=e.getAttribute("href");return o?.startsWith("#")?o.slice(1):null},t=e=>document.querySelector(`[data-tab-content="${e}"]`);document.querySelectorAll(".tab-link, [data-tab-link]").forEach(o=>{o.addEventListener("click",o=>{o.preventDefault();const n=o.currentTarget,a=n.dataset.tabGroup,r=e(n),l=r?t(r):null;if(a)document.querySelectorAll(`.tab-link[data-tab-group="${a}"], [data-tab-link][data-tab-group="${a}"]`).forEach(e=>{e.classList.remove("active")}),(t=>{const o=[];return document.querySelectorAll(`.tab-link[data-tab-group="${t}"], [data-tab-link][data-tab-group="${t}"]`).forEach(t=>{const n=e(t);n&&o.push(n)}),o})(a).forEach(e=>{const o=t(e);o&&(o.style.display="none",o.classList.remove("active"))});else{const o=n.parentNode;if(o){o.querySelectorAll(".tab-link, [data-tab-link]").forEach(e=>{e.classList.remove("active")});const n=(t=>{const o=[];return t.querySelectorAll(".tab-link, [data-tab-link]").forEach(t=>{const n=e(t);n&&o.push(n)}),o})(o);n.forEach(e=>{const o=t(e);o&&(o.style.display="none",o.classList.remove("active"))})}}n.classList.add("active"),l&&(l.style.display="block",l.classList.add("active"))})})}),document.addEventListener("DOMContentLoaded",()=>{document.querySelectorAll("[data-lang-link]").forEach(o=>{o.addEventListener("click",o=>{o.preventDefault();const n=e(o.currentTarget);n&&t(n)})}),document.querySelectorAll(".biography-lang-links .tab-link[data-lang]:not([data-lang-link])[data-lang]").forEach(e=>{e.addEventListener("click",e=>{e.preventDefault();const o=e.currentTarget,n=o.dataset?.lang;n&&t(n)})}),a()}),"interactive"!==document.readyState&&"complete"!==document.readyState||a(),document.addEventListener("DOMContentLoaded",()=>{let e=[];const t=document.querySelectorAll(".youtube"),o={};let n=!1;const a=document.querySelectorAll("._init-plyr").length>0,d=i("youtube"),c=i("vimeo"),s=i("dailymotion"),u=()=>{void 0!==window.Plyr&&(e=window.Plyr.setup("._init-plyr"),e.forEach(e=>{e.on("play",()=>{y(),"undefined"!=typeof videoSwipers&&videoSwipers&&videoSwipers.forEach(e=>{e.autoplay.stop()})}),e.on("pause",()=>{"undefined"!=typeof videoSwipers&&videoSwipers&&videoSwipers.forEach(e=>{e.autoplay.start()})})}))},y=(t=null)=>{e.forEach(e=>{e.pause()});for(const[e,n]of Object.entries(o))t!==e&&("youtube"===n.type?n.player.pauseVideo():("vimeo"===n.type||"dailymotion"===n.type)&&n.player.pause())},p=e=>{y(e),"undefined"!=typeof videoSwipers&&videoSwipers&&videoSwipers.forEach(e=>{e.autoplay.stop()})},f=e=>{"undefined"!=typeof videoSwipers&&videoSwipers&&videoSwipers.forEach(e=>{e.autoplay.start()})},m=()=>{n||(n=!0,t.forEach(e=>{e.addEventListener("click",()=>{const t=e.querySelector("[data-custom-embed]");t&&(e.innerHTML=t.innerHTML);const n=e,a=`player_${n.dataset.id}`,r=n.dataset.type,l=n.dataset.videoId,i=parseInt(n.dataset.time||"0",10);if(l&&r)if(p(a),"youtube"===r&&window.YT){const e=new window.YT.Player(a,{videoId:l,playerVars:{start:i},events:{onReady:e=>{e.target.playVideo()},onStateChange:e=>{e.data===window.YT.PlayerState.PLAYING?p(a):e.data!==window.YT.PlayerState.PAUSED&&e.data!==window.YT.PlayerState.ENDED||f()}}});o[a]={type:r,player:e}}else if("vimeo"===r&&window.Vimeo){const e=document.getElementById(a);e&&(e.innerHTML="");const t=new window.Vimeo.Player(a,{id:l,autoplay:!0,start:i});t.on("play",()=>p(a)),t.on("pause",()=>f()),o[a]={type:r,player:t}}else"dailymotion"===r&&window.dailymotion&&window.dailymotion.createPlayer(a,{video:l,params:{autoplay:1,start:i,mute:!1}}).then(e=>{e.on("play",()=>p(a)),e.on("pause",()=>f()),e.on("ended",()=>f()),o[a]={type:"dailymotion",player:e}}).catch(e=>{console.error("Error initializing Dailymotion player:",e)})})}))};d&&(window.onYouTubeIframeAPIReady=()=>{m()});const w=[];var h;a&&w.push(window.Plyr&&"function"==typeof window.Plyr.setup?Promise.resolve():Promise.all([(h="https://cdn.plyr.io/3.7.8/plyr.css",r(h,"stylesheet")),l("https://cdn.plyr.io/3.7.8/plyr.polyfilled.js")]).then(()=>{}).catch(e=>{throw console.error("Failed to load Plyr resources:",e),e})),d&&w.push(window.YT&&"function"==typeof window.YT.Player?Promise.resolve():l("https://www.youtube.com/iframe_api").catch(e=>{console.error("Failed to load YouTube API:",e)})),c&&w.push(window.Vimeo&&"function"==typeof window.Vimeo.Player?Promise.resolve():l("https://player.vimeo.com/api/player.js").catch(e=>{console.error("Failed to load Vimeo API:",e)})),s&&w.push(window.dailymotion&&"function"==typeof window.dailymotion.createPlayer?Promise.resolve():l("https://api.dmcdn.net/all.js").catch(e=>{console.error("Failed to load Dailymotion API:",e)})),w.length>0?Promise.all(w).then(()=>{a&&u(),d?setTimeout(()=>{n||m()},1e3):setTimeout(()=>{m()},100)}).catch(e=>{console.error("Error loading video player APIs:",e),a&&void 0!==window.Plyr&&u(),setTimeout(()=>{m()},500)}):(a&&void 0!==window.Plyr&&u(),m()),"undefined"!=typeof videoSwipers&&videoSwipers&&videoSwipers.forEach(e=>{e.on("slideChange",()=>{y()})})}),document.addEventListener("DOMContentLoaded",()=>{const e=["maxresdefault","sddefault","hqdefault","mqdefault","default"],t=(o,n=0)=>{if(o.naturalWidth>120)return;if(n>=e.length)return;const a=e[n],r=o.src,l=new Image;l.onload=()=>{l.naturalWidth>120?o.src=l.src:t(o,n+1)},l.onerror=()=>{t(o,n+1)},l.src=r.replace(/maxresdefault/,a)};document.querySelectorAll(".youtube img").forEach(e=>{t(e)})}),document.addEventListener("DOMContentLoaded",()=>{document.querySelectorAll("[data-download-href]").forEach(e=>{e.addEventListener("click",t=>{t.preventDefault(),t.stopPropagation();const o=e.getAttribute("data-download-href"),n=e.getAttribute("data-download-filename");o&&((e,t)=>{const o=document.createElement("a");o.href=e,o.download=t||e.split("/").pop()||"download",document.body.appendChild(o),o.click(),document.body.removeChild(o)})(o,n)})})})}();
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
/*! dm-js-lib/previewDetailSwitcher v0.3.
|
|
1
|
+
/*! dm-js-lib/previewDetailSwitcher v0.3.3 */
|
|
2
2
|
var PreviewDetailSwitcher=function(e){"use strict";function t(e={}){const{container:t,itemSelector:r="[data-detail-item]",previewIdAttribute:n="data-preview-id",detailIdAttribute:i="data-detail-id",initialIndex:o=0,displayValue:a="block"}=e,c=(()=>{if(!t)return document;if("string"==typeof t){return document.querySelector(t)||document}return t})(),d=e=>{const t=e.currentTarget;if(!t)return;const o=t.getAttribute(n);if(!o)return;const d=c.querySelector(`${r}[${i}="${o}"]`);if(!d)return;c.querySelectorAll(r).forEach(e=>{e&&(e.style.display="none")}),d.style.display=a},l=()=>{const e=c.querySelectorAll(r);if(0===e.length)return;e.forEach(e=>{e&&(e.style.display="none")});const t=e[o];t?t.style.display=a:e[0]&&(e[0].style.display=a);c.querySelectorAll(`[${n}]`).forEach(e=>{e&&e.addEventListener("click",d)})};"loading"===document.readyState?document.addEventListener("DOMContentLoaded",l):l()}return e.initPreviewDetailSwitcher=t,e.initPreviewDetailSwitchers=function(e,r={}){const n=()=>{document.querySelectorAll(e).forEach(e=>{e&&t({...r,container:e})})};"loading"===document.readyState?document.addEventListener("DOMContentLoaded",n):n()},e}({});
|