Skip to content

Commit

Permalink
Only display warning message when opening tokenizer
Browse files Browse the repository at this point in the history
  • Loading branch information
MrPrimate committed Apr 8, 2021
1 parent 67b8c18 commit 69e658e
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions src/hooks.js
Original file line number Diff line number Diff line change
Expand Up @@ -82,13 +82,8 @@ export function ready() {

// register tokenizer on all character (npc and pc) sheets
sheetNames.forEach(sheetName => {
Hooks.once("render" + sheetName, (app, html, data) => {
if (!game.user || !game.user.can("FILES_UPLOAD")) {
ui.notifications.info(game.i18n.localize("vtta-tokenizer.requires-upload-permission"));
}
});
Hooks.on("render" + sheetName, (app, html, data) => {
if (game.user && game.user.can("FILES_UPLOAD")) {
if (game.user) {
const SUPPORTED_PROFILE_IMAGE_CLASSES = ["sheet-profile", "profile", "profile-img", "player-image"];

$(html)
Expand All @@ -100,6 +95,9 @@ export function ready() {
// replace it with Tokenizer OR FilePicker click
$(element).on("click", event => {
if (!event.shiftKey) {
if (!game.user.can("FILES_UPLOAD")) {
ui.notifications.warn(game.i18n.localize("vtta-tokenizer.requires-upload-permission"));
}
event.stopPropagation();
let tokenizer = new Tokenizer({}, app.entity);
tokenizer.render(true);
Expand Down

0 comments on commit 69e658e

Please sign in to comment.