Fix PDF modal https and progress wording

This commit is contained in:
sas.fajri
2026-04-30 16:45:02 +07:00
parent 42f5bb745f
commit c358b71151
2 changed files with 16 additions and 3 deletions

View File

@@ -162,10 +162,23 @@
</div>
<script>
function normalizePdfUrl(rawUrl) {
try {
const u = new URL(rawUrl, window.location.origin);
if (window.location.protocol === 'https:' && u.protocol === 'http:') {
u.protocol = 'https:';
}
return u.toString();
} catch (_) {
return rawUrl;
}
}
function openPDFModal(url, name) {
document.getElementById('pdf-modal-frame').src = url;
const safeUrl = normalizePdfUrl(url);
document.getElementById('pdf-modal-frame').src = safeUrl;
document.getElementById('pdf-modal-title').textContent = name;
document.getElementById('pdf-modal-link').href = url;
document.getElementById('pdf-modal-link').href = safeUrl;
const modal = document.getElementById('pdf-modal');
modal.classList.remove('hidden');
modal.classList.add('flex');