MCPcopy Create free account
hub / github.com/Vishal-raj-1/Awesome-JavaScript-Projects / createVideoTemplate

Function createVideoTemplate

assets/js/TrailerApp.js:105–126  ·  view source on GitHub ↗
(data, content)

Source from the content-addressed store, hash-verified

103});
104
105function createVideoTemplate(data, content) {
106 content.innerHTML =
107 '<p id="content-close"><i class="fas fa-times-circle"></i></p>';
108 const videos = data.results;
109 if (videos.length > 0) {
110 console.log('Videos:', videos);
111 const length = videos.length > 4 ? 4 : videos.length;
112 const iframeContainer = document.createElement('div');
113 for (let i = 0; i < length; i++) {
114 const video = videos[i];
115 const iframe = createIframe(video);
116 iframeContainer.appendChild(iframe);
117 content.appendChild(iframeContainer);
118 }
119 } else {
120 console.log('No trailer');
121 const noTrailer = document.createElement('h2');
122 noTrailer.setAttribute('class', 'notrail');
123 noTrailer.innerText = 'Sorry trailer not available 😢';
124 content.appendChild(noTrailer);
125 }
126}
127
128document.addEventListener('click', (e) => {
129 if (e.target.tagName === 'IMG') {

Callers 1

TrailerApp.jsFile · 0.85

Calls 1

createIframeFunction · 0.85

Tested by

no test coverage detected