Fix PDF modal https and progress wording
This commit is contained in:
@@ -36,7 +36,7 @@
|
|||||||
<article class="card p-5">
|
<article class="card p-5">
|
||||||
<p class="text-xs font-semibold uppercase tracking-widest text-slate-400">Published</p>
|
<p class="text-xs font-semibold uppercase tracking-widest text-slate-400">Published</p>
|
||||||
<p class="num mt-2 text-3xl font-semibold text-brand-500">{{.Summary.Published}}</p>
|
<p class="num mt-2 text-3xl font-semibold text-brand-500">{{.Summary.Published}}</p>
|
||||||
<p class="mt-1 text-xs text-slate-400">Hasil sudah dikirim ke peserta</p>
|
<p class="mt-1 text-xs text-slate-400">Hasil sudah diupload</p>
|
||||||
</article>
|
</article>
|
||||||
</section>
|
</section>
|
||||||
|
|
||||||
|
|||||||
@@ -162,10 +162,23 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<script>
|
<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) {
|
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-title').textContent = name;
|
||||||
document.getElementById('pdf-modal-link').href = url;
|
document.getElementById('pdf-modal-link').href = safeUrl;
|
||||||
const modal = document.getElementById('pdf-modal');
|
const modal = document.getElementById('pdf-modal');
|
||||||
modal.classList.remove('hidden');
|
modal.classList.remove('hidden');
|
||||||
modal.classList.add('flex');
|
modal.classList.add('flex');
|
||||||
|
|||||||
Reference in New Issue
Block a user