Skip to content

Commit

Permalink
alwaysDe → multipleLangs (changes default to alwaysDe)
Browse files Browse the repository at this point in the history
  • Loading branch information
Joshix-1 committed May 18, 2021
1 parent 3cb9212 commit 2275615
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion manifest.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"manifest_version": 2,
"name": "Vertauschte Woerter!",
"version": "1.1.0",
"version": "1.1.1",

"description": "Vertauscht Wörter auf Webseiten.",

Expand Down
2 changes: 1 addition & 1 deletion plugin/data.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
const languages = ["de", "en"];

const defaults = {
alwaysDe : false,
multipleLangs : false,
de:
`{
"aggressiv": "attraktiv",
Expand Down
4 changes: 2 additions & 2 deletions plugin/options.html
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@
<textarea id="text_input_en"></textarea>

<div>
<label for="always_replace_de">Nutze immer die deutschen Vertauschungen:</label>
<input type="checkbox" id="always_replace_de">
<label for="multiple-langs">Erlaube unterschiedliche Sprachen (sonst wird immer angenommen, dass der Text deutsch ist):</label>
<input type="checkbox" id="multiple-langs">
</div>

<div id="status"></div>
Expand Down
6 changes: 3 additions & 3 deletions plugin/options.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
const elements = [];
const alwaysReplaceDeCheckBox = document.getElementById("always_replace_de");
const multipleLangsCheckBox = document.getElementById("multiple-langs");

for (const lang of languages) {
elements.push(document.getElementById("text_input_" + lang));
Expand All @@ -10,7 +10,7 @@ function saveOptions() {
for (let i = 0; i < languages.length; i++) {
obj[languages[i]] = elements[i].value;
}
obj["alwaysDe"] = alwaysReplaceDeCheckBox.checked;
obj["multipleLangs"] = CheckBox.checked;
save(obj);
}

Expand Down Expand Up @@ -48,7 +48,7 @@ function restoreOptions() {
for (let i = 0; i < languages.length; i++) {
elements[i].value = items[languages[i]];
}
alwaysReplaceDeCheckBox.checked = items["alwaysDe"];
CheckBox.checked = items["multipleLangs"];
});
}

Expand Down
2 changes: 1 addition & 1 deletion plugin/plugin.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ let words;
const lang = stringToLanguage(document.getElementsByTagName("html")[0].lang);

chrome.storage.local.get(defaults, function(items) {
const langStr = items["alwaysDe"] ? "de" : getLanguageString();
const langStr = items["multipleLangs"] ? getLanguageString() : "de";
const defaultJson = defaults[langStr];

let json = JSON.parse(items[langStr].toLowerCase());
Expand Down

0 comments on commit 2275615

Please sign in to comment.