Fix PDF modal https and progress wording
This commit is contained in:
@@ -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');
|
||||
|
||||
Reference in New Issue
Block a user