2022-10-30 02:35:39 +00:00
|
|
|
<template>
|
2023-11-01 02:00:23 +00:00
|
|
|
<div class="modal is-active" v-if="active" @click="dismiss()">
|
2022-10-30 02:35:39 +00:00
|
|
|
<div class="modal-background" />
|
|
|
|
|
|
|
|
<div class="modal-content">
|
2023-09-06 18:44:19 +00:00
|
|
|
<template v-if="progress">
|
|
|
|
<progress class="progress is-primary" max="100" />
|
|
|
|
</template>
|
|
|
|
<template v-else>
|
2023-09-12 17:42:02 +00:00
|
|
|
<figure>
|
2023-09-14 03:36:42 +00:00
|
|
|
<figcaption class="tag is-primary">
|
2023-10-31 18:42:01 +00:00
|
|
|
{{ caption }}
|
2023-09-12 17:42:02 +00:00
|
|
|
</figcaption>
|
2023-09-20 22:03:32 +00:00
|
|
|
<div class="image is-square">
|
|
|
|
<img :src="image_src" alt="Kalender-Bild" />
|
|
|
|
</div>
|
2023-09-12 17:42:02 +00:00
|
|
|
</figure>
|
2023-09-06 18:44:19 +00:00
|
|
|
</template>
|
2022-10-30 02:35:39 +00:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script lang="ts">
|
2023-09-14 14:20:21 +00:00
|
|
|
import { Options, Vue } from "vue-class-component";
|
2022-10-30 02:35:39 +00:00
|
|
|
|
2023-09-14 14:20:21 +00:00
|
|
|
@Options({
|
|
|
|
emits: ["handle"],
|
|
|
|
})
|
2023-01-24 23:18:09 +00:00
|
|
|
export default class extends Vue {
|
2023-09-06 16:25:35 +00:00
|
|
|
public active = false;
|
2023-09-06 18:44:19 +00:00
|
|
|
public progress = false;
|
2022-12-21 23:51:01 +00:00
|
|
|
public image_src = "";
|
2023-10-31 18:42:01 +00:00
|
|
|
public caption = "";
|
2022-10-30 02:35:39 +00:00
|
|
|
|
2023-09-11 23:37:37 +00:00
|
|
|
private on_keydown(e: KeyboardEvent) {
|
2023-11-01 02:00:23 +00:00
|
|
|
if (e.key == "Escape") this.dismiss();
|
2023-09-11 23:37:37 +00:00
|
|
|
}
|
|
|
|
|
2023-09-14 14:20:21 +00:00
|
|
|
public created(): void {
|
|
|
|
this.$emit("handle", this);
|
|
|
|
}
|
|
|
|
|
2023-09-11 23:37:37 +00:00
|
|
|
public mounted(): void {
|
|
|
|
window.addEventListener("keydown", this.on_keydown);
|
|
|
|
}
|
|
|
|
|
|
|
|
public beforeUnmount(): void {
|
|
|
|
window.removeEventListener("keydown", this.on_keydown);
|
2022-10-30 02:35:39 +00:00
|
|
|
}
|
|
|
|
|
2023-11-01 02:00:23 +00:00
|
|
|
public show() {
|
|
|
|
this.active = true;
|
|
|
|
}
|
|
|
|
|
|
|
|
public hide() {
|
|
|
|
this.active = false;
|
|
|
|
}
|
|
|
|
|
|
|
|
public dismiss() {
|
2023-10-31 18:42:01 +00:00
|
|
|
// Cannot dismiss the "loading" screen
|
|
|
|
if (this.active && this.progress) return;
|
|
|
|
|
2023-11-01 02:00:23 +00:00
|
|
|
this.active = false;
|
2022-12-21 23:51:01 +00:00
|
|
|
}
|
|
|
|
|
2023-09-12 17:42:02 +00:00
|
|
|
public show_image(src: string, caption: string = "") {
|
2023-09-06 18:44:19 +00:00
|
|
|
this.progress = false;
|
2022-12-21 23:51:01 +00:00
|
|
|
this.image_src = src;
|
2023-10-31 18:42:01 +00:00
|
|
|
this.caption = caption;
|
2023-11-01 02:00:23 +00:00
|
|
|
this.show();
|
2022-10-30 02:35:39 +00:00
|
|
|
}
|
2023-09-06 18:44:19 +00:00
|
|
|
|
|
|
|
public show_progress() {
|
|
|
|
this.progress = true;
|
2023-11-01 02:00:23 +00:00
|
|
|
this.show();
|
2023-09-06 18:44:19 +00:00
|
|
|
}
|
2022-10-30 02:35:39 +00:00
|
|
|
}
|
|
|
|
</script>
|