Skip to content

Commit d5e4452

Browse files
committed
V13 changes
1 parent b6c7628 commit d5e4452

File tree

6 files changed

+19
-19
lines changed

6 files changed

+19
-19
lines changed

src/module.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@
1010
}
1111
],
1212
"compatibility": {
13-
"minimum": "12",
14-
"verified": "12"
13+
"minimum": "13",
14+
"verified": "13"
1515
},
1616
"esmodules": ["module/polyglot.js"],
1717
"scripts": ["lib/select2/select2.min.js"],

src/module/forms/GeneralSettings.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -208,8 +208,8 @@ export class PolyglotGeneralSettings extends FormApplication {
208208
let s = game.settings.settings.get(`polyglot.${k}`);
209209
let current = game.user.isGM ? game.settings.get(s.namespace, s.key) : game.user.getFlag("polyglot", k);
210210
if (v === current) continue;
211-
requiresClientReload ||= s.scope === "client" && s.requiresReload;
212-
requiresWorldReload ||= s.scope === "world" && s.requiresReload;
211+
requiresClientReload ||= (s.scope !== CONST.SETTING_SCOPES.WORLD) && s.requiresReload;
212+
requiresWorldReload ||= (s.scope === CONST.SETTING_SCOPES.WORLD) && s.requiresReload;
213213
if (game.user.isGM) {
214214
await game.settings.set(s.namespace, s.key, v);
215215
} else {

src/module/hooks.js

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -6,20 +6,22 @@ export default class PolyglotHooks {
66
static renderChatLog(chatlog, html, data) {
77
game.polyglot.renderChatLog = true;
88
const input = game.settings.get("polyglot", "displayCheckbox")
9-
? `<input name="polyglot-checkbox" type="checkbox" ${game.settings.get("polyglot", "checkbox") ? "checked" : ""}>`
9+
? `<input id="polyglot-checkbox" type="checkbox" ${game.settings.get("polyglot", "checkbox") ? "checked" : ""}>`
1010
: "";
11-
html.find("#chat-controls").after(
12-
`<div id='polyglot' class='polyglot polyglot-lang-select flexrow'>
13-
${input}
14-
<label>${game.i18n.localize("POLYGLOT.LanguageLabel")}</label>
15-
<select name='polyglot-language'></select>
16-
</div>`,
17-
);
18-
html.find(".polyglot-lang-select select").change((ev) => {
11+
const polyglotDiv = document.createElement("div");
12+
polyglotDiv.setAttribute("id", "polyglot");
13+
polyglotDiv.classList.add("polyglot", "polyglot-lang-select", "flexrow");
14+
polyglotDiv.innerHTML = `
15+
${input}
16+
<label for="polyglot-checkbox">${game.i18n.localize("POLYGLOT.LanguageLabel")}</label>
17+
<select name='polyglot-language'></select>
18+
`;
19+
html.querySelector(".chat-controls").insertAdjacentElement("afterend", polyglotDiv);
20+
html.querySelector(".polyglot-lang-select select").addEventListener("change", (ev) => {
1921
const lang = ev.target.value;
2022
game.polyglot.lastSelection = lang;
2123
});
22-
html.find("input[name='polyglot-checkbox']").change((ev) => {
24+
html.querySelector("input[id='polyglot-checkbox']").addEventListener("change", (ev) => {
2325
game.settings.set("polyglot", "checkbox", ev.target.checked);
2426
});
2527
game.polyglot.updateUserLanguages(html);

src/module/logic.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -305,7 +305,7 @@ export class Polyglot {
305305
options.sort((a, b) => a.text.localeCompare(b.text));
306306
}
307307

308-
const select = this.chatElement.find(".polyglot-lang-select select");
308+
const select = $(this.chatElement.querySelector(".polyglot-lang-select select"));
309309
const prevOption = select.val();
310310

311311
select.empty();

src/module/settings.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -216,7 +216,7 @@ export function registerSettings() {
216216
addMenuSetting("checkbox", {
217217
default: true,
218218
type: Boolean,
219-
scope: "client"
219+
scope: "user"
220220
});
221221

222222
Hooks.on("i18nInit", () => {

src/styles/_language-selector.scss

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,7 @@
44
align-items: center;
55
input {
66
margin-left: 0;
7-
&:checked {
8-
accent-color: rgb(255, 255, 245);
9-
}
7+
flex: 0;
108
}
119
label {
1210
flex: 0;

0 commit comments

Comments
 (0)