Skip to content

Commit 8210107

Browse files
committed
Update for Firefox 89 (Proton)
1 parent 977c54e commit 8210107

File tree

7 files changed

+23
-29
lines changed

7 files changed

+23
-29
lines changed

icons/menu.png

9.58 KB
Loading

icons/pageaction.png

-12.4 KB
Binary file not shown.

icons/urlbar.png

-669 Bytes
Loading

manifest.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"description": "Add a custom search engine to the list of available search engines in the search bar.",
33
"manifest_version": 2,
44
"name": "Add custom search engine",
5-
"version": "4.0",
5+
"version": "4.1",
66

77
"browser_action": {
88
"default_icon": {

search.html

+3-3
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,9 @@
2121
<h3>Almost done just two more steps</h3>
2222
<div>
2323
<img src="icons/urlbar.png">
24-
<p><strong>Open the "Page actions" menu</strong></p>
25-
<img src="icons/pageaction.png">
26-
<p><strong>Click "Add Search Engine"</strong></p>
24+
<p><strong><em>Right</em> click the address bar</strong></p>
25+
<img src="icons/menu.png">
26+
<p><strong>Click <em>Add "Example"</em></strong></p>
2727
Go to <mark>about:preferences#search</mark> to see your installed search engines.</p>
2828

2929
<button id="close" class="btn btn-primary">Go back</button>

search.js

+15-25
Original file line numberDiff line numberDiff line change
@@ -123,32 +123,22 @@ document.querySelector("form").addEventListener("submit", async event => {
123123
// We need the raw XML instead of the pretty HTML view
124124
let url = json.url + "/raw";
125125

126-
let {version} = await browser.runtime.getBrowserInfo();
127-
version = +/(\d+)\./.exec(version)[0];
128-
if (version >= 78) {
129-
// Mozilla intentionally disabled AddSearchProvider :(
130-
// https://bugzilla.mozilla.org/show_bug.cgi?id=1632447
131-
132-
let link = document.createElement("link");
133-
link.rel = "search";
134-
link.type = "application/opensearchdescription+xml";
135-
link.title = document.querySelector("#input-name").value;
136-
link.href = url;
137-
138-
// This doesn't actually seem to work. Firefox seems to cache.
139-
let existing = document.querySelector("link[rel=search]");
140-
if (existing) {
141-
existing.remove();
142-
}
143-
144-
document.head.append(link);
145-
146-
document.querySelector("#main").style.display = "none";
147-
document.querySelector("#instructions").style.display = "block";
148-
} else {
149-
// Where the magic used to happen ...
150-
window.external.AddSearchProvider(url);
126+
let link = document.createElement("link");
127+
link.rel = "search";
128+
link.type = "application/opensearchdescription+xml";
129+
link.title = document.querySelector("#input-name").value;
130+
link.href = url;
131+
132+
// This doesn't actually seem to work. Firefox seems to cache.
133+
let existing = document.querySelector("link[rel=search]");
134+
if (existing) {
135+
existing.remove();
151136
}
137+
138+
document.head.append(link);
139+
140+
document.querySelector("#main").style.display = "none";
141+
document.querySelector("#instructions").style.display = "block";
152142
} catch(error) {
153143
alert(error);
154144
};

style.css

+4
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,10 @@ body {
99
object-fit: contain;
1010
}
1111

12+
mark {
13+
background-color: #fff9d8ee;
14+
}
15+
1216
/* advanced options are initially hidden */
1317
.adv-hidden {
1418
display: none;

0 commit comments

Comments
 (0)