Hacking Clock Widget

Discussion in 'macOS' started by macbaseball, May 6, 2005.

  1. macbaseball macrumors 6502a

    macbaseball

    Joined:
    Feb 27, 2005
    Location:
    Northern California
    #1
    Is there a way to make the clock widget say where I live, instead of the closest city. It's minor, I was just wondering how. I tried editing the Java Script, but it just said undefinded place.

    Note: I'm just using the standard widget included with Tiger.
     
  2. superbovine macrumors 68030

    superbovine

    Joined:
    Nov 7, 2003
    #2
    i clicked the "i" button and entered by zip code, and that was that which should directly map to your city.
     
  3. macbaseball thread starter macrumors 6502a

    macbaseball

    Joined:
    Feb 27, 2005
    Location:
    Northern California
    #3
    I don't have the option to enter my zip code. Are you sure that you're talking about the clock widget.
     
  4. macbaseball thread starter macrumors 6502a

    macbaseball

    Joined:
    Feb 27, 2005
    Location:
    Northern California
    #4
    I figured it out. PM me if you are interested.
     
  5. superbovine macrumors 68030

    superbovine

    Joined:
    Nov 7, 2003
    #5
    Sorry wrong widget. my bad. so why keep it a secret?

    http://developer.apple.com/macosx/dashboard.html

    You can just goto HD->Library->Widgets->World Clock->(your language).lproj

    (you will have right click or ctrl click on the World clock directory and do a Show Package Contents)

    First, make a backup of the file then edit the line that is the nearest city.
    So,
    Code:
    localizedCityNames['Dallas'] = 'Dallas';
    
    becomes:
    Code:
    localizedCityNames['Irving'] = 'Irving';
    
    then do the same for HD->Library->Widgets->World Clock->WorldClock.js
    and find the matching line and repeat the previous step.

    save both files, you will need to have the admin password. after that close all the world clock applications then restart them.
     
  6. macbaseball thread starter macrumors 6502a

    macbaseball

    Joined:
    Feb 27, 2005
    Location:
    Northern California
    #6
    I didn't know how to explain it, as it just started working after I screwed it up. I didn't really feel like going through all the work of figuring out what I did, if nobody was going to use it. Thanks for posting how to do it though.
     
  7. superbovine macrumors 68030

    superbovine

    Joined:
    Nov 7, 2003
    #7
    Someone PM'ed me with a good question.

    To back the files, just open the file in question in TextEdit then 'save as' file.name.bak. after that reopen the original file in Textedit. You will need admin password for this.
     
  8. macbaseball thread starter macrumors 6502a

    macbaseball

    Joined:
    Feb 27, 2005
    Location:
    Northern California
    #8
    I edited the 2 .js files (localizedstrings.js in the english.lproj folder and worldclock.js) to change the clock. I edited them by, opening them in Taco HTML Edit, editing them, and then I save them to the desktop. Then I dragged the file I was replacing into a new folder desktop (Just copies it), and then I dragged the replacement file into the same location. You have to use your password, and then it will replace. If case it doesn't work, then you can just put the old file back. Hopefully I'll completely figure out why it didn't work poriginally, and then I'll post a tutorial.
     
  9. macbaseball thread starter macrumors 6502a

    macbaseball

    Joined:
    Feb 27, 2005
    Location:
    Northern California
    #9
    This tutorial is also written in mind for Carmel Valley, CA, but you can just substitute where you need to.

    Before you start, open the widget in dashboard, and click the little I. Look through the of cities on the back and choose a city in your same time zone. Make sure it’s a city that you would unlikely want in your dashboard, as your going to get rid of it. My choice was Los Angeles.

    The first step is to have a editor of some sort. My chose was Taco HTML Edit, which worked really well, as it has a find tool. This tutorial is written with this application in mind, but it’s really easy to adjust it to your program.

    I found the World Clock Widget in Library/Widgets/World Clock. The first step is to control-click the World Clock file, and then click Show Package Contents. A folder should pop up.

    Then I created a folder called Widget Backup, and then made another folder called World Clock inside of it. Then I went back to the folder that popped up when I clicked Show Package Contents. Inside of there are two critical files:

    1) Your Country.lproj/localizedStrings.js
    2) World Clock.js

    Drag both of these files to the folder you created. This won’t move them out of the folder, but it will make a copy of them.

    Go back to the folder that popped up when I clicked Show Package Contents. Control click on the file localizedStrings.js, located in the English.lproj folder, and then click open with other. Find Taco HTML Edit.

    The file should open, and then click Apple-F. Type in Los Angeles, and then replace the two places where it appears with Carmel Valley. File-Save As. Put this file on the desktop. Then go back to the folder that popped up when I clicked Show Package Contents. Drag this file from the desktop, to the English.lproj folder, which was the location the old file. Follow the onscreen instructions to authenticate the replacement of the file.

    Go back to the folder that popped up when I clicked Show Package Contents. Control click on the file World Clock.js, which is located in this folder, and then click open with other. Find Taco HTML Edit.

    Once the app is open, use Apple-F to find all the places where it says Los Angeles. It only appears once. This is where I screwed up last time. I edited the time zone wrong. It will probably work if you just leave the time zone, but I haven’t tested it. Change the line that states:

    {city:'Los Angeles', offset:-420, timezone:'America/Los_Angeles'},

    to

    {city:'Carmel Valley', offset:-420, timezone:'US/Pacific'},

    This should make the clock the right time. That was my error the first time I tried. It said 4 o’clock, when it was really 8.

    This is how I did it, and it works, but I’m not sure if it’s the shortest way.
     
  10. beige matchbox macrumors 6502a

    beige matchbox

    Joined:
    Mar 16, 2005
    Location:
    Oxfordshire, UK
  11. macbaseball thread starter macrumors 6502a

    macbaseball

    Joined:
    Feb 27, 2005
    Location:
    Northern California
    #11

Share This Page