generated from typhonjs-fvtt-demo/template-svelte-esm
/
ArchiveApplication.js
58 lines (49 loc) · 1.26 KB
/
ArchiveApplication.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
import { SvelteApplication } from "#runtime/svelte/application";
import ArchiveShell from "./ArchiveShell.svelte";
export default class ArchiveApplication extends SvelteApplication {
static get defaultOptions() {
return foundry.utils.mergeObject(super.defaultOptions, {
title: "vauxs-archives.title", // Automatically localized from `lang/en.json`.
id: "vauxs-archive",
width: 900,
height: 600,
headerIcon: "modules/vauxs-archives/assets/Face16px.gif",
resizable: true,
svelte: {
class: ArchiveShell,
target: document.body,
},
});
}
_getHeaderButtons() {
const buttons = super._getHeaderButtons();
buttons.unshift({
icon: "fas fa-mug-hot ko-fi",
label: "vauxs-archives.support",
onclick: () => {
window.open("https://ko-fi.com/mrvauxs", "_blank");
},
});
return buttons;
}
}
let archiveMenu;
/**
* Opens the archive menu.
*
* @returns {ArchiveApplication} The archive menu instance.
*/
export function openArchive() {
archiveMenu = archiveMenu ? archiveMenu : new ArchiveApplication();
archiveMenu.render(true, { focus: true });
return archiveMenu;
}
export class ArchiveShim extends FormApplication {
constructor(options = {}) {
super({}, options);
openArchive();
}
render() {
this.close();
}
}