first deployment of kikomiko with url photos
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
co-authored by
Cursor
parent
8d98304137
commit
ae3ed7c7b7
Vendored
+52
@@ -0,0 +1,52 @@
|
||||
import { ensureEurRate } from "/js/fx.js?v=fx1";
|
||||
|
||||
function ensureFooterEurRate() {
|
||||
const enamad = document.querySelector(".footer-enamad");
|
||||
if (!enamad) return;
|
||||
|
||||
let el = document.querySelector("[data-footer-eur-rate]");
|
||||
if (!el) {
|
||||
el = document.createElement("p");
|
||||
el.className = "footer-eur-live";
|
||||
el.setAttribute("data-footer-eur-rate", "");
|
||||
el.innerHTML =
|
||||
'نرخ یورو (بازار آزاد): <strong data-eur-rate-display>…</strong> تومان';
|
||||
enamad.insertAdjacentElement("afterend", el);
|
||||
} else if (!el.querySelector("[data-eur-rate-display]")) {
|
||||
el.innerHTML =
|
||||
'نرخ یورو (بازار آزاد): <strong data-eur-rate-display>…</strong> تومان';
|
||||
}
|
||||
|
||||
void ensureEurRate();
|
||||
}
|
||||
|
||||
export function initFooter() {
|
||||
const cols = document.querySelectorAll("[data-footer-col]");
|
||||
if (cols.length) {
|
||||
const mq = window.matchMedia("(min-width: 768px)");
|
||||
const sync = () => {
|
||||
cols.forEach((el) => {
|
||||
if (mq.matches) el.setAttribute("open", "");
|
||||
else el.removeAttribute("open");
|
||||
});
|
||||
};
|
||||
sync();
|
||||
mq.addEventListener("change", sync);
|
||||
}
|
||||
|
||||
ensureFooterEurRate();
|
||||
|
||||
const form = document.querySelector("[data-footer-newsletter]");
|
||||
if (!form) return;
|
||||
const status = form.querySelector("[data-footer-newsletter-status]");
|
||||
form.addEventListener("submit", (event) => {
|
||||
event.preventDefault();
|
||||
const input = form.querySelector('input[type="email"]');
|
||||
if (!(input instanceof HTMLInputElement) || !input.value.trim()) return;
|
||||
if (status instanceof HTMLElement) {
|
||||
status.hidden = false;
|
||||
status.textContent = "ثبت شد — ممنون از عضویت شما.";
|
||||
}
|
||||
input.value = "";
|
||||
});
|
||||
}
|
||||
Reference in New Issue
Block a user