Closed Bug 1721568 Opened 3 years ago Closed 3 years ago

[feature suggestion] Return single-click search functionality with oneOffsRefresh redux userscript

Categories

(Core :: Widget: Gtk, enhancement)

Firefox 90
enhancement

Tracking

()

RESOLVED DUPLICATE of bug 1671815

People

(Reporter: argonvegell, Unassigned)

Details

Attachments

(2 files)

2.89 KB, application/x-javascript
Details
302 bytes, application/x-javascript
Details

User Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Firefox/78.0

Expected results:

Back then, when you did a search with Wikipedia for example, all you had to do was type your search query on the address bar, click on the Wikipedia icon and it takes you to your desired Wikipedia article, but now with FF90, you have to press shift+click on the Wikipedia icon to get to your desired Wikipedia article.

This userscript by aveyo (https://www.reddit.com/user/aveyo/) brings back single-click search functionality to FF90: https://www.reddit.com/r/firefox/comments/ls0ffy/oneoffsrefresh_redux_single_click_search_icons_in/

These are the userscripts:

Firefox-Install-Directory/UserChrome.js

/// Create in Firefox-Install-Directory/UserChrome.js - a minimal bootstrap to run javascript snippets on Firefox startup - by AveYo
/// Requires: Firefox-Install-Directory/defaults/pref/enable-UserChrome.js
try {
let { classes: Cc, interfaces: Ci, manager: Cm } = Components;
const { XPCOMUtils } = Components.utils.import('resource://gre/modules/XPCOMUtils.jsm');
XPCOMUtils.defineLazyModuleGetters(this, { Services: "resource://gre/modules/Services.jsm" });
function UserChromeJS() { Services.obs.addObserver(this, 'chrome-document-global-created', false); }
UserChromeJS.prototype = { observe:function(s) {s.addEventListener('DOMContentLoaded', this, {once:true});}, handleEvent:function(evt) {
let document = evt.originalTarget; let window = document.defaultView; let location = window.location; let console = window.console;
let skip = /^chrome:(?!//(global/content/(commonDialog|alerts/alert)|browser/content/webext-panels).x?html)|about:(?!blank)/i;
if (!window._gBrowser || !skip.test(location.href)) return; window.gBrowser = window._gBrowser;
/*********************************************** PLACE JS SNIPPETS BELOW THIS LINE! ***********************************************/

// ==UserScript==
// @name OneClickSearch redux v3
// @author AveYo
// @description see resource:///modules/UrlbarSearchOneOffs.jsm
// @include main
// @onlyonce
// ==/UserScript==

if (typeof UC === 'undefined') UC = {};

UC.OneClickSearch = {
init: function() {
XPCOMUtils.defineLazyModuleGetters(this, {
UrlbarSearchOneOffs: "resource:///modules/UrlbarSearchOneOffs.jsm",
UrlbarUtils: "resource:///modules/UrlbarUtils.jsm",
});
this.UrlbarSearchOneOffs.prototype.handleSearchCommand = function (event, searchMode) {
let button = this.selectedButton;
if (button == this.view.oneOffSearchButtons.settingsButtonCompact) {
this.input.controller.engagementEvent.discard(); this.selectedButton.doCommand(); return;
}
let engine = Services.search.getEngineByName(searchMode.engineName); let { where, params } = this._whereToOpen(event);
if (engine && !event.shiftKey) {
this.input.handleNavigation({
event, oneOffParams: { openWhere: where, openParams: params, engine: this.selectedButton.engine, },
});
this.selectedButton = null; return;
}
let startQueryParams = {allowAutofill: !searchMode.engineName && searchMode.source != UrlbarUtils.RESULT_SOURCE.SEARCH, event, };
this.input.searchMode = searchMode; this.input.startQuery(startQueryParams); this.selectedButton = button;
};
console.info('\u2713 OneClickSearch');
}
};
UC.OneClickSearch.init();

/*********************************************** PLACE JS SNIPPETS ABOVE THIS LINE! ***********************************************/
} }; if (!Services.appinfo.inSafeMode) new UserChromeJS(); } catch(fox) {};
/// ^,^

Firefox-Install-Directory/defaults/pref/enable-UserChrome.js

/// create in Firefox-Install-Directory/defaults/pref/enable-UserChrome.js
/// to enable advanced javascript access from Firefox-Install-Directory/UserChrome.js
pref("general.config.filename", "UserChrome.js"); pref("general.config.obscure_value", 0);
pref("general.config.sandbox_enabled", false);

Attached file UserChrome.js
Attached file enable-UserChrome.js

The Bugbug bot thinks this bug should belong to the 'Core::Widget: Gtk' component, and is moving the bug to that component. Please revert this change in case you think the bot is wrong.

Component: Untriaged → Widget: Gtk
Product: Firefox → Core
Status: UNCONFIRMED → RESOLVED
Closed: 3 years ago
Resolution: --- → DUPLICATE
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: