[Greasemonkey] replacing text in broken javascript files

Greg Diebel gdiebel at gmail.com
Fri Oct 21 19:09:58 EDT 2005


Our university is using Kronos workforce timekeeper. According to
their site, IE only is supported, but since it uses a java applet, I
figured I could get it to work under Firefox/linux. The problem it
seems is some broken javascript. The site uses a variety of scripts to
make sure that the correct jre version (1.4.2_08) is loaded, since it
only works with that version! There is a rather long section of js for
NS6 browsers to detect plugin.

javascrip console reports this issue in kronos-plugin-init_NS6.js :

Error: unmatched ) in regular expression
Source File: http://mytime.wisc.edu/wfc/html/scripts/kronos-plugin-init_NS6.js
Line: 193, Column: 13
Source Code:
   var re1 = /Java.*\sPlug-in.*)/

So, I figured try out greasemonkey and see if it can be fixed client
side. Just replacing that expression with something that works such
as:

var re1 = /JRE (\d\.\d(\.\d))/

Not sure how this would be done with greasemonkey, hoping for some
insight. I understand how to replace html body elements and the like,
but not sure how to replace in a javascript, so that is will run
correctly. Any pointers to similar scripts or hints would be hugely
appreciated. Many people here would be happy!

Thanks,Greg


More information about the Greasemonkey mailing list