Nike+ Challenge widget with kilometers

Written . Tagged Dashboard widgets, OS X.

The Nike+ Challenge widget only displays miles, even if your preference is kilometers. I modified the widget to display kilometers instead. My version only displays kilometers, never miles.

Download here.

Updated 2007-05-04
Now works with the latest version of the widget. Use the download link above. Small modifications were made to nikepluschallenges.js and utils.js:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
--- utils.js
+++ (clipboard)
@@ -166,9 +166,9 @@
  else return floatNumber;
 }

+// Modified to actually return KM
 function getMilesFromKM(kilometers,precision){
-    kmToMiles = kilometers / 1.609344;
-    return cropFloat(kmToMiles+"",precision);
+    return cropFloat(kilometers+"",precision);
 }

 function bubblesort2DimArray(arrayList,key){

--- nikepluschallenges.js
+++ (clipboard)
@@ -455,7 +455,7 @@
                      getProgressInformationDistanceLimit(progress,comparatorValue,isCurrentUser,isWinner);
                  break;
              case "mostDistance":
-                    challengeDiv += getProgessInformationDistanceTime(progress,leadersProgress,comparatorValue,isCurrentUser,isWinner);
+                    challengeDiv += getProgessInformationDistanceTime(progress,leadersProgress,comparatorValue,isCurrentUser,isWinner).replace(/ mi(?=<\/div>)/, ' km');
                  break;
              case "fastestRun":
                  challengeDiv += getProgressInformationDistanceFastest(progress,leadersProgress,comparatorValue,isCurrentUser,isWinner);
The diff is mainly to illustrate what I changed. Patching straight from it might not work well due to nikepluschallenges.js using \r linebreaks, unlike utils.js and my editor.