fix(shorts): wire shortOpenComments / shortCloseComments

Previous commit added the HTML + CSS for the comments pane but the JS
handlers only landed in the first (markup) Edit. This drops the two
window.short*Comments functions into the IIFE so the onclick handlers
in the markup actually resolve.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
This commit is contained in:
ghassanandClaude Opus 4.7 committed 2026-10-21 12:34:15 +03:00
1 parent 59513f2051
commit 45505e6419
1 file changed
+31
+31
View File
@@ -658,6 +658,37 @@
@endauth @endauth
}; };
// ── Comments pane ──────────────────────────────────────
window.shortOpenComments = function(videoKey) {
const pane = document.getElementById('shortsCommentsPane');
const backdrop = document.getElementById('shortsCommentsBackdrop');
const body = document.getElementById('shortsCommentsBody');
if (!pane || !body) return;
body.innerHTML = '<div class="shorts-comments-loading">Loading…</div>';
pane.classList.add('visible');
pane.setAttribute('aria-hidden', 'false');
backdrop?.classList.add('visible');
fetch('/videos/' + videoKey, {
headers: { 'X-Requested-With': 'XMLHttpRequest' },
credentials: 'same-origin'
})
.then(r => r.text())
.then(html => {
const doc = new DOMParser().parseFromString(html, 'text/html');
const section = doc.getElementById('ytcSection');
if (section) { body.innerHTML = ''; body.appendChild(section); }
else { body.innerHTML = '<div class="shorts-comments-loading">Comments unavailable.</div>'; }
})
.catch(() => { body.innerHTML = '<div class="shorts-comments-loading">Could not load comments.</div>'; });
};
window.shortCloseComments = function() {
const pane = document.getElementById('shortsCommentsPane');
const backdrop = document.getElementById('shortsCommentsBackdrop');
pane?.classList.remove('visible');
pane?.setAttribute('aria-hidden', 'true');
backdrop?.classList.remove('visible');
};
// ── Share ────────────────────────────────────────────────── // ── Share ──────────────────────────────────────────────────
window.shortShare = function(videoKey, title) { window.shortShare = function(videoKey, title) {
const url = window.location.origin + '/videos/' + videoKey; const url = window.location.origin + '/videos/' + videoKey;