#!/usr/bin/python
import os

if __name__ == '__main__':
	js_file = open('cropList.js', 'w')
	js_file.write('imageNames = [\n')
	js_file.write(',\n'.join(['\t"%s"' % name for name in os.listdir('originals')
		if name[-4:] in ('.JPG', '.jpg', '.PNG', '.png')]))
	js_file.write('\n\t];\n')
	js_file.close()

@@ -101,16 +101,20 @@
 .write('
+var 
 imageNam
@@ -159,19 +159,25 @@
 '%5Ct%22
-%25s%22' %25 
+%7B%7D%22'.format(
 name
+)
  for
@@ -281,18 +281,16 @@
 rite('%5Cn
-%5Ct
 %5D;%5Cn')%0A%09

Declare imageNames with var, use .format() instead of %, remove tab before closing bracket