Showing posts with label firefox bookmark. Show all posts
Showing posts with label firefox bookmark. Show all posts

Tuesday, December 19, 2006

When debugging firefox bookmark javascript, I found myself always concatenate multiple line javascript code into one line.

Here is the shell script to redirect it to a local file, where the "notepad" kicks in and automatically load it.
js_merger.py bookmark.js  bookmark.txt  notepad bookmark.txt

And here is the code to automatically do this:
import sys
if len(sys.argv)!=2:
print "Usage: js_merger.py {file.js}"
else:
l = open(sys.argv[1]).readlines()
print "javascript:(function(){" + ' '.join([i.strip() for i in l]) + "})();"


My day job project is down all in FireFox. We just can't image how to write web applications with FireFox and all its wonderful extensions. There have been many friends who asked me which FireFox extensions I use for web development. Well, I can never give them a full list until I ran into this list: http://lesliefranke.com/files/firefoxwdev/firefoxwdev.htm