10.4: Use Google Finance for the Stocks widget

Jun 20, '06 07:30:00AM

Contributed by: Anonymous

If you'd like to use Google Finance (which in my opinion has been greatly improved and is far superior to the Quote finance page) in your Stocks widget, you just need to do a simple code replacement. Make a backup of your Stocks widget just in case, which you will find in /Library -> Widgets -> Stocks.wdgt. Then control-click the widget and select Show Package Contents from the pop-up menu. Find the file named Stocks.js, and open it up in your text editor of choice. Then perform the following code change: Line 654 reads as follows (note that there's an added line break in all of the following. Do not break the line when entering it yourself; make it one long line):

var url = 'http://finance.lycos.com/apple/default.aspx?symbols=' + 
 generateSymbolStringFromStrings (symbol, exchange);
To use Google Finance instead, make it look like this:
var url = 'http://finance.google.com/finance?q=' + 
generateSymbolStringFromStrings (symbol, exchange);
If you want to use Yahoo! Finance instead, simply replace the code mentioned above with this:
var url = 'http://finance.google.com/finance?q=' + 
generateSymbolStringFromStrings (symbol, exchange);
If you want the widget to also go to the page of your choice when you click the big Quote.com button on the back of the widget, you can also change the code at line 1304 with one of the following:
var url = 'http://finance.google.com/finance?q='
var url = 'http://finance.yahoo.com/q?s='
[robg adds: This worked as described. A simple way to make a backup of the widget is to just copy it to your user's Library/Widgets folder, then modify the copy. This leaves the original Apple-provided widget alone. Then open your modified copy from the Finder to see it on the Dashbaord.]

Comments (2)


Mac OS X Hints
http://hints.macworld.com/article.php?story=20060617223346597