Skip to content

Commit

Permalink
1.3.29
Browse files Browse the repository at this point in the history
  • Loading branch information
Dorako committed Jul 16, 2022
1 parent 3b33ac1 commit db86231
Show file tree
Hide file tree
Showing 4 changed files with 69 additions and 97 deletions.
4 changes: 2 additions & 2 deletions module.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@
"description": "Overhauls the Foundry UI and several modules.",
"url": "https://github.com/Dorako/pf2e-dorako-ui",
"author": "Dorako",
"version": "1.3.28",
"version": "1.3.29",
"minimumCoreVersion": "9",
"compatibleCoreVersion": "9",
"system": ["pf2e"],
"scripts": ["scripts/dorako-ui.js"],
"templates": ["templates/*"],
"download": "https://github.com/Dorako/pf2e-dorako-ui/archive/refs/tags/v1.3.28.zip",
"download": "https://github.com/Dorako/pf2e-dorako-ui/archive/refs/tags/v1.3.29.zip",
"manifest": "https://github.com/Dorako/pf2e-dorako-ui/raw/main/module.json"
}
150 changes: 62 additions & 88 deletions scripts/dorako-ui.js
Original file line number Diff line number Diff line change
Expand Up @@ -209,19 +209,35 @@ Hooks.once("init", async function () {
}
}

let sizeClass = "";
const border = game.settings.get("pf2e-dorako-ui", "chat-portrait-border");
const popoutTokenPortraits = game.settings.get(
"pf2e-dorako-ui",
"popout-token-portraits"
);
if (!border && popoutTokenPortraits) {
const tk = canvas.tokens?.get(message.speaker.token);
const scale = tk?.data.scale;
if (scale >= 1.5) {
sizeClass = "scale-up ";
}
}

