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.
And here is the code to automatically do this:
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]) + "})();"
No comments:
Post a Comment