Search selection gesture for firefox

This is my "Hello world" of blog posts. I have now taken the dark path of blogging. And ain't nothing better to kick things off with a little snippet of javascript that helped me solve a big problem - how to do a search on selected text with a mouse gesture.

I've been using Mouse Gestures Redox for over a year now and am very pleased with it. A few days ago i thought to myself - wouldn't it be great if i could selected some text and with the same continuous movement perform a search on it? Mouse Gestures Redox allows custom javascript to be run as a gesture and here's what i wrote:

// Get selected text from the HTML DOM
var selectedText = window._content.document.getSelection();

// Get the searchbar element from the Firefox UI XUL DOM
var searchbar = document.getElementById('searchbar');
if (!searchbar)

// Perform search
searchbar.value = selectedText;

I have assigned this script to a gesture "R" meaning dragging to the right - really convenient. I'm sure this script is not only applicable for Mouse Gestures Redox but to other gestures add-ons as well.

Helping a brother out,