1import { 2 init_modal_v1 3} from "./chunk-5NUE6T5P.js"; 4import { 5 CF2Component, 6 init_runtime, 7 registerComponent 8} from "./chunk-NQUHJ6NR.js"; 9import { 10 init_define_process 11} from "./chunk-RFSPGZ3L.js"; 12
13// projects/lib/packages/yggdrasil-blueprints/__generated__/packs/video.ts 14init_define_process(); 15
16// projects/lib/packages/yggdrasil-blueprints/__generated__/blueprints/video-player-starter-v1.ts 17init_define_process(); 18var VideoPlayerStarterV1 = class _VideoPlayerStarterV1 { 19 static getInstance() { 20 if (this._instance) { 21 return this._instance; 22 } 23 this._instance = new _VideoPlayerStarterV1(); 24 this.setupYoutubeAPI(); 25 this.setupVimeoAPI(); 26 this.setupWistiaAPI(); 27 this.setupVoomlyAPI(); 28 return this._instance; 29 } 30 static setupYoutubeAPI() { 31 const youtubeVideos = document.querySelectorAll('[data-video-type="youtube"]'); 32 youtubeVideos?.forEach((yVideo) => { 33 if (yVideo?.querySelector(".iframeblocked, .iframeunmuted") && !document.getElementById("youtube-script")) { 34 const tag = document.createElement("script"); 35 tag.src = "//www.youtube.com/iframe_api"; 36 tag.id = "youtube-script"; 37 const firstScriptTag = document.body.getElementsByTagName("script")[0]; 38 firstScriptTag.parentNode.insertBefore(tag, firstScriptTag); 39 globalThis.onYouTubePlayerAPIReady = () => { 40 this.YoutubeApiReady = true; 41 const event = new CustomEvent("CF2_YOUTUBE_API_READY"); 42 document.dispatchEvent(event); 43 }; 44 } 45 }); 46 } 47 static setupVimeoAPI() { 48 const vimeoVideos = document.querySelectorAll('[data-video-type="vimeo"]'); 49 vimeoVideos?.forEach((vVideo) => { 50 if (vVideo?.querySelector(".iframeblocked, .iframeunmuted") && !document.getElementById("vimeo-script")) { 51 const tag = document.createElement("script"); 52 tag.src = "https://player.vimeo.com/api/player.js"; 53 tag.id = "vimeo-script"; 54 const firstScriptTag = document.getElementsByTagName("script")[0]; 55 firstScriptTag.parentNode.insertBefore(tag, firstScriptTag); 56 } 57 }); 58 } 59 static setupWistiaAPI() { 60 const wistiaVideos = document.querySelectorAll('[data-video-type="wistia"]'); 61 wistiaVideos?.forEach((wVideo) => { 62 if (wVideo?.querySelector(".iframeblocked, .iframeunmuted") && !document.getElementById("wistia-script")) { 63 const tag = document.createElement("script"); 64 tag.src = "//fast.wistia.net/assets/external/E-v1.js"; 65 tag.id = "wistia-script"; 66 const firstScriptTag = document.head.getElementsByTagName("script")[0]; 67 firstScriptTag.parentNode.insertBefore(tag, firstScriptTag); 68 } 69 }); 70 } 71 static setupVoomlyAPI() { 72 if (document.querySelectorAll('[data-video-type="voomly"]').length) { 73 document.querySelectorAll('[data-video-type="voomly"]').forEach((voomlyVideo) => { 74 const tagSrc = voomlyVideo.getAttribute("data-src-lib-script"); 75 voomlyVideo.removeAttribute("data-src-lib-script"); 76 if (!document.getElementById("voomly-script")) { 77 const tag = document.createElement("script"); 78 tag.src = tagSrc; 79 tag.id = "voomly-script"; 80 const firstScriptTag = document.getElementsByTagName("script")[0]; 81 firstScriptTag.parentNode.insertBefore(tag, firstScriptTag); 82 tag.onload = () => { 83 document.dispatchEvent(new CustomEvent("CF2_VOOMLY_API_READY")); 84 }; 85 } 86 }); 87 } 88 } 89 setupVideo(element) { 90 const videoType = element.getAttribute("data-video-type"); 91 if (videoType === "html5") { 92 this.setupHTML5(element); 93 } else if (videoType === "youtube") { 94 this.setupYoutube(element); 95 } else if (videoType === "vimeo") { 96 this.setupVimeo(element); 97 } else if (videoType === "wistia") { 98 this.setupWistia(element); 99 } else if (videoType === "voomly") { 100 this.setupVoomly(element); 101 } else if (videoType === "custom" || videoType === "custom_script") { 102 this.sharedSetup(element); 103 } 104 this.setupLazyLoaded(element); 105 } 106 setAndGetIFrameId(element) { 107 let frameId = null; 108 if (!element) return; 109 const iframe = element.querySelector("iframe"); 110 frameId = iframe.getAttribute("name"); 111 iframe.setAttribute("id", frameId); 112 return frameId; 113 } 114 fitVids(element) { 115 const customSelectors = [ 116 'iframe[src*="fast.wistia.net"]', 117 'iframe[src*="embed.voomly.com"]', 118 'iframe[data-src*="player.vimeo.com"]', 119 'iframe[data-src*="youtube.com"]', 120 'iframe[data-src*="youtube-nocookie.com"]', 121 'iframe[data-src*="fast.wistia.net"]', 122 'iframe[data-src*="embed.voomly.com"]', 123 'iframe[data-src*="kickstarter.com"][data-src*="video.html"]' 124 ]; 125 const applyFitVids = () => { 126 $(element).fitVids({ customSelector: customSelectors.join(",") }); 127 if (navigator.vendor === "Apple Computer, Inc.") { 128 element.querySelectorAll(".fluid-width-video-wrapper iframe[src]").forEach((iframe) => {
129 iframe.src = iframe.src; 130 }); 131 } 132 }; 133 try { 134 applyFitVids(); 135 } catch (error) { 136 if (error.name !== "NotFoundError") throw error; 137 requestAnimationFrame(() => { 138 element.querySelectorAll(".fluid-width-video-wrapper:empty").forEach((wrapper) => wrapper.remove()); 139 applyFitVids(); 140 }); 141 } 142 } 143 setupMuted(bpPlayer, element) { 144 if (!bpPlayer || !element) return; 145 const iframeUnmute = element.querySelector(".iframeUnmute"); 146 const child = '<div class="unmute-player-wrapper"><span class="unmute-player-icon"><i class="fa fa-volume-up"/></span></div>'; 147 $(iframeUnmute).append(child); 148 } 149 handleExtraListeners(element, bpPlayer, callback) { 150 const videoType = element.getAttribute("data-video-type"); 151 const blockPauseAttr = element.getAttribute(`data-${videoType}-block-pause`); 152 if (blockPauseAttr === "true") { 153 this.appendBPText(bpPlayer, element); 154 const wrapper = element.querySelector(".start-session-wrapper"); 155 wrapper.addEventListener("click", () => { 156 callback(); 157 $(wrapper).remove(); 158 }); 159 } else { 160 this.setupMuted(bpPlayer, element); 161 const wrapper = element.querySelector(".unmute-player-wrapper"); 162 wrapper.addEventListener("click", () => { 163 callback(); 164 $(wrapper).closest(".iframeUnmute").remove(); 165 }); 166 } 167 } 168 resizeVids(iframe, element) { 169 $(iframe).attr("width", "auto"); 170 $(iframe).attr("height", "auto"); 171 this.fitVids(element); 172 $(iframe).css("width", "100%"); 173 $(iframe).css("height", "100%"); 174 } 175 setStickyVideo(element, isStickyCloseable, videoFrame) { 176 const { bottom, top } = element.getBoundingClientRect(); 177 const videoType = element.getAttribute("data-video-type"); 178 if (bottom <= 10) { 179 if ((videoType === "html5" || videoType === "voomly" || videoType === "custom_script") && !element.dataset.originalHeight) { 180 const currentHeight = element.offsetHeight; 181 element.dataset.originalHeight = currentHeight; 182 element.style.height = `${currentHeight}px`; 183 } 184 videoFrame.classList.add("video-sticky-css"); 185 if (!isStickyCloseable) return; 186 const closeIconDiv = element.querySelector(".closeIconDiv"); 187 closeIconDiv.style.display = "flex"; 188 } 189 if (top >= 10) { 190 videoFrame.classList.remove("video-sticky-css"); 191 if ((videoType === "html5" || videoType === "voomly" || videoType === "custom_script") && element.dataset.originalHeight) { 192 delete element.dataset.originalHeight; 193 element.style.height = ""; 194 } 195 if (!isStickyCloseable) return; 196 const closeIconDiv = element.querySelector(".closeIconDiv"); 197 closeIconDiv.style.display = "none"; 198 } 199 } 200 appendBPText(bpPlayer, element) { 201 if (!bpPlayer || !element) return; 202 const text = element.getAttribute("data-session-starter-text") ?? "Click To Join Session In Progess..."; 203 const iframeBlocker = element.querySelector(".iframeBlocker"); 204 const child = `<div class="start-session-wrapper"><span class="start-session">${text}</span></div>`; 205 $(iframeBlocker).append(child); 206 } 207 appendExtraChildren(element) { 208 const elVideo = element.querySelector(".elVideo"); 209 if (elVideo?.classList?.contains("iframeblocked")) $(elVideo).append("<div class='iframeBlocker'></div>"); 210 if (elVideo?.classList?.contains("iframeunmuted")) $(elVideo).append("<div class='iframeUnmute'></div>"); 211 } 212 setupDefaultSize(element) { 213 const iframe = element.querySelector("iframe"); 214 if (!iframe) return; 215 const isVideoPopup = element.parentElement?.classList?.contains("elPopupVideoContainer"); 216 if (isVideoPopup) { 217 this.fitVids(element); 218 } else { 219 const wrapperWidth = $(element).css("width").split("px")[0]; 220 const customWidth = element.getAttribute("data-custom-width"); 221 const customHeight = element.getAttribute("data-custom-height"); 222 const hasCustomSize = !!customHeight || !!customWidth; 223 if (Number(wrapperWidth) > Number(customWidth)) { 224 if (hasCustomSize) { 225 if (customHeight == "auto" && customWidth == "auto") { 226 this.fitVids(element); 227 } 228 } else { 229 this.fitVids(element); 230 } 231 } else { 232 this.fitVids(element); 233 } 234 } 235 }
236 setupVideoReSizing(element) { 237 const iframe = element.querySelector("iframe"); 238 const isVideoPopup = element.parentElement?.classList?.contains("elPopupVideoContainer"); 239 const customWidth = element.getAttribute("data-custom-width"); 240 if (!iframe || isVideoPopup || !customWidth) return; 241 const customHeight = element.getAttribute("data-custom-height"); 242 const fluidClass = "fluid-width-video-wrapper"; 243 window.addEventListener("resize", () => { 244 const wrapperWidth = $(element).css("width").split("px")[0]; 245 const hasResized = element.querySelector(`.${fluidClass}`); 246 if (Number(wrapperWidth) < Number(customWidth)) { 247 if (!hasResized) { 248 this.resizeVids(iframe, element); 249 } 250 } else { 251 if (!hasResized) return; 252 const $fluidWrapper = $(element).find(`.${fluidClass}`); 253 $fluidWrapper.css("padding-top", 0); 254 $fluidWrapper.css("border-radius", "inherit"); 255 $(iframe).css("width", customWidth ?? 640); 256 $(iframe).css("height", customHeight ?? 360); 257 $fluidWrapper.removeClass(fluidClass); 258 } 259 }); 260 } 261 isMobile() { 262 const subs = { 263 Android: function() { 264 return navigator.userAgent.match(/Android/i); 265 }, 266 BlackBerry: function() { 267 return navigator.userAgent.match(/BlackBerry/i); 268 }, 269 iOS: function() { 270 return navigator.userAgent.match(/iPhone|iPad|iPod/i); 271 }, 272 Opera: function() { 273 return navigator.userAgent.match(/Opera Mini/i); 274 }, 275 Windows: function() { 276 return navigator.userAgent.match(/IEMobile/i); 277 }, 278 any: function() { 279 return subs.Android() || subs.BlackBerry() || subs.iOS() || subs.Opera() || subs.Windows(); 280 } 281 }; 282 return subs; 283 } 284 setupStickyVideo(element) { 285 const isSticky = element.getAttribute("data-is-video-sticky") === "true"; 286 if (!isSticky) return; 287 let isVideoClosed = false; 288 const isStickyCloseable = element.getAttribute("data-sticky-closeable") === "true"; 289 let videoFrame = element.querySelector("iframe"); 290 const videoType = element.getAttribute("data-video-type"); 291 if (videoType === "html5") videoFrame = element.querySelector(".video-js"); 292 else if (videoType === "voomly") videoFrame = element.querySelector(`[data-id="${element.getAttribute("data-voomly-video-id")}"]`); 293 else if (videoType === "custom_script" && !videoFrame) { 294 videoFrame = element.querySelector(".voomly-embed"); 295 } 296 if (!videoFrame) return; 297 if (isStickyCloseable) { 298 const videoWrapper = element.querySelector(".elVideo") ?? element; 299 const closeVideoDiv = document.createElement("div"); 300 const closeVideoIcon = document.createElement("i"); 301 closeVideoDiv.classList.add("video-sticky-close-button-css"); 302 closeVideoIcon.className = "fa fa-times"; 303 closeVideoDiv.appendChild(closeVideoIcon); 304 closeVideoDiv.classList.add("closeIconDiv"); 305 videoWrapper.appendChild(closeVideoDiv); 306 const closeIconDiv = videoWrapper.querySelector(".closeIconDiv"); 307 closeIconDiv.addEventListener("click", function(e) { 308 e.preventDefault(); 309 closeIconDiv.style.display = "none"; 310 videoFrame.classList.remove("video-sticky-css"); 311 if ((videoType === "html5" || videoType === "voomly" || videoType === "custom_script") && element.dataset.originalHeight) { 312 delete element.dataset.originalHeight; 313 element.style.height = ""; 314 } 315 isVideoClosed = true; 316 }); 317 } 318 this.setStickyVideo(element, isStickyCloseable, videoFrame); 319 window.addEventListener("scroll", () => { 320 const windowWidth = window.innerWidth; 321 if (windowWidth > 640 && !this.isMobile().any() && !isVideoClosed) { 322 this.setStickyVideo(element, isStickyCloseable, videoFrame); 323 } 324 }); 325 } 326 handleVoomlyAPI() { 327 const voomlyEmbedBlock = document.querySelectorAll(".voomly-embed-api"); 328 voomlyEmbedBlock.forEach((video) => { 329 const videoID = video.dataset.id; 330 const videoType = video.dataset.type; 331 const videoAspect = video.dataset.ratio; 332 const player = window.attachVoomlyPlayer(video, videoID, videoType, videoAspect); 333 player.onReady(() => { 334 player.enableCustomTurnstileIntegration(); 335 player.onTimelineTurnstileCompleted((body) => { 336 if (body.email) { 337 const filteredBody = {};
338 Object.keys(body).forEach((key) => { 339 if (key === "firstName") filteredBody["first_name"] = body[key]; 340 if (key === "lastName") filteredBody["last_name"] = body[key]; 341 if (key === "email") filteredBody["email"] = body[key]; 342 }); 343 fetch(window.location, { 344 method: "post", 345 headers: { 346 "Content-Type": "application/json", 347 "X-CF2-POST-TYPE": "submit" 348 }, 349 body: JSON.stringify({ contact: filteredBody }) 350 }); 351 } 352 }); 353 }); 354 }); 355 } 356 setupVoomly(element) { 357 if (window.attachVoomlyPlayer) { 358 if (element.querySelector(".voomly-embed-api")) { 359 this.handleVoomlyAPI(); 360 } 361 this.sharedSetup(element); 362 } else { 363 document.addEventListener("CF2_VOOMLY_API_READY", () => { 364 if (element.querySelector(".voomly-embed-api")) { 365 this.handleVoomlyAPI(); 366 } 367 this.sharedSetup(element); 368 }); 369 } 370 } 371 setupYoutubeBP(element) { 372 const frameId = this.setAndGetIFrameId(element); 373 if (!frameId) return; 374 const bpPlayer = new window.YT.Player(frameId, {}); 375 this.handleExtraListeners(element, bpPlayer, () => { 376 bpPlayer.seekTo(0, true); 377 bpPlayer.unMute(); 378 }); 379 } 380 setupYoutubeBPListeners(element) { 381 const bpVideo = element.querySelector(".iframeblocked, .iframeunmuted"); 382 if (!bpVideo) return; 383 const iframe = bpVideo.querySelector("iframe"); 384 const srcAttr = iframe.getAttribute("data-src") ? "data-src" : "src"; 385 let src = iframe.getAttribute(srcAttr); 386 if (src.indexOf("enablejsapi") < 0) { 387 src = src.replace("autoplay=1", "enablejsapi=1&autoplay=1"); 388 iframe.setAttribute(srcAttr, src); 389 } 390 if (_VideoPlayerStarterV1.YoutubeApiReady) { 391 if (!iframe.getAttribute("data-src")) this.setupYoutubeBP(element); 392 } else { 393 document.addEventListener("CF2_YOUTUBE_API_READY", () => { 394 if (!iframe.getAttribute("data-src")) this.setupYoutubeBP(element); 395 }); 396 } 397 } 398 setupVimeoBP(element) { 399 const frameId = this.setAndGetIFrameId(element); 400 if (frameId) { 401 const bpPlayer = new window.Vimeo.Player(frameId); 402 bpPlayer.ready().then(() => { 403 this.handleExtraListeners(element, bpPlayer, () => { 404 bpPlayer.setCurrentTime(0); 405 bpPlayer.setVolume(0.5); 406 }); 407 }); 408 } 409 } 410 checkVimeoReady(element) { 411 const loopUntilVimeoReady = (timeout) => { 412 timeout = timeout >= 300 ? timeout : timeout + 50; 413 const iframe = element.querySelector("iframe"); 414 if (!window.Vimeo) { 415 window.setTimeout(loopUntilVimeoReady, timeout, timeout); 416 } else { 417 if (!iframe.getAttribute("data-src")) this.setupVimeoBP(element); 418 } 419 }; 420 loopUntilVimeoReady(50); 421 } 422 setupVimeoListeners(element) { 423 const bpVideo = element.querySelector(".iframeblocked, .iframeunmuted"); 424 if (!bpVideo) return; 425 this.checkVimeoReady(element); 426 } 427 setupWistiaBP(element) { 428 const setWistiaListener = (video) => { 429 const bpPlayer = video; 430 const element2 = $(video.container).closest(".elVideoWrapper").get(0); 431 this.handleExtraListeners(element2, bpPlayer, () => { 432 bpPlayer.play(); 433 bpPlayer.unmute(); 434 }); 435 }; 436 const wistiaId = element.getAttribute("data-wistia-id"); 437 globalThis._wq = globalThis._wq || []; 438 globalThis._wq.push({ id: wistiaId, onReady: setWistiaListener }); 439 } 440 setupWistiaListeners(element) { 441 const bpVideo = element.querySelector(".iframeblocked, .iframeunmuted"); 442 const iframe = element.querySelector("iframe"); 443 if (!bpVideo) return; 444 if (!iframe.getAttribute("data-src")) this.setupWistiaBP(element); 445 } 446 sharedSetup(element) { 447 this.setupDefaultSize(element); 448 this.setupVideoReSizing(element); 449 this.setupStickyVideo(element); 450 this.appendExtraChildren(element); 451 } 452 setupYoutube(element) { 453 const url = window.location.href; 454 const queries = $.parseParams(url); 455 if (queries["noautoplay"] == "true") { 456 let src = $(".elVideo iframe", $(element)).attr("src"); 457 src = src.replace("autoplay=1", "autoplay=0"); 458 $(".elVideo iframe", $(element)).attr("src", src); 459 } 460 this.sharedSetup(element); 461 this.setupYoutubeBPListeners(element); 462 } 463 setupVimeo(element) { 464 const url = window.location.href; 465 const queries = $.parseParams(url); 466 if (queries["noautoplay"] == "true") { 467 let src = $(".elVideo iframe", $(element)).attr("src"); 468 src = src.replace("autoplay=1", "autoplay=0"); 469 $(".elVideo iframe", $(element)).attr("src", src); 470 } 471 this.sharedSetup(element); 472 this.setupVimeoListeners(element); 473 } 474 setupWistia(element) { 475 const url = window.location.href; 476 const queries = $.parseParams(url); 477 if (queries["noautoplay"] == "true") { 478 let src = $(".elVideo iframe", this).attr("src"); 479 src = src.replace("autoPlay=1", "autoPlay=0"); 480 $(".elVideo iframe", this).attr("src", src); 481 } 482 this.sharedSetup(element); 483 this.setupWistiaListeners(element); 484 } 485 setupHTML5(element) { 486 const video = element.querySelector("video"); 487 const id = video.id; 488 const player = globalThis.videojs(id); 489 player.fluid(true); 490 player.playbackRates([0.5, 1, 1.5, 2]); 491 player.aspectRatio("16:9"); 492 this.sharedSetup(element); 493 video.addEventListener("contextmenu", (evt) => { 494 evt.preventDefault(); 495 }); 496 } 497 setupLazyLoaded(element) { 498 var lazyVideo = element.querySelector('iframe[data-loading="lazy"], video[data-loading="lazy"]'); 499 const videoType = element.getAttribute("data-video-type"); 500 if (lazyVideo && "IntersectionObserver" in window) { 501 if (lazyVideo.tagName == "VIDEO") { 502 lazyVideo.addEventListener("loadeddata", () => { 503 delete element.querySelector(".elSpinnerWrapper")?.dataset?.loader; 504 }); 505 } else if (lazyVideo.tagName == "IFRAME") { 506 lazyVideo.addEventListener("load", () => { 507 if (element.querySelector(".iframeblocked, .iframeunmuted")) { 508 if (videoType === "youtube") { 509 this.setupYoutubeBP(element); 510 } else if (videoType === "vimeo") { 511 this.setupVimeoBP(element); 512 } else if (videoType === "wistia") { 513 this.setupWistiaBP(element); 514 } 515 } 516 delete element.querySelector(".elSpinnerWrapper")?.dataset?.loader; 517 }); 518 } 519 var lazyVideoObserver = new IntersectionObserver((entries, observer) => {
520 entries.forEach((el) => { 521 const target = el.target; 522 if (el.isIntersecting) { 523 if (target.tagName == "IFRAME") { 524 target.setAttribute("src", target.dataset.src); 525 delete target.dataset.loading; 526 lazyVideoObserver.unobserve(lazyVideo); 527 } else if (target.tagName == "VIDEO") { 528 for (var source in target.children) { 529 var videoSource = target.children[source]; 530 if (typeof videoSource.tagName === "string" && videoSource.tagName === "SOURCE" && videoSource.dataset.src) { 531 videoSource.src = videoSource.dataset.src; 532 } 533 } 534 target.load(); 535 delete target.dataset.loading; 536 lazyVideoObserver.unobserve(lazyVideo); 537 } 538 } 539 }); 540 }); 541 lazyVideoObserver.observe(lazyVideo); 542 } else { 543 delete element.querySelector(".elSpinnerWrapper")?.dataset?.loader; 544 } 545 } 546}; 547var videoPlayerStarter = VideoPlayerStarterV1.getInstance(); 548var video_player_starter_v1_default = videoPlayerStarter; 549
550// projects/lib/packages/yggdrasil-blueprints/__generated__/blueprints/video-background-v1.ts 551init_define_process(); 552init_runtime(); 553var VideoBackgroundV1 = class extends CF2Component { 554 constructor(el, runtimeSel) { 555 super(el, runtimeSel); 556 } 557 mount() { 558 this.parentElement = this.element.parentElement; 559 this.isPageBackground = this.parentElement.getAttribute("data-page-element") === "ContentNode"; 560 this.background = $(this.parentElement).css("background"); 561 this.backgroundOverlayContainer = this.element.querySelector(".backgroundOverlay"); 562 this.videoEnded = false; 563 this.id = this.element.getAttribute("data-param-videoid"); 564 this.playerId = this.element.getAttribute("data-param-videoplayerid"); 565 this.type = this.element.getAttribute("data-param-videotype"); 566 this.endaction = this.element.getAttribute("data-param-endaction"); 567 this.redirectUrl = this.element.getAttribute("data-param-redirecturl"); 568 this.redirectToNewPage = this.element.getAttribute("data-param-redirectnewpage"); 569 this.useBgAsOverlay = this.element.getAttribute("data-param-usebgasoverlay"); 570 this.styleType = this.element.getAttribute("data-param-bgstyletype"); 571 this.offsetY = this.element.getAttribute("data-param-bgoffsety"); 572 this.offsetX = this.element.getAttribute("data-param-bgoffsetx"); 573 this.hideOnMobile = this.element.getAttribute("data-param-hideonmobile"); 574 this.overlayBackground = this.element.getAttribute("data-param-overlaybackground"); 575 const href = window.location.href; 576 const queries = $.parseParams(href); 577 if (queries["noautoplay"] == "true") return; 578 if (this.type === "youtube") { 579 if (!document.getElementById("youtube-script")) { 580 const tag = document.createElement("script"); 581 tag.src = "https://www.youtube.com/iframe_api"; 582 tag.id = "youtube-script"; 583 const firstScriptTag = document.getElementsByTagName("script")[0]; 584 firstScriptTag.parentNode.insertBefore(tag, firstScriptTag); 585 } 586 this.handleYoububePlayer(); 587 } else if (this.type === "vimeo") { 588 if (!document.getElementById("vimeo-script")) { 589 const tag = document.createElement("script"); 590 tag.src = "https://player.vimeo.com/api/player.js"; 591 tag.id = "vimeo-script"; 592 $("body").append(tag); 593 } 594 this.handleVimeoPlayer(); 595 } 596 } 597 handleVideoStart() { 598 const parentElement = this.parentElement; 599 const useBgAsOverlay = this.useBgAsOverlay === "true"; 600 const background = this.overlayBackground; 601 const backgroundOverlayContainer = this.backgroundOverlayContainer; 602 const zIndex = $(parentElement).css("z-index"); 603 $(parentElement).css("background", "none"); 604 if (useBgAsOverlay) { 605 $(backgroundOverlayContainer).css("display", "block"); 606 $(backgroundOverlayContainer).css("background", background); 607 } 608 if (!zIndex || zIndex === "auto") { 609 $(parentElement).css("z-index", 1); 610 } 611 this.handleVideoResize(); 612 } 613 handleYoububePlayer() { 614 const loop = this.endaction === "loop" ? 1 : 0; 615 const videoId = this.id; 616 const playerId = this.playerId; 617 const [width, height] = this.getVideoSize(); 618 const onPlayerStateChange = (evt) => { 619 if (evt.data == window.YT.PlayerState.ENDED) { 620 this.handleVideoEndAction(); 621 } 622 }; 623 const onPlayerReady = () => { 624 this.handleVideoStart(); 625 }; 626 const handleYoutube = (timeout) => { 627 timeout = timeout >= 300 ? timeout : timeout + 50; 628 if (window.YT?.Player) { 629 const player = new window.YT.Player(playerId, { 630 width, 631 height, 632 videoId, 633 playerVars: { 634 controls: 0, 635 autoplay: 1, 636 mute: 1, 637 disablekb: 1, 638 loop, 639 enablejsapi: 1, 640 modestbranding: 1, 641 playlist: videoId, 642 origin: window.location.href, 643 rel: 0 644 }, 645 events: { 646 "onReady": onPlayerReady, 647 "onStateChange": onPlayerStateChange 648 } 649 }); 650 } else { 651 window.setTimeout(handleYoutube, timeout, timeout); 652 } 653 }; 654 handleYoutube(50); 655 } 656 handleVimeoPlayer() { 657 const videoId = this.id; 658 const loop = this.endaction === "loop"; 659 const playerId = this.playerId; 660 const [width, height] = this.getVideoSize(); 661 const handleVimeo = (timeout) => { 662 timeout = timeout >= 300 ? timeout : timeout + 50; 663 if (window.Vimeo?.Player) { 664 $(`#${playerId}`).css({ 665 overflow: "hidden", 666 width: "100%", 667 height: "100%" 668 }); 669 const player = new window.Vimeo.Player(playerId, { 670 id: videoId, 671 width, 672 height, 673 autoplay: true, 674 muted: true, 675 pause: false, 676 byline: false, 677 title: false, 678 loop, 679 autopause: false, 680 controls: false, 681 sidedock: false 682 }); 683 player.on("play", () => { 684 this.handleVideoStart(); 685 }); 686 player.on("ended", () => { 687 this.handleVideoEndAction(); 688 }); 689 } else { 690 window.setTimeout(handleVimeo, timeout, timeout); 691 } 692 }; 693 handleVimeo(50); 694 } 695 getVideoSize() { 696 const videoRatio = 16 / 9; 697 let width, height; 698 let parentWidth, parentHeight; 699 let isHeightBiggerThanWidth = false;
700 if (this.styleType === "fill") { 701 width = "100%"; 702 height = "100%"; 703 } else { 704 const [paddingLeft] = $(this.parentElement).css("padding-left").split("px") ?? 0; 705 const [paddingRight] = $(this.parentElement).css("padding-right").split("px") ?? 0; 706 const [paddingTop] = $(this.parentElement).css("padding-top").split("px") ?? 0; 707 const [paddingBottom] = $(this.parentElement).css("padding-bottom").split("px") ?? 0; 708 const [borderWidth] = $(this.parentElement).css("border-width").split("px") ?? 0; 709 if (this.isPageBackground) { 710 parentWidth = $(window).width(); 711 parentHeight = $(window).height(); 712 } else { 713 parentWidth = Number($(this.parentElement).width()) + Number(paddingLeft) + Number(paddingRight) + Number(borderWidth); 714 parentHeight = Number($(this.parentElement).height()) + Number(paddingBottom) + Number(paddingTop) + Number(borderWidth); 715 } 716 if (parentWidth / videoRatio < parentHeight) { 717 isHeightBiggerThanWidth = true; 718 width = parentHeight * videoRatio; 719 height = parentHeight; 720 } else { 721 width = parentWidth; 722 height = parentWidth / videoRatio; 723 } 724 } 725 return [width, height, parentWidth, parentHeight, isHeightBiggerThanWidth]; 726 } 727 handleVideoResize() { 728 const element = this.element; 729 const parentElement = this.parentElement; 730 const iframe = $(element).find("iframe"); 731 const isPageBackground = this.isPageBackground; 732 const styleType = this.styleType; 733 const offsetY = this.offsetY; 734 const offsetX = this.offsetX; 735 const hideOnMobile = this.hideOnMobile === "true"; 736 const useBgAsOverlay = this.useBgAsOverlay === "true"; 737 const background = this.background; 738 if (!isPageBackground) { 739 $(element).css({ 740 position: "absolute", 741 overflow: "hidden" 742 }); 743 $(parentElement).css({ 744 position: "relative" 745 }); 746 } 747 const resizeVideo = () => { 748 if (!this.videoEnded) { 749 if ($(window).width() < 700 && hideOnMobile) { 750 $(element).css({ 751 display: "none" 752 }); 753 $(parentElement).css("background", background); 754 return; 755 } else { 756 $(element).css({ 757 display: "block" 758 }); 759 $(parentElement).css("background", "none"); 760 } 761 const videoRatio = 16 / 9; 762 const [width, height, parentWidth, parentHeight, isHeightBiggerThanWidth] = this.getVideoSize(); 763 const widthDiff = width - parentWidth; 764 const heightDiff = height - parentHeight; 765 if (styleType === "offset") { 766 const heightDiff2 = height - parentHeight; 767 const widthDiff2 = width - parentWidth; 768 const fixedOffsetX = widthDiff2 * offsetX / 100; 769 const fixedOffsetY = heightDiff2 * offsetY / 100; 770 if (isHeightBiggerThanWidth) { 771 iframe.width(width).height(height).css({ 772 "transform": `translateX(-${fixedOffsetX}px)`, 773 "pointer-events": "none" 774 }); 775 } else { 776 iframe.width(width).height(height).css({ 777 "transform": `translateY(-${fixedOffsetY}px)`, 778 "pointer-events": "none" 779 }); 780 } 781 } else { 782 iframe.width(width).height(height).css({ 783 background: "black", 784 "pointer-events": "none" 785 }); 786 } 787 } 788 }; 789 resizeVideo(); 790 window.addEventListener("resize", function() { 791 resizeVideo(); 792 }); 793 } 794 handleVideoEndAction() { 795 const element = this.element; 796 const parentElement = this.parentElement; 797 const endAction = this.endaction; 798 const redirectUrl = this.redirectUrl; 799 const redirectNewPage = this.redirectToNewPage === "true"; 800 const background = this.background; 801 if (endAction !== "loop") { 802 this.videoEnded = true; 803 $(element).css({ 804 display: "none" 805 }); 806 $(parentElement).css("background", background); 807 } 808 if (endAction === "redirect") { 809 if (redirectNewPage) { 810 window.open(redirectUrl, "_blank"); 811 } else { 812 window.location.href = redirectUrl; 813 } 814 } else if (endAction === "open-popup") { 815 globalThis.CFOpenPopup(); 816 } 817 } 818};
819registerComponent("VideoBackground/V1", VideoBackgroundV1); 820window["VideoBackgroundV1"] = VideoBackgroundV1; 821
822// projects/lib/packages/yggdrasil-blueprints/__generated__/blueprints/video-v1.ts 823init_define_process(); 824init_runtime(); 825var VideoV1 = class extends CF2Component { 826 constructor(el, runtimeSel) { 827 super(el, runtimeSel); 828 } 829 mount() { 830 video_player_starter_v1_default.setupVideo(this.element); 831 } 832}; 833registerComponent("Video/V1", VideoV1); 834window["VideoV1"] = VideoV1; 835
836// projects/lib/packages/yggdrasil-blueprints/__generated__/blueprints/video-v2.ts 837init_define_process(); 838init_runtime(); 839var VideoV2 = class extends CF2Component { 840 constructor(el, runtimeSel) { 841 super(el, runtimeSel); 842 } 843 mount() { 844 if (this.element.querySelector("video")) { 845 video_player_starter_v1_default.setupVideo(this.element); 846 } 847 } 848}; 849registerComponent("Video/V2", VideoV2); 850window["VideoV2"] = VideoV2; 851
852// projects/lib/packages/yggdrasil-blueprints/__generated__/blueprints/video-popup-v1.ts 853init_define_process(); 854init_modal_v1(); 855init_runtime(); 856var VideoPopupV1 = class extends CF2Component { 857 constructor(el, runtimeSel) { 858 super(el, runtimeSel); 859 } 860 mount() { 861 this.modal = this.getComponent("Modal/V1"); 862 this.video = this.getComponent("Video/V1"); 863 this.isVideoInitialized = false; 864 this.setupVideoPopupListenters(); 865 } 866 setupVideoPopupListenters() { 867 const isWistia = this.video.videoType === "wistia"; 868 const isVimeo = this.video.videoType === "vimeo"; 869 const isYoutube = this.video.videoType === "youtube"; 870 const isHTML5 = this.video.videoType === "html5"; 871 const isVoomly = this.video.videoType === "voomly"; 872 const isCustomScript = this.video.videoType === "custom_script"; 873 const popupImage = this.element.querySelector(".elImage"); 874 this.video.element.addEventListener("click", (evt) => { 875 evt.stopPropagation(); 876 }); 877 popupImage.addEventListener("click", () => { 878 this.modal.element.style.display = "flex"; 879 if (isHTML5 || isVoomly) { 880 const videoElement = this.video.element.querySelector("video"); 881 if (this.isVideoInitialized) { 882 videoElement.play(); 883 } else { 884 videoElement.addEventListener("loadeddata", () => { 885 videoElement.play(); 886 }); 887 this.isVideoInitialized = true; 888 } 889 } else if (isCustomScript) { 890 if (this.isVideoInitialized) { 891 const videoElement = this.video.element.querySelector("video"); 892 videoElement.play(); 893 } else { 894 const scriptElement = this.video.element.querySelector("script"); 895 scriptElement.setAttribute("src", scriptElement.getAttribute("data-src")); 896 this.isVideoInitialized = true; 897 const videoElement = this.video.element.querySelector("video"); 898 videoElement.addEventListener("loadeddata", () => { 899 videoElement.play(); 900 }); 901 } 902 } else { 903 const videoElement = this.video.element.querySelector("iframe"); 904 let src = videoElement.getAttribute("data-src"); 905 if (isYoutube) { 906 src = src.replace("autoplay=0", "mute=1&autoplay=1"); 907 } else if (isVimeo) { 908 src = src.replace("autoplay=0", "muted=1&autoplay=1"); 909 } else if (isWistia) { 910 src = src.replace("autoplay=0", "muted=true&autoplay=1"); 911 } 912 videoElement.setAttribute("src", src); 913 } 914 }); 915 this.modal.onClose = () => { 916 if (isHTML5 || isVoomly || isCustomScript) { 917 const videoElement = this.video.element.querySelector("video"); 918 videoElement.pause(); 919 videoElement.currentTime = 0; 920 } else { 921 const videoElement = this.video.element.querySelector("iframe"); 922 let src = videoElement.getAttribute("src"); 923 if (isYoutube) { 924 src = src.replace("mute=1&autoplay=1", "autoplay=0"); 925 } else if (isVimeo) { 926 src = src.replace("muted=1&autoplay=1", "autoplay=0"); 927 } else if (isWistia) { 928 src = src.replace("muted=true&autoplay=1", "autoplay=0"); 929 } 930 videoElement.setAttribute("src", src); 931 } 932 }; 933 } 934}; 935registerComponent("VideoPopup/V1", VideoPopupV1); 936window["VideoPopupV1"] = VideoPopupV1; 937//# sourceMappingURL=video-K6A2W3SE.js.map
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.