'use strict'; (function(){ function h(el, attrs={}, children=[]) { const e = document.createElement(el); for (const [k,v] of Object.entries(attrs||{})) { if (k === 'class') e.className = v; else if (k === 'html') e.innerHTML = v; else e.setAttribute(k, v); } for (const c of (children||[])) e.appendChild(c); return e; } function ytUrl(videoId){ return 'https://www.youtube.com/watch?v=' + videoId; } function renderFeatured(v) { const article = h('article', {class: 'post format-video has-post-thumbnail hentry'}); const wrap = h('div', {class: 'lte-wrapper'}); const a = h('a', {href: ytUrl(v.video_id), target: '_blank', class: 'lte-photo lte-video-popup swipebox'}); const img = h('img', {loading: 'lazy', decoding: 'async', width: '1600', height: '969', src: v.thumbnail_url, class: 'attachment-full size-full wp-post-image', alt: ''}); const iconWrap = h('span', {class: 'lte-icon-video'}); iconWrap.appendChild(h('ion-icon', {name: 'play-circle-outline', size: 'large'})); iconWrap.appendChild(h('span', {html: v.length || ''})); a.appendChild(img); a.appendChild(iconWrap); wrap.appendChild(a); const descr = h('div', {class: 'lte-description'}); const dateTop = h('span', {class: 'lte-date-top'}); const dateA = h('a', {href: '', class: 'lte-date'}); dateA.appendChild(h('span', {class: 'dt', html: v.published_text || v.published_date || ''})); dateTop.appendChild(dateA); const headerA = h('a', {href: ytUrl(v.video_id), class: 'lte-header', target: '_blank'}); headerA.appendChild(h('h3', {html: v.title || ''})); descr.appendChild(dateTop); descr.appendChild(headerA); // keep layout spacing consistent descr.appendChild(h('div', {class: 'lte-excerpt'})); article.appendChild(wrap); article.appendChild(descr); return article; } function renderGridItem(v){ const col = h('div', {class: 'items col-xl-6 col-lg-6 col-md-6 col-sm-6 col-ms-12 col-xs-12'}); const article = h('article', {class: 'post format-video has-post-thumbnail hentry'}); const wrap = h('div', {class: 'lte-wrapper'}); const a = h('a', {href: ytUrl(v.video_id), target: '_blank', class: 'lte-photo lte-video-popup swipebox'}); const img = h('img', {loading: 'lazy', decoding: 'async', width: '1600', height: '969', src: v.thumbnail_url, class: 'attachment-full size-full wp-post-image', alt: ''}); const iconWrap = h('span', {class: 'lte-icon-video'}); iconWrap.appendChild(h('ion-icon', {name: 'play-circle-outline', size: 'large'})); iconWrap.appendChild(h('span', {html: v.length || ''})); a.appendChild(img); a.appendChild(iconWrap); wrap.appendChild(a); const descr = h('div', {class: 'lte-description'}); const dateTop = h('span', {class: 'lte-date-top'}); const dateA = h('a', {href: '', class: 'lte-date'}); dateA.appendChild(h('span', {class: 'dt', html: v.published_text || v.published_date || ''})); dateTop.appendChild(dateA); const headerA = h('a', {href: ytUrl(v.video_id), class: 'lte-header', target: '_blank'}); headerA.appendChild(h('h3', {html: v.title || ''})); descr.appendChild(dateTop); descr.appendChild(headerA); // keep layout spacing consistent descr.appendChild(h('div', {class: 'lte-excerpt'})); article.appendChild(wrap); article.appendChild(descr); col.appendChild(article); return col; } async function loadVideos(){ const featureMount = document.getElementById('latest-video-feature'); const gridMount = document.getElementById('latest-videos-grid'); if (!featureMount && !gridMount) return; if (featureMount) featureMount.innerHTML = '