@dreher-media/dm-js-lib 0.0.2 → 0.0.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 +1 -1
- package/package.json +1 -1
package/dist/dm-js-lib.min.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
!function(){"use strict"
|
|
1
|
+
!function(){"use strict";function e(e){return new Promise((t,o)=>{if(document.querySelector(`script[src="${e}"]`))return void t();const n=document.createElement("script");n.src=e,n.async=!0,n.onload=()=>t(),n.onerror=()=>o(new Error(`Failed to load script: ${e}`)),document.head.appendChild(n)})}function t(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()});const e=sessionStorage.getItem("selected_lang");if(e){const t=document.querySelector(`.biography-lang-links .tab-link[data-lang="${e}"]`);t?.click?.()}}),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",()=>{document.querySelectorAll(".tab-link").forEach(e=>{e.addEventListener("click",e=>{const t=e.currentTarget,o=t.parentNode;if(o){const e=o.querySelector(".tab-link.active");e&&e.classList.remove("active"),t.classList.add("active")}})})}),document.addEventListener("DOMContentLoaded",()=>{document.querySelectorAll(".biography-lang-links .tab-link[data-lang]").forEach(e=>{e.addEventListener("click",e=>{const t=e.currentTarget,o=t.dataset?.lang;o&&(sessionStorage.setItem("selected_lang",o),document.querySelectorAll(`.biography-text:not(.${o})`).forEach(e=>{e.style.display="none"}),document.querySelectorAll(`.biography-text.${o}`).forEach(e=>{e.style.display="block"}),document.querySelectorAll(`.biography-lang-links .tab-link:not([data-lang="${o}"])`).forEach(e=>{e.classList.remove("active")}),document.querySelectorAll(`.biography-lang-links .tab-link[data-lang="${o}"]`).forEach(e=>{e.classList.add("active")}))})})}),document.addEventListener("DOMContentLoaded",()=>{void 0!==window.Plyr&&window.Plyr.setup("._init-plyr");const o=document.querySelectorAll(".youtube"),n={};let a=!1;const r=t("youtube"),i=t("vimeo"),d=t("dailymotion"),l=(e=null)=>{for(const[t,o]of Object.entries(n))e!==t&&("youtube"===o.type?o.player.pauseVideo():("vimeo"===o.type||"dailymotion"===o.type)&&o.player.pause())},c=e=>{l(e),"undefined"!=typeof videoSwipers&&videoSwipers&&videoSwipers.forEach(e=>{e.autoplay.stop()})},s=e=>{"undefined"!=typeof videoSwipers&&videoSwipers&&videoSwipers.forEach(e=>{e.autoplay.start()})},u=()=>{a||(a=!0,o.forEach(e=>{e.addEventListener("click",()=>{const t=e.querySelector("[data-custom-embed]");t&&(e.innerHTML=t.innerHTML);const o=e,a=`player_${o.dataset.id}`,r=o.dataset.type,i=o.dataset.videoId,d=parseInt(o.dataset.time||"0",10);if(i&&r)if(c(a),"youtube"===r&&window.YT){const e=new window.YT.Player(a,{videoId:i,playerVars:{start:d},events:{onReady:e=>{e.target.playVideo()},onStateChange:e=>{e.data===window.YT.PlayerState.PLAYING?c(a):e.data!==window.YT.PlayerState.PAUSED&&e.data!==window.YT.PlayerState.ENDED||s()}}});n[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:i,autoplay:!0,start:d});t.on("play",()=>c(a)),t.on("pause",()=>s()),n[a]={type:r,player:t}}else"dailymotion"===r&&window.dailymotion&&window.dailymotion.createPlayer(a,{video:i,params:{autoplay:1,start:d,mute:!1}}).then(e=>{e.on("play",()=>c(a)),e.on("pause",()=>s()),e.on("ended",()=>s()),n[a]={type:"dailymotion",player:e}}).catch(e=>{console.error("Error initializing Dailymotion player:",e)})})}))};r&&(window.onYouTubeIframeAPIReady=()=>{u()});const y=[];r&&y.push(window.YT&&"function"==typeof window.YT.Player?Promise.resolve():e("https://www.youtube.com/iframe_api").catch(e=>{console.error("Failed to load YouTube API:",e)})),i&&y.push(window.Vimeo&&"function"==typeof window.Vimeo.Player?Promise.resolve():e("https://player.vimeo.com/api/player.js").catch(e=>{console.error("Failed to load Vimeo API:",e)})),d&&y.push(window.dailymotion&&"function"==typeof window.dailymotion.createPlayer?Promise.resolve():e("https://api.dmcdn.net/all.js").catch(e=>{console.error("Failed to load Dailymotion API:",e)})),y.length>0?Promise.all(y).then(()=>{r?setTimeout(()=>{a||u()},1e3):setTimeout(()=>{u()},100)}).catch(e=>{console.error("Error loading video player APIs:",e),setTimeout(()=>{u()},500)}):u(),"undefined"!=typeof videoSwipers&&videoSwipers&&videoSwipers.forEach(e=>{e.on("slideChange",()=>{l()})})}),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,i=new Image;i.onload=()=>{i.naturalWidth>120?o.src=i.src:t(o,n+1)},i.onerror=()=>{t(o,n+1)},i.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)})})})}();
|