Saturday Apr 26, 2008

Using NetBeans 6.1 freeform project to build iPhone mode add-on for Firefox project.

 

In the last entry I talked about an iPhone mode add-on for Firefox. I used a free form Web Project of NetBeans 6.1 IDE to build the iPhone mode add-on. The NetBeans 6.1 IDE has a great JavaScript editor. That was a big plus. Here is a visual tour of the Web Project setup.

The Build Script

<?xml version="1.0" encoding="UTF-8"?>
<project name="iPhoneEmulator" default="all" basedir=".">
<description>iPhone Emulator for Firefox.</description>
<property name="build.dir" value="build"/>
<!-- build iphone -->
<target name="-create-iphone-jar">
<echo message="Build iphone.jar"/>
<mkdir dir="${build.dir}"/>
<zip destfile="${build.dir}/iphone.jar">
<zipfileset dir="." includes="content/\*\*" />
<zipfileset dir="." includes="locale/\*\*" />
<zipfileset dir="." includes="skin/\*\*" />
</zip>
</target>
<target name="-gen-manifest">
<echo message="Configuring chrome-manifest"/>
<mkdir dir="${build.dir}"/>
<copy file="chrome.manifest" tofile="${build.dir}/chrome.manifest" overwrite="true"/>
<replaceregexp file="${build.dir}/chrome.manifest"
match="\^(content\\s+\\S\*\\s+)(\\S\*/)$"
replace="\\1jar:chrome/iphone.jar!/\\2"
flags="g" byline="true"/>
<replaceregexp file="${build.dir}/chrome.manifest"
match="\^(skin|locale)(\\s+\\S\*\\s+\\S\*\\s+)(.\*/)$"
replace="\\1\\2jar:chrome/iphone.jar!/\\3"
flags="g" byline="true"/>
</target>
<target name="-create-iphone-xpi" depends="-create-iphone-jar,-gen-manifest">
<echo message="Build iphone.xpi"/>
<mkdir dir="${build.dir}"/>
<zip destfile="${build.dir}/iphone.xpi">
<zipfileset dir="${build.dir}" includes="iphone.jar" prefix="chrome" />
<zipfileset dir="${build.dir}" includes="chrome.manifest" />
<zipfileset dir="." includes="install.rdf" />
</zip>
</target>
<target name="all" depends="-create-iphone-xpi"/>

<target name="run" depends="clean,all">
<exec executable="firefox" osfamily="unix">
<arg file="${build.dir}/iphone.xpi"/>
</exec>
<exec executable="/usr/bin/open" osfamily="mac">
<arg value="-b"/>
<arg value="org.mozilla.firefox"/>
<arg file="${build.dir}/iphone.xpi"/>
</exec>
<exec executable="C:/Program Files/Mozilla Firefox/firefox.exe" osfamily="windows">
<arg file="${build.dir}/iphone.xpi"/>
</exec>
</target>

<target name="-clean-iphone">
<echo message="Clean iphone"/>
<delete file="${build.dir}/iphone.jar" failonerror="false"/>
<delete file="${build.dir}/chrome.manifest" failonerror="false"/>
<delete file="${build.dir}/iphone.xpi" failonerror="false"/>
</target>
<target name="clean" depends="-clean-iphone"/>
</project>

Here is the rest:

_

_

 

Projects and Files window showing the layout: 

 

__

 

The NetBeans IDE is slowly starting to take shape as a premium AJAX, Web 2.0 and Mobile development IDE. 

 

Sunday Apr 20, 2008

Open Location in iPhone Mode in Firefox


I have been hacking Firefox. Here is a simple iPhone mode add-on. This is very basic mode. You can type an address in the address field and hit ENTER. You can use the Reload button to reload the page. You can use Go Back and Go Forward buttons to navigate the history. You can use Add Bookmark button to add a bookmark to the current page. You can use the Show Bookmarks button to show the Bookmarks window. Just lkie the iPhone - the address bar is hidden when the document loads. You can reshow the address bar by clicking on the battery indicator bar.

Any URL can be invoked in the iPhone mode from command line by using the -iphone command line argument.

> firefox -iphone URL

Use the File:OpenLocation in iPhone Mode... menu item to launch the iPhone mode.

Open Location in iPhone Mode

iPhone ModeiPhone mode collapsed address bar

Talk about recursive :)

Download the add-on.

Download the NetBeans 6.1 project.

DISCLAIMER: This add-on is experimental. So no guarantees. Use the add-on at your own risk.

About

sandipchitale

Search

Archives
« April 2014
SunMonTueWedThuFriSat
  
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
   
       
Today