--> Mozilla Firefox : how to get easy to create own browser skin | Kang-Mauk (Ibnu Mas'ud)

informasi menarik dan menyenangkan

www.informasibogorbarat.blogspot.com (Blog Kang Maux)

Tuesday, July 12, 2011

Mozilla Firefox : how to get easy to create own browser skin

| Tuesday, July 12, 2011


there are three things you need to know: how to edit images, how to extract zip files, and how to modify CSS. Firefox uses standard GIF, PNG, and JPEG images for the buttons and CSS to style everything else in the interface.

A skin does not totally change the interface; instead, it just defines how the interface looks. You can't change what happens when the user right clicks on an image, but you can change the look of the right click menu (Make it blue with pink polka dots, for example). If you want to change the functionality of Firefox, you'll have to look into modifying the chrome, which is beyond the scope of this document.

Download the latest version of Firefox and install it. Be sure to install the DOM Inspector extension as well.

Extract Theme

While you can hypothetically begin with any theme already designed for Firefox, for the sake of consistency we'll speak as though everyone is editing the default Firefox theme. This is located in the file classic.jar found in the Firefox installation directory. A .jar file is in reality a renamed zip archive. Opening the .jar files in your archive manager of choice should result in the file being automatically detected as being a zip archive. However, if your application doesn't detect classic.jar as a standard zip archive, rename the file classic.zip and continue extraction.
Classic.jar locations

Linux: /usr/lib/MozillaFirefox/chrome/classic.jar or /usr/lib/firefox-*.*.*/chrome/classic.jar

Windows: \Program Files\Mozilla Firefox\chrome\classic.jar

For Mac OS X:

* Go to your applications folder
* Control click application icon(Firefox icon), choose Show Package Contents.
* Go to contents/MacOS/Chrome/classic.jar

Copy classic.jar to another easily accessible folder -- Classic is recommended -- extract the contents of that folder, being sure to maintain the directory structure.
Directories

Inside classic.jar is one directory, skin, as well as two files, preview.png and icon.png.

skin
skin simply contains another directory, classic which holds all the good stuff.
skin\classic
classic contains the following directories.
skin\classic\browser
browser contains all the toolbar icons, as well as the icons for the bookmark manager and the preferences window.
skin\classic\communicator
Doesn't do a whole lot and can typically be forgotten about promptly.
skin\classic\global
global contains almost all of the important CSS files that define the appearance of the browser. This is the most critical directory in a theme.
skin\classic\help
help contains all the files for theming the help dialog window.
skin\classic\mozapps
mozapps contains all the styles and icons for the browser peripherals, such as the extension manager or update wizard.
Install Your New Theme

Before you can see the changes you make to a Firefox theme (since live edits are restrictively difficult to set up) you must first learn how to repackage the classic theme to make it installable. For the sake of this discussion we will call your theme "My_Theme", though you can replace that with any name.
Copying The Necessary Files

The first step is to move all the files into the right directory structure. So create a new directory called My_Theme. Into this directory put the browser, global, communicator, help, and mozapps directories from above, as well as the icon.png and preview.png files. (Yes, this means that the structure of your new directory and classic.jar will be slightly different.)
Creating the Install Files
Contents.rdf

Make a copy of contents.rdf and place it in \My_Theme and open it up in your text editor. This file is a small XML Database which is used to describe the skin.

In the code search for all instances of "My_Theme" and replace them with the name of your theme.

The packages section lists which components of the browser you're modifying. If we also had skins for Chatzilla, we would need to add another line resembling the other ones and change it to point to Chatzilla. But this list includes everything that we changed, so just modify the blue text to point to match the name/version that you used in the sections before this.

Save the file and exit the text editor.
install.rdf

Make a copy of install.rdf and place it in the My_Theme directory, then open it up in your text editor. This file is a small XML database that describes the skin.


{Themes_UUID}
Themes_Version

The first section requires that you establish a UUID for your theme and that you give your theme a version number. Once you've done this, insert the information as above, and scroll down.

You will also have to update the minimum and maximum compatible versions for the target application (Firefox) in the following section:




{ec8030f7-c20a-464f-9b0e-13a3a9e97384}
Min_FF_Version
Max_FF_Version



Establishing both minimum and maximum compatible versions lets you avoid conflicts with versions of Firefox your theme wasn't designed for -- or wasn't tested on.

See Install Manifests for the reference information about the install.rdf file.
CSS Files

The CSS files in these directories tell the browser how to display the buttons and other controls, where to put the images, what border and padding it should put around them, and so on.

As an example, let's change the standard button.

Go into the global global directory and open button.css in your favorite text editor. Scroll down to button {. This section defines the normal button in its basic state (There is no mouse over it, it's not disabled, and it's not selected).

Change the background-color: to DarkBlue and the color: to White, and save the file.

more after I get done with some tests
Repackaging JAR

Now all you need to do is repackage a JAR file with the following directory structure, using your favorite archive manager to create a zip archive:

/browser/*
/communicator/*
/global/*
/help/*
/mozapps/*
/contents.rdf
/install.rdf
/icon.png
/preview.png


Make sure not to just zip up the My_Theme parent directory since that will cause the drag and drop install in the next section to fail without error messages. Once you have put the files in the zip folder, rename it to My_Theme.jar
Triggering the install from the web

To install the theme's JAR file directly from the web, you need to run some JavaScript.

Related Posts