Skip to content

Commit

Permalink
Remove init video modal logic
Browse files Browse the repository at this point in the history
  • Loading branch information
parlough committed Jan 23, 2025
1 parent f44dc29 commit 67e748e
Showing 1 changed file with 0 additions and 41 deletions.
41 changes: 0 additions & 41 deletions src/content/assets/js/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,44 +60,6 @@ function switchBanner(galleryName) {
imgSelector.setAttribute('src', this.dataset.banner);
}

function initVideoModal() {
let videoModalObject = $('[data-video-modal]');
var player;

function onPlayerReady() {
videoModalObject.on('shown.bs.modal', function (event) {
if (player) {
let videoId = event.relatedTarget.dataset.video;
player.loadVideoById(videoId);
player.playVideo();
}
});

videoModalObject.on('hide.bs.modal', function (event) {
if (player) {
player.stopVideo();
}
});
}

if (videoModalObject.length > 0) {
// there is a video modal in the DOM, load the YouTube API
let tag = document.createElement('script');
tag.src = 'https://youtube.com/iframe_api';
let firstScriptTag = document.getElementsByTagName('script')[0];
firstScriptTag.parentNode.insertBefore(tag, firstScriptTag);

window.onYouTubeIframeAPIReady = function () {
player = new YT.Player('video-player', {
videoId: '5F-6n_2XWR8',
events: {
"onReady": onPlayerReady,
},
});
};
}
}

function adjustToc() {
// Adjustments to the jekyll-toc TOC.
var tocWrapper = $('#site-toc--side');
Expand Down Expand Up @@ -235,9 +197,6 @@ $(function() {
root.toggleClass('toc-collapsed');
});

// Initialize the video on the homepage, if it exists.
initVideoModal();

document.addEventListener('keydown', handleSearchShortcut);

createGallery(
Expand Down

0 comments on commit 67e748e

Please sign in to comment.