Skip to content

Commit acbced7

Browse files
committed
Add handling for editing the base url
1 parent cbfe168 commit acbced7

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

extension/options/js/options.js

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,7 @@ function addFilterSuggestionDiv(setFocusOnAdd = false) {
7979

8080
function setInitialState() {
8181
chrome.storage.sync.get({
82+
baseUrl: "https://www.stackoverflow.com/search?q=",
8283
shouldOpenInSameTab: true,
8384
questionsWithCodeFilter: false,
8485
communityWikisFilter: false,
@@ -125,6 +126,26 @@ function setInitialState() {
125126
}
126127
}
127128
saveFilterSuggestions(false);
129+
130+
$("#default_url").val(items.baseUrl);
131+
$("#default_url_button").click(function() {
132+
if ($(this).html() == "Edit") {
133+
$("#default_url").attr('disabled', false);
134+
$("#default_url").focus();
135+
$("#default_url_button").html("Save");
136+
} else {
137+
$("#default_url").attr('disabled', true);
138+
$("#default_url_button").html("Edit");
139+
chrome.storage.sync.set({
140+
baseUrl: $("#default_url").val()
141+
}, function() {
142+
showSavedAlert();
143+
});
144+
}
145+
setTimeout(() => {
146+
$(this).blur();
147+
}, 250);
148+
});
128149
});
129150
}
130151

0 commit comments

Comments
 (0)