So, since I've begun my Mordheim war band, I've dug out cast models from the
vaults to assemble and base. I've reread all the rules for Cauldron - a
beautiful, whimsical game by
-[HILL GIANT](https://mordheimer.net/docs/warbands/grade-1a-warbands/skaven-eshin#0--1-eshin-sorcerer){. .anchor} -
+[HILL GIANT](https://hillgiant.itch.io){. .anchor} -
and pulled together two new gangs for Ramshackle's
[Mini Gangs](https://shop.ramshacklegames.co.uk/home/680-preorder-mini-gangs-v2-book-and-pdf.html){. .anchor}.
I don't know what it is about me, but I'm flawed in this way, and I'm sure I'm
not alone. Big projects are fun but they can also be daunting.
-{. .image-med}
+{. .image-med data-caption=true}
## Palate Cleansers FTW
clean them up, base and prime them right away. This way I always have plenty of
models on hand, ready to paint.
-{. .image-med}
+{. .image-med data-caption=true}
I don't want to skip a hobby session because I'm feeling overwhelmed by my
current project. I'd rather grab a prepped model off the shelf. While I'll
function main() {
- var imageNodes = document.querySelectorAll("img.image-med");
- var images = [];
+ var imageNodes = document.querySelectorAll("img");
- imageNodes.forEach((image) => {
- images.push(new InteractiveImage(image));
- });
+ imageNodes.forEach((image) => new InteractiveImage(image));
}
class InteractiveImage {
+
+ static images = [];
constructor(imageElement) {
this.image = imageElement;
- this.addCaption();
+ if(this.image.dataset.caption == 'true' ) {
+ this.addCaption();
+ }
this.addEvents();
+
+ InteractiveImage.images.push(this.image);
}
addCaption() {
addEvents() {
this.image.addEventListener("click", (event) => {
- console.log(event.target);
+ var display = new ImageDisplay(event.target);
+ });
+ }
+}
+
+class ImageDisplay {
+
+ #overlayElem;
+ #figureElem;
+
+ constructor(imageElement) {
+ this.image = imageElement.cloneNode(true);
+
+ var overlay = this.overlay;
+ console.log(this);
+ }
+
+ get overlay() {
+ if (!this.#overlayElem) {
+ this.#overlayElem = document.createElement("div");
+ }
+
+ this.#overlayElem.setAttribute("class", "overlay");
+ this.#overlayElem.addEventListener("click", (event) => {
+ this.#overlayElem.remove();
});
+
+ this.#figureElem = document.createElement("figure");
+ this.#figureElem.appendChild(this.image);
+ this.#overlayElem.appendChild(this.#figureElem);
+
+ document.body.appendChild(this.#overlayElem);
+
+ return this.#overlayElem;
}
}