Sunday, January 6, 2013

Firefox: Custom Buttons

Custom Buttons add-ons!

Today I had just installed a great add-ons for Firefox, and that would be the 
"Custom Buttons"...
Well actually I am searching for a way to actually expand my Personas for Firefox vertically, and while searching, I somehow stumbled upon this great Add-ons... huhu...

After installation, I just click on the "View" button on firefox tab and then click 
"Add new button...".
I am quite happy to have been able to choose the icons for my new buttons, then suddenly, 
IT ASK ME FOR CODES to make it work... Whatta...! How am I supposed to know any codes! I am not familiar with this coding and command thing, but somehow it must be done... herm...

So I browse through the Forum, and after some hardship, I managed to get a simple codes to work which are as follows:
__________________________________________________________________________________
const url = "http://www.google.com.my/"

document
.getElementById("content")
.webNavigation
.loadURI(url, 0, null, null, null)

___________________________________________________________________


That one is the code that would make my Google Icon button leads me to google search page in one click... huhu... and you could always change the google to something else, for example, Yahoo:
__________________________________________________________________________________
const url = "http://www.yahoo.com/"

document
.getElementById("content")
.webNavigation
.loadURI(url, 0, null, null, null)

___________________________________________________________________


I only need to change the "URL" part, and nothing else... (I don't even fully understand what the codes actually mean... haha)
The given example is actually for mozilla firefox page, yet I changed it to google and yahoo as I visited those pages more often... Yet I still have the firefox link used because I've been through all the trouble of downloading the firefox icon for it... huhu... 
(yet actually I needed the mozilla button more cause I've already have both google and yahoo on my Foxtab add-ons for firefox)


The second codes is for opening Application (the one with .exe file), and I search hard for this one, and the forum is hard to understand fully... haha... and the coding that I've used is for Google Earth, so that it would be easier for me to search location while browsing, and just that architecture needs google earth for site plans and all... huhu... and the code is:
__________________________________________________________________________________ 
/*Code*/

var file = Components.classes["@mozilla.org/file/local;1"].
createInstance(Components.interfaces.nsILocalFile);

file.initWithPath("C:\\Program Files (x86)\\Google\\Google Earth\\googleearth.exe");
file.launch();

___________________________________________________________________


Take note of the double backslash(\\) that I've used to separate folder location as the codes will remove one backslash each separation, and I am not sure why... haha...
You could always change the direction of the path for the application (.exe) file to anything that you like, and don't forget to add another backslash(\\) to each... huhu...

After I finished adding those buttons, I just right click at the personas area and click "Customize"... Now I could add the buttons, and I used the 64x64 icons, so that I have more space for my personas vertically... YAAYY!!!

After I finished doing those things, I add some review on "https://addons.mozilla.org/en-US/firefox/addon/custom-buttons/" as some people complains on how it is not user friendly (no guides for beginner), and thats where I came in... huhu...

Anyway, the result of today's works somehow looks like this... huhu...

Large Icons on the Left,                                                                                   Lightning Personas on the right...























-AFDHAL-