Skip to content

Commit

Permalink
fix: add element
Browse files Browse the repository at this point in the history
  • Loading branch information
cstrikeasia committed Dec 3, 2024
1 parent 014bd47 commit 00257fc
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 16 deletions.
33 changes: 18 additions & 15 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -70,21 +70,24 @@ class Plugin {
}

addDropDown() {
const list = document.querySelector('.extended-list-buttons');
if (list) {
const box = document.createElement('div');
box.className = 'select-language-box';
const select = document.createElement('select');
select.className = 'select-language-dropdown';
this.supportLanguages.forEach(({ value, text }) => {
const option = document.createElement('option');
option.value = value;
option.textContent = text;
select.append(option);
});
box.append(select);
list.append(box);
}
const list = document.querySelectorAll('.extended-list-buttons');
list.forEach((item) => {
const input = item.querySelector('input[data-name="language"]');
if (input) {
const box = document.createElement('div');
box.className = 'select-language-box';
const select = document.createElement('select');
select.className = 'select-language-dropdown';
this.supportLanguages.forEach(({ value, text }) => {
const option = document.createElement('option');
option.value = value;
option.textContent = text;
select.append(option);
});
box.append(select);
item.append(box);
}
})
}

changeEvent() {
Expand Down
2 changes: 1 addition & 1 deletion info.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "language",
"version": "1.0.7",
"version": "1.0.8",
"description": {
"zh_tw": "TREM-Lite Language Plugin"
},
Expand Down

0 comments on commit 00257fc

Please sign in to comment.