const main = game.settings.get("pf2e-dorako-ui", "insertSpeakerImage");
if (main === "token") {
return (
(combatantImg ? "combatant" : "") ||
(tokenImg ? "token" : "") ||
(actorImg ? "actor" : "")
sizeClass +
((combatantImg ? "combatant" : "") ||
(tokenImg ? "token" : "") ||
(actorImg ? "actor" : ""))
);
}
if (main === "actor") {
return (
(combatantImg ? "combatant" : "") ||
(actorImg ? "actor" : "") ||
(tokenImg ? "token" : "")
sizeClass +
((combatantImg ? "combatant" : "") ||
(actorImg ? "actor" : "") ||
(tokenImg ? "token" : ""))
);
}
return "no-img";
Expand All @@ -238,8 +254,17 @@ Hooks.once("init", async function () {
"hideGmIconWhenSecret"
);

const hidePortraitWhenHidden = game.settings.get(
"pf2e-dorako-ui",
"hidePortraitWhenHidden"
);

if (chatPortraitSetting === "none") return false;

const tk = canvas.tokens?.get(message.speaker.token);
const isHidden = tk?.data.hidden;
if (hidePortraitWhenHidden && isHidden) return false;

const whisperTargets = message.whisper;

const isBlind = message.blind || false;
Expand Down Expand Up @@ -423,7 +448,7 @@ Hooks.once("init", async function () {

game.settings.register("pf2e-dorako-ui", "hideGmIconWhenSecret", {
name: "Hide chat portrait when secret?",
hint: "Hide the chat portrait whenever GM rolls secret/private rolls.",
hint: "Hides the chat portrait whenever GM rolls secret/private rolls.",
scope: "world",
config: true,
default: true,
Expand All @@ -433,9 +458,21 @@ Hooks.once("init", async function () {
},
});

game.settings.register("pf2e-dorako-ui", "hidePortraitWhenHidden", {
name: "Hide chat portrait when token hidden?",
hint: "Hides the chat portrait whenever the token of the speaker is hidden",
scope: "client",
type: Boolean,
default: true,
config: true,
onChange: () => {
debouncedReload();
},
});

game.settings.register("pf2e-dorako-ui", "chat-portrait-size", {
name: "Chat portrait size",
hint: "Suggested size of 36px.",
hint: "Suggested size of 40px.",
scope: "client",
type: Number,
default: 40,
Expand All @@ -450,6 +487,18 @@ Hooks.once("init", async function () {
},
});

game.settings.register("pf2e-dorako-ui", "popout-token-portraits", {
name: "Chat portrait token popout",
hint: "Scales the chat portraits of BB/AV-style tokens to allow for 'pop out'.",
scope: "client",
type: Boolean,
default: true,
config: true,
onChange: () => {
debouncedReload();
},
});

game.settings.register("pf2e-dorako-ui", "chat-portrait-border", {
name: "... and add a border?",
hint: "Disable if your token art is fancy.",
Expand Down Expand Up @@ -589,23 +638,6 @@ Hooks.once("init", async function () {
},
});

// game.settings.register("pf2e-dorako-ui", "primary-color", {
// name: "Primary color overwrite",
// hint: "Default is Red",
// scope: "client",
// config: true,
// type: String,
// default: "#FF0000",
// onChange: () => refresh()
// });

// const colorInput = window.document.createElement("input");
// colorInput.setAttribute("type", "color");
// colorInput.setAttribute("value", html.find(`input[name="primary-color"]`).val());
// colorInput.setAttribute("data-edit", `${prefix}.monoVisionColor`);

// html.find(`input[name="${prefix}.monoVisionColor"]`).after(colorInput);

game.settings.register("pf2e-dorako-ui", "disable-all-styles", {
name: "Disable all styles?",
hint: "Ignore all the toggles and removes any effect of the module, without having to disable it.",
Expand Down Expand Up @@ -837,8 +869,6 @@ Hooks.once("init", async function () {
"--edge-margin",
game.settings.get("pf2e-dorako-ui", "edge-offset").toString() + "px"
);
// var sheet = document.styleSheets[0];
// sheet.insertRule(":root{--chat-portrait-size: "+game.settings.get('pf2e-dorako-ui', 'chat-portrait-size').toString()+'px}');

root.setProperty(
"--chat-portrait-size",
Expand Down Expand Up @@ -876,11 +906,11 @@ Hooks.once("init", async function () {
injectCSS("dice-tray");
let headerStyle = game.settings.get("pf2e-dorako-ui", "headerStyle");
if (headerStyle == "tint" || headerStyle == "red") {
enableRedHeader();
injectCSS("header-red");
} else if (headerStyle == "blue") {
enableBlueHeader();
injectCSS("header-blue");
} else if (headerStyle == "none") {
// padding-bottom: 0px;
// do nothing
}

if (game.settings.get("pf2e-dorako-ui", "skin-combat-carousel"))
Expand All @@ -890,9 +920,9 @@ Hooks.once("init", async function () {
if (theme == "light") {
// do nothing
} else if (theme == "dark") {
enableDarkTheme();
injectCSS("chat-dark");
} else if (theme == "rainbow") {
enableRainbowTheme();
injectCSS("chat-rainbow");
}
setting = game.settings.get("pf2e-dorako-ui", "rolltype-indication");
if (setting == "both" || setting == "bg-color")
Expand All @@ -910,7 +940,6 @@ Hooks.once("init", async function () {
if (setting == "dark" || setting == "darkRedHeader")
injectCSS("familiar-sheet-dark");
if (setting == "darkRedHeader") injectCSS("familiar-sheet-dark-red-header");
// if (setting == "plain") injectCSS("sheet-plain");
}
});

Expand All @@ -933,58 +962,3 @@ function injectCSS(filename) {
mainCss.setAttribute("media", "all");
head.insertBefore(mainCss, head.lastChild);
}

function injectBaseCss() {
const head = document.getElementsByTagName("head")[0];
const mainCss = document.createElement("link");
mainCss.setAttribute("rel", "stylesheet");
mainCss.setAttribute("type", "text/css");
mainCss.setAttribute("href", "modules/pf2e-dorako-ui/styles/dorako-ui.css");
mainCss.setAttribute("media", "all");
head.insertBefore(mainCss, head.lastChild);
}

// Chat cards
function enableRedHeader() {
const head = document.getElementsByTagName("head")[0];
const newCss = document.createElement("link");
newCss.setAttribute("rel", "stylesheet");
newCss.setAttribute("type", "text/css");
newCss.setAttribute("href", "modules/pf2e-dorako-ui/styles/header-red.css");
newCss.setAttribute("media", "all");
head.insertBefore(newCss, head.lastChild);
}

function enableBlueHeader() {
const head = document.getElementsByTagName("head")[0];
const newCss = document.createElement("link");
newCss.setAttribute("rel", "stylesheet");
newCss.setAttribute("type", "text/css");
newCss.setAttribute("href", "modules/pf2e-dorako-ui/styles/header-blue.css");
newCss.setAttribute("media", "all");
head.insertBefore(newCss, head.lastChild);
}

function enableDarkTheme() {
const head = document.getElementsByTagName("head")[0];
const newCss = document.createElement("link");
newCss.setAttribute("rel", "stylesheet");
newCss.setAttribute("type", "text/css");
newCss.setAttribute("href", "modules/pf2e-dorako-ui/styles/chat-dark.css");
newCss.setAttribute("media", "all");
head.insertBefore(newCss, head.lastChild);
}

function enableRainbowTheme() {
const head = document.getElementsByTagName("head")[0];
const newCss = document.createElement("link");
newCss.setAttribute("rel", "stylesheet");
newCss.setAttribute("type", "text/css");
newCss.setAttribute("href", "modules/pf2e-dorako-ui/styles/chat-rainbow.css");
newCss.setAttribute("media", "all");
head.insertBefore(newCss, head.lastChild);
}

//const actor = game.scenes.get(speaker.scene)?.tokens?.get(speaker.token);
// const tokens = actor.getActiveTokens(true, false);
// const token = tokens.first();
10 changes: 4 additions & 6 deletions styles/chat.css
Original file line number Diff line number Diff line change
Expand Up @@ -407,13 +407,7 @@ button {
}

.message .message-header .message-sender {
/* font-size: small;
font-weight: 400; */
grid-: sender;
/* align-items: center; */
display: flex;

/* border-radius: 5px 0px 0px 0px; */
}


Expand Down Expand Up @@ -668,6 +662,10 @@ message-content .chat-damage-buttons button {
border-radius: 3px;
}

.portrait.token.scale-up {
transform: scale(1.5);
}


/* Adds border around flavor text */
/* .flavor-text {
Expand Down
2 changes: 1 addition & 1 deletion styles/no-logo.css
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
#logo {
display: none;
display: none !important;
}

0 comments on commit db86231

Please sign in to comment.