Files
iptv-downloader/static/iptv.js
T

21 lines
842 B
JavaScript
Raw Normal View History

/* ── Shared IPTV downloader JS ──────────────────────────────── */
var BASE = (function(){
var m = window.location.pathname.match(/^(\/[^/]+)/);
return m ? m[1] : '';
})();
function filter(el) {
document.querySelectorAll('.card').forEach(function(c) {
c.style.display = c.textContent.toLowerCase().includes(el.value.toLowerCase()) ? '' : 'none';
});
}
function dlMov(id, title, ext, icon) {
if (!confirm('Download: ' + title + '?')) return;
fetch(BASE + '/api/download_movie', {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({id: id, title: title, ext: ext || 'mp4', cover_url: icon || ''})
}).then(function() { alert('Queued!'); location.href = BASE + '/downloads'; });
}