Skip to content

Commit 24226d5

Browse files
committed
Fix saving options
Fix #67
1 parent 9532849 commit 24226d5

File tree

2 files changed

+7
-6
lines changed

2 files changed

+7
-6
lines changed

manifest.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"name": "__MSG_extensionName__",
55
"description": "__MSG_extensionDescription__",
66
"author": "Andreas Bielawski",
7-
"version": "3.4.3",
7+
"version": "3.4.4",
88
"icons": {
99
"16": "icons/16.png",
1010
"32": "icons/32.png",

options/options.js

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ function createSpNameElement(text) {
122122
function createSpIconElement(src) {
123123
// <span class="sp-icon input-group-prepend">
124124
// <div class="input-group-text">
125-
// <img src=""/>
125+
// <img class="icon" src=""/>
126126
// </div>
127127
// </span>
128128
const span = $el('span');
@@ -132,6 +132,7 @@ function createSpIconElement(src) {
132132
div.classList.add('input-group-text');
133133

134134
const iconImg = new Image();
135+
iconImg.classList.add('icon');
135136
iconImg.src = chrome.extension.getURL(src);
136137

137138
div.appendChild(iconImg);
@@ -207,7 +208,7 @@ function createSpCheckboxElement(selected) {
207208
// <span class="sp-selected input-group-prepend form-check">
208209
// <div class="input-group-text">
209210
// <label class="form-check-label custom-control">
210-
// <input class="form-check-input" type="checkbox" />
211+
// <input class="form-check-input active" type="checkbox" />
211212
// </label>
212213
// </div>
213214
// </span>
@@ -224,7 +225,7 @@ function createSpCheckboxElement(selected) {
224225
div.appendChild(label);
225226

226227
input = document.createElement('input');
227-
input.classList.add('form-check-input');
228+
input.classList.add('form-check-input', 'active');
228229
input.setAttribute('type', 'checkbox');
229230
if (selected) {input.checked = true;} else {input.checked = false;}
230231
label.appendChild(input);
@@ -328,8 +329,8 @@ saveOptions.onclick = () => {
328329

329330
for (const li of searchProviderList.children) {
330331
const index = Array.from(searchProviderList.children).indexOf(li) + 1;
331-
const selected = li.children[0].firstElementChild.firstElementChild.checked;
332-
const icon = li.children[1].firstElementChild.src.replace(extensionUUID, '');
332+
const selected = li.children[0].getElementsByClassName('active')[0].checked;
333+
const icon = li.children[1].getElementsByClassName('icon')[0].src.replace(extensionUUID, '');
333334
const name = li.children[2].value;
334335
const url = li.children[3].value;
335336

0 commit comments

Comments
 (0)