Skip to content

Commit 00257fc

Browse files
committed
fix: add element
1 parent 014bd47 commit 00257fc

2 files changed

Lines changed: 19 additions & 16 deletions

File tree

index.js

Lines changed: 18 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -70,21 +70,24 @@ class Plugin {
7070
}
7171

7272
addDropDown() {
73-
const list = document.querySelector('.extended-list-buttons');
74-
if (list) {
75-
const box = document.createElement('div');
76-
box.className = 'select-language-box';
77-
const select = document.createElement('select');
78-
select.className = 'select-language-dropdown';
79-
this.supportLanguages.forEach(({ value, text }) => {
80-
const option = document.createElement('option');
81-
option.value = value;
82-
option.textContent = text;
83-
select.append(option);
84-
});
85-
box.append(select);
86-
list.append(box);
87-
}
73+
const list = document.querySelectorAll('.extended-list-buttons');
74+
list.forEach((item) => {
75+
const input = item.querySelector('input[data-name="language"]');
76+
if (input) {
77+
const box = document.createElement('div');
78+
box.className = 'select-language-box';
79+
const select = document.createElement('select');
80+
select.className = 'select-language-dropdown';
81+
this.supportLanguages.forEach(({ value, text }) => {
82+
const option = document.createElement('option');
83+
option.value = value;
84+
option.textContent = text;
85+
select.append(option);
86+
});
87+
box.append(select);
88+
item.append(box);
89+
}
90+
})
8891
}
8992

9093
changeEvent() {

info.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "language",
3-
"version": "1.0.7",
3+
"version": "1.0.8",
44
"description": {
55
"zh_tw": "TREM-Lite Language Plugin"
66
},

0 commit comments

Comments
 (0)