Posts Tagged Firefox

A Simple Extension to fix Firefox’s tab functionality

For this week’s lab humph asked us to create a simple extension that fixes the tab functionality of Firefox. Right now without any extensions when one opens a new tab for firefox it gets placed at the end, not right beside the current tab. The goal of the extension is to make it so that when one opens a new tab it gets placed right next to the current tab.

This is a very simple extesion and thus only has 4 files:

  • addtabbeside.js - Performs the needed functionality
  • install.rdf - Needed extension file
  • chrome.manifest - Needed extension file
  • overlay.xul

Frankly, Firefox should have this functionality built in. Most people have tons and tons of tabs open at any one time and having to go to the end of the list to get the new tab is just annoying. Even Internet Explorer has the same functionality but the good thing about Firefox and open source is that one can fix/change something that one dislikes just as I have done with this extension.

You download this extension here. Just click and drag it into firefox and the install sequence should start up. Please make sure to rename the file to Addtabbeside.xpi instead of Addtabbeside.zip

, , ,

No Comments

Building Firefox from Source

This is coming a bit late on my part since my desktop was having some hard drive issues. Well, I finally got that cleared up (ended up having to reformat my computer) and proceeded to build Firefox from source. So I headed over to the build instructions and started following the steps for the Windows platform…

Requirements

So after all the prerequisites were ready I got one of the bash scripts found in C:\mozilla-build running. It passed all the initial checkups and gave me the command prompt. Awesome!

Source

Already had that downloaded and ready to go!

Configuring Build Options

Now .mozconfig needed to be setup. This can be tricky from what I hear. This file will hold all my build options. The following is how my mozconfig file looks like…

ac_add_options --enable-application=browser
mk_add_options MOZ_CO_PROJECT=browser
mk_add_options MOZ_OBJDIR=@TOPSRCDIR@/../obj-@CONFIG_GUESS@

Build

I ran the build by typing make -f client.mk build. My build ramped up and started to run but eventually I got an error…

“configure: error: –enable-application=APP was not specified and is required”

I ran the command ./configure –enable-application=browser to fix this error. It’s weird though since I have –enable-application=browser in my .mozconfig file already so why do I have to explicitly invoke it from the command line?

The build took around an hour as various unreadable compile data zoomed by as I looked on. At the end I didn’t know whether the build succeeded or not. It would have been nice to see a message clearly telling me that the build had been successful or not like. Nonetheless, I checked my source folder and found the minefield exe ready to run.

, , ,

No Comments

Ubiquity, a Firefox Extension

In our last open source class Dave asked us to work through a lab where we worked with Ubiquity, a Firefox extension. So, I had a go at it. I installed it and read the articles that introduce the add-on to a new user. I have to say that it it quite useful and intuitive. Although the extension is not yet at version 1.0 I think I will still use it. I have to say I’m a bit eccentric about extensions. I love using them and playing around with them. I can’t live without them, to be honest. Ubiquity is just another addition to my ever growing add-on list.

Ubiquity adds great convenience to your browser. It’s basically a command line tool for performing browser tasks. Anybody that likes working with an easily accessible command line will greatly enjoy this extension. All one has to do is press ctrl-space (on Windows) and ubiquity will appear in the top left corner of your browser, ready to use. Now, all you have to do is enter the right command and it will do your bidding.

One feature that I’m particularly impressed with is the ability to email your selection. This can include links, pictures and anything else. To do this all one has to do is select whatever you desire, press ctrl-space and then type “email this to [recipient's email]” or “email selection to [recipient's email]” or “email it to [recipient's email]“. Very useful if you ask me.

Ubiquity has many built-in commands that come with the add-on but it also allows users to put on their programming hats and do a bit of coding themselves to create their own commands. This feature is great since the users are no longer limited by what the developers put into ubiquity. If you feel that there should be some command in ubiquity that isn’t there currently, then you can code it yourself. This is a great example of how open source works. Users can very easily become developers and hats off to the Ubiquity development team for making this transition as seamless as possible.

I tried my hand at making my own commands. I began by coding a simple user search for our zenit/wiki.

1
2
3
4
5
6
7
8
9
10
11
12
13
CmdUtils.CreateCommand({
name: "zenit/wiki user search:",
takes: {"search zenit/wiki user": noun_arb_text},
preview: function( pblock, wikiquery ) {
pblock.innerHTML = "Searching For: " + wikiquery.text;
},
execute: function( wikiquery ) {
var url = "http://zenit.senecac.on.ca/wiki/index.php/Special:Search?ns2=1&search={QUERY}&searchx=Search";
var query = wikiquery.text;
var urlString = url.replace("{QUERY}", query);
Utils.openUrlInBrowser(urlString);
}
})

The Ubiquity development team has made it quite easy for the users to create new commands. All we have to do is follow the command structure. So as you can see here for example in the name section you type the name of the command, in the execute section you code what the command is exactly suppose to do. So in this case the function receives the name of the user and performs some URL manipulation and opens the new URL in a new tab. Very simple stuff. Other students also created their on commands. You can have a peak at them here.

I also tried to create another command for jslint. Basically the idea was to select any text (hopefully JavaScript code) and then type jslint into the Ubiquity command line. This should open up jslint in a new tab with the selected text being displayed in the main textarea of jslint (where one is suppose to paste the JavaScript code). Unfortunately, after a few hours of struggle I couldn’t get it to work. One of things that make it quite hard is that jslint is coded in Ajax and it’s URL doesn’t change, which means that I cannot perform any URL manipulation. I attempted to use html.replace and even looked into using jQuery’s append function but all in vain. Eventually I gave up. I’m sure I could have figured it out given more time. Just a shout out to Tiago for spending the time with me to try to figure this out, he was very helpful.

Below is the code we came up with, which obviously does not work but if anybody wants to take this as a starting point and go from there please be my guest. Just make sure to post your results on here good or bad. I would love to know.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
CmdUtils.CreateCommand({
 name: "jslint",
 takes: {"word": noun_arb_text},
 execute: function(directObj) {
  var selectedCode = directObj.text;
  var urlString = "http://www.jslint.com";
  Utils.openUrlInBrowser(urlString);
  var params = {
  };      
 
  jQuery.post( urlString, params, function( html ) {
   var old = "<textarea id=\"input\"><\/textarea>";
   var newHtml = "<textarea id=\"input\">" + $selectedCode + "<\/textarea>";
   html = html.replace( old, newHtml );
 });
 },
})
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
CmdUtils.CreateCommand({
 name: "jslint",
 takes: {"word": noun_arb_text},
 execute: function(directObj) {
  var selectedCode = directObj.text;
  var urlString = "http://www.jslint.com";
  Utils.openUrlInBrowser(urlString);
  var params = {
  };      
 
  jQuery.post( urlString, params, function( html ) {
   ("textarea").append(selectedCode);
 });
 },
})

, , , , ,

1 Comment