Sunday, December 2, 2007

Leopard widget repair DIY

After (thankfully) upgrading to Leopard, a couple of my favorite dashboard widgets started to have problems. Obviously it's hard for me to live without knowing the current weather outside, or the current date in Lunar calendar, I started my hunting trip of those little tiny lines of codes that broke under the latest Safari/Leopard, and here's a summary of how:

  • Sharp the weapon: in Developer Tools that came with Leopard, Dashcode is a nice debugging environment that one can view, modify and test run widgets from source. Once installed, it can be found under /Developer/Applications/

  • Know the enemy: all downloaded third-party widgets are installed in ./Library/Widgets/ under user's home directory, and the widget source can be viewed via "Show Package Contents" option with right mouse click.

  • Onto the weather: after downloading WeatherBug Local Weather version 1.1.0.9 released on Nov. 7, 2007, Leopard complains that it can't be installed because it's not a widget. Dashcode revealed the truth that file Info.plist is missing. Actually it was not missing, but named as info.plist, with the small "i". That's all needed to get radar maps back on board.

  • Finally the date: China Calendar widget stopped reacting to mouse clicks on any buttons under Leopard, and its "confirm" button appeared to have misalignment on edges. Only file mycal.html needs to be modified for complete repair: replacing the parameter this.tag with this.id in all mouse movement functions fixes the former, and specifying source of genericButton.js to use the system one at file:///System/Library/WidgetResources/button/genericButton.js fixes the later.

One less thing to be unhappy about Leopard.

2 comments:

kenchai said...

Hi I got the same china calendar problem as yours.
but where can i find the mycal.html file? i couldn't find it though...

Yu (Marie) Ma said...

It is under ./Library/Widgets/ of your home directory, and the widget source can be viewed via "Show Package Contents" option with right mouse click. You should be able to find the mycal.html file and modify it directly.