forked from aminomancer/uc.css.js
-
Notifications
You must be signed in to change notification settings - Fork 0
/
removeSearchEngineAliasFormatting.uc.js
37 lines (34 loc) · 1.97 KB
/
removeSearchEngineAliasFormatting.uc.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
// ==UserScript==
// @name Remove Search Engine Alias Formatting
// @version 1.1.1
// @author aminomancer
// @homepageURL https://github.com/aminomancer
// @description Depending on your settings you might have noticed that typing a search engine alias (e.g. `goo` for Google) causes some special formatting to be applied to the text you input in the url bar. This is a trainwreck because the formatting is applied using the selection controller, not via CSS, meaning you can't change it in your stylesheets. It's blue by default, and certainly doesn't match my personal theme very well. This script just prevents the formatting from ever happening at all.
// @downloadURL https://cdn.jsdelivr.net/gh/aminomancer/uc.css.js@master/JS/removeSearchEngineAliasFormatting.uc.js
// @updateURL https://cdn.jsdelivr.net/gh/aminomancer/uc.css.js@master/JS/removeSearchEngineAliasFormatting.uc.js
// @license This Source Code Form is subject to the terms of the Creative Commons Attribution-NonCommercial-ShareAlike International License, v. 4.0. If a copy of the CC BY-NC-SA 4.0 was not distributed with this file, You can obtain one at http://creativecommons.org/licenses/by-nc-sa/4.0/ or send a letter to Creative Commons, PO Box 1866, Mountain View, CA 94042, USA.
// ==/UserScript==
(() => {
function startup() {
function init() {
if (!gURLBar.valueFormatter._formatSearchAlias) return;
gURLBar.valueFormatter._formatSearchAlias = () => false;
gURLBar.removeEventListener("focus", init);
}
gURLBar.addEventListener("focus", init);
}
if (gBrowserInit.delayedStartupFinished) {
startup();
} else {
let delayedListener = (subject, topic) => {
if (topic == "browser-delayed-startup-finished" && subject == window) {
Services.obs.removeObserver(delayedListener, topic);
startup();
}
};
Services.obs.addObserver(
delayedListener,
"browser-delayed-startup-finished"
);
}
})();