Skip to content

Commit

Permalink
Merge pull request #142 from quisquous/targetbars-nitpick
Browse files Browse the repository at this point in the history
Clean up targetbars code to use cleaner for loops
  • Loading branch information
ngld authored Jul 29, 2020
2 parents 232e077 + cdc4454 commit e4d3a2b
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions OverlayPlugin.Core/resources/targetbars/targetbars.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,9 +60,8 @@ const validKeys = ['None', ...rawKeys, ...otherKeys, ...targetOnlyKeys];
// Remove enmity from non-target keys.
const textOptionsNonTarget = (() => {
let options = {};
for (const lang in textOptionsAll) {
for (const [lang, perLang] of Object.entries(textOptionsAll)) {
options[lang] = {};
let perLang = textOptionsAll[lang];
for (const key in perLang) {
const value = perLang[key];
if (targetOnlyKeys.includes(value))
Expand Down Expand Up @@ -407,8 +406,7 @@ class BarUI {
right: this.options.rightText,
};

for (const justifyKey in textMap) {
let text = textMap[justifyKey];
for (const [justifyKey, text] of Object.entries(textMap)) {
if (!validKeys.includes(text)) {
console.error(`Invalid key: ${text}`);
continue;
Expand Down Expand Up @@ -727,11 +725,11 @@ class SettingsUI {

const optionsByType = opt.optionsByType ? opt.optionsByType[this.target] : opt.options;
const innerOptions = this.translate(optionsByType);
for (const key in innerOptions) {
for (const [key, value] of Object.entries(innerOptions)) {
let elem = document.createElement('option');
elem.value = innerOptions[key];
elem.value = value;
elem.innerHTML = key;
if (innerOptions[key] == defaultValue)
if (value === defaultValue)
elem.selected = true;
input.appendChild(elem);
}
Expand Down

0 comments on commit e4d3a2b

Please sign in to comment.