MozillaZine

Extension Request:MouseWheel in Toolbar search box to switch

Talk about add-ons and extension development.
Zeuradin
 
Posts: 4
Joined: October 29th, 2006, 9:43 pm

Post Posted October 29th, 2006, 9:49 pm

I'm not sure if such an extension exists already, I couldn't find it after half an hour of digging through the available extensions so I thought I'll try here.

This extension would let you change the search engine from eg. Google to Wikipedia on the toolbar search box that comes with the default Firefox, by scrolling the mouse wheel up/down while hovering over the search box.

The purpose is to reduce the number of clicks. Right now, to change the search engine, you need to click the icon of the currently selected engine, then click another one from the dropdown menu.

EDIT: Just to clarify, I'm hoping if someone out there can create this extension if one doesn't already exist. I unfortunately don't have the skills to do it myself.

einare
 
Posts: 159
Joined: October 22nd, 2006, 1:16 pm
Location: Iceland

Post Posted October 30th, 2006, 3:25 am

I might be able to help you if I can find the time, quite busy with work at the moment. But if anyone else wants to give it a shot, here's what you need to get started: (This is the main overlay js file).

Code: Select all
var SearchBarScroll = {

    onLoad : function(event) {

        this.searchbar = document.getElementById('searchbar');
        this.searchbar.addEventListener('DOMMouseScroll', function (event) { SearchBarScroll.scroll(event); }, false);
    },

    scroll : function(event) {
        alert('scrolling the searchbar');
        //do your thing here.
    }

};
window.addEventListener('load', function(event) { SearchBarScroll.onLoad(event); }, false);




einare
 
Posts: 159
Joined: October 22nd, 2006, 1:16 pm
Location: Iceland

Post Posted October 30th, 2006, 4:44 am

Well, I got bored and finished the extension. You can get it at:

http://tech.einaregilsson.com/download/ ... ngines.xpi

For some reason the name doesn't show up in the installation dialog, I don't know why.

Let me know if there are any problems.

einar


p.s. For those interested, the entire source code of the extension is this:

Code: Select all
var ScrollSearchEngines = {

    onLoad : function(event) {

        var sb = document.getElementById('searchbar');
        sb.addEventListener('DOMMouseScroll', function (e) { ScrollSearchEngines.scroll(e); }, false);
    },
   
    scroll : function(event) {
      BrowserSearch.getSearchBar().selectEngine(event, event.detail > 0);
    }
   
};

window.addEventListener('load', function(event) { ScrollSearchEngines.onLoad(event); }, false);
Last edited by einare on July 25th, 2007, 5:57 am, edited 1 time in total.

Zeuradin
 
Posts: 4
Joined: October 29th, 2006, 9:43 pm

Post Posted October 30th, 2006, 1:29 pm

Wow that's exactly what I wanted! Thank you very much =)

Return to Extension Development


Who is online

Users browsing this forum: No registered users and 1 guest