Nike+ Challenge widget with kilometers
Written January 28, 2007 at 14:56 CET. Tagged OS X and Dashboard widgets.
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.
Updated 2007-05-04
Now works with the latest version of the widget. Use the download link above. Small modifications were made tonikepluschallenges.js and utils.js:
--- 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);
nikepluschallenges.js using \r linebreaks, unlike utils.js and my editor.
