Files
rush-character-archive-foun…/scripts/index.js
2025-07-12 17:27:05 -07:00

56 lines
1.3 KiB
JavaScript

import { initializeSettings } from "./settings.js";
import { CharacterArchiver } from "./apps/CharacterArchiver.js"
Hooks.on('init', async function () {
initializeSettings();
console.log("HERE");
let xmlHttp = new XMLHttpRequest();
console.log("HERE 1");
xmlHttp.open("GET", "http://localhost:8080", false);
console.log("HERE 2");
xmlHttp.send(null);
console.log("HERE 3");
console.log(xmlHttp.responseText);
console.log("HERE 4");
});
// Add to the character sheet header bar.
Hooks.on("getActorSheetHeaderButtons", (app, buttons) => {
let theatreButtons = [];
theatreButtons.push({
label: "Archive",
class: "send-to-archive",
icon: "fas fa-save",
onclick: (ev) => {
new CharacterArchiver().render(true);
console.log("ARCHIVE ME!");
}
});
buttons.unshift(...theatreButtons);
});
// Add to the character context menu.
Hooks.on("getActorDirectoryEntryContext", async (html, options) => {
const getActorData = (target) => {
return game.actors.get(target.data("documentId"));
};
options.splice(
3,
0,
{
name: "Archive",
icon: '<i class="fas fa-save"></i>',
callback: (target) => {
new CharacterArchiver().render(true);
},
},
);
});