Files
devplacepy/devplacepy/static/js/MediaGallery.js
T
retoor 7fc9b0f715 chore: add retoor header to all devplacepy source files and update style agent header rule
The diff adds the mandatory `retoor <retoor@molodetz.nl>` header comment to every `.py` file under `devplacepy/` (including `__init__.py` and `routers/__init__.py`), and updates the `StyleAgent` in `agents/style.py` to instruct agents to only add the header on created or already-edited files rather than sweeping the entire repo. The `agents/base.py` operating protocol is also revised to reorder and clarify tool discipline rules.
2026-06-11 23:58:46 +00:00

36 lines
1014 B
JavaScript

// retoor <retoor@molodetz.nl>
import { Http } from "./Http.js";
export class MediaGallery {
constructor() {
document.addEventListener("click", (e) => {
const btn = e.target.closest("[data-media-delete]");
if (!btn) return;
e.preventDefault();
this.remove(btn);
});
}
async remove(btn) {
const uid = btn.dataset.mediaDelete;
const tile = btn.closest("[data-media-tile]");
try {
await Http.send(`/media/${uid}/delete`);
if (tile) {
tile.classList.add("media-removing");
setTimeout(() => tile.remove(), 220);
}
if (window.app && window.app.toast) {
window.app.toast.show("Media deleted");
}
} catch (err) {
if (window.app && window.app.toast) {
window.app.toast.show(err.message, { type: "error" });
}
}
}
}
window.MediaGallery = MediaGallery;