Finished and tested adding import button

This commit is contained in:
ellimist25 2020-11-14 01:11:43 -05:00
parent 435c9e295f
commit c068ebff9a
2 changed files with 2 additions and 7 deletions

View file

@ -1281,20 +1281,17 @@ export default class CharacterImporter {
Actor.create(targetCharacter); Actor.create(targetCharacter);
} }
static addImportButton(){ static addImportButton(html){
console.log("Starting to add Import Character button...");
const header = $("#actors").find("header.directory-header"); const header = $("#actors").find("header.directory-header");
const search = $("#actors").children().find("div.header-search"); const search = $("#actors").children().find("div.header-search");
const newImportButtonDiv = $("#actors").children().find("div.header-actions").clone(); const newImportButtonDiv = $("#actors").children().find("div.header-actions").clone();
const newSearch = search.clone(); const newSearch = search.clone();
search.remove(); search.remove();
newImportButtonDiv.attr('id', 'character-sheet-import'); newImportButtonDiv.attr('id', 'character-sheet-import');
header.append(newImportButtonDiv); header.append(newImportButtonDiv);
newImportButtonDiv.children("button").remove(); newImportButtonDiv.children("button").remove();
newImportButtonDiv.append("<button class='create-entity'><i class='fas fa-upload'></i> Import Character</button>"); newImportButtonDiv.append("<button class='create-entity'><i class='fas fa-upload'></i> Import Character</button>");
newSearch.appendTo(header); newSearch.appendTo(header);
console.log("Finished adding new button!");
} }

View file

@ -42,8 +42,6 @@ import * as migrations from "./module/migration.js";
/* -------------------------------------------- */ /* -------------------------------------------- */
Hooks.once("init", function() { Hooks.once("init", function() {
console.log("Enabling Hooks debug");
CONFIG.debug.hooks = true;
console.log(`SW5e | Initializing Star Wars 5th Edition System\n${SW5E.ASCII}`); console.log(`SW5e | Initializing Star Wars 5th Edition System\n${SW5E.ASCII}`);
// Create a SW5E namespace within the game global // Create a SW5E namespace within the game global
@ -217,7 +215,7 @@ Hooks.on("getChatLogEntryContext", chat.addChatMessageContextOptions);
Hooks.on("renderChatLog", (app, html, data) => Item5e.chatListeners(html)); Hooks.on("renderChatLog", (app, html, data) => Item5e.chatListeners(html));
Hooks.on("renderChatPopout", (app, html, data) => Item5e.chatListeners(html)); Hooks.on("renderChatPopout", (app, html, data) => Item5e.chatListeners(html));
Hooks.on('getActorDirectoryEntryContext', Actor5e.addDirectoryContextOptions); Hooks.on('getActorDirectoryEntryContext', Actor5e.addDirectoryContextOptions);
Hooks.on("renderActorDirectory", CharacterImporter.addImportButton()); Hooks.on("renderActorDirectory", (app, html, data) => CharacterImporter.addImportButton(html));
// TODO I should remove this // TODO I should remove this
Handlebars.registerHelper('getProperty', function (data, property) { Handlebars.registerHelper('getProperty', function (data, property) {