Katalogi
| Image | Title | Link |
|---|
document.addEventListener("DOMContentLoaded", function () {
document.querySelectorAll("tbody tr").forEach(row => {
const cells = row.querySelectorAll("td");
if (cells.length < 2) return;const linkCell = cells[1];
const pdfLink = linkCell.querySelector("a.cf-icon.icon-pdf");
if (!pdfLink) return;// Find the download wrapper div
const lastCell = cells[cells.length - 1];
const downloadWrapper = lastCell.querySelector(".cf-column-last");
if (!downloadWrapper) return;const downloadBtn = downloadWrapper.querySelector("a.btn-download");
if (!downloadBtn) return;// Avoid duplicate View button
if (downloadWrapper.querySelector(".view-btn")) return;// Create "View" link
const viewLink = document.createElement("a");
viewLink.href = pdfLink.href;
viewLink.className = "view-btn my-btn btn-download noLightbox";
viewLink.textContent = document.documentElement.lang === "fr" ? "Voir" : "View";
viewLink.style.marginRight = "10px"; // add space before Download// Open in popup
viewLink.addEventListener("click", function (e) {
e.preventDefault();
const screenW = window.innerWidth;
const screenH = window.innerHeight;
const width = Math.min(600, screenW - 40);
const height = Math.min(600, screenH - 80);
const left = (screenW / 2) - (width / 2);
const top = (screenH / 2) - (height / 2);window.open(this.href, "_blank", `width=${width},height=${height},top=${top},left=${left}`);
});// Insert View button before Download
downloadWrapper.insertBefore(viewLink, downloadBtn);
});
});