Skip to content

Commit

Permalink
Allow user to switch between kilograms or tons for trailer mass
Browse files Browse the repository at this point in the history
  • Loading branch information
mike-koch committed Mar 24, 2015
1 parent eec68dd commit 3e1ce72
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 1 deletion.
1 change: 1 addition & 0 deletions config.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
"language": "en-US.json", // Filename of the translation you wish to load. All translations must be in the "language" folder.
"speedUnits": "kmh", // "kmh": Displays speed in kilometers per hour | "mph": Displays speed in miles per hour
"timeFormat": "24h", // "24h": Display time in 24-hour format | "12h": Display time in 12 hour (AM/PM) format -5
"weightUnits": "kg", // "kg": Display trailer mass in kilograms | "t": Display trailer mass in tons
}

}
2 changes: 1 addition & 1 deletion dashboard.html
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@
</div>
<div class="col-xs-8 _cargoRightSide">
<div class="trailer">
<span class="trailerName"></span> (<span class="trailerMass"></span> kg)
<span class="trailerName"></span> (<span class="trailerMassKgOrT"></span>)
</div>
</div>
</div>
Expand Down
11 changes: 11 additions & 0 deletions dashboard.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,9 @@ Funbit.Ets.Telemetry.Dashboard.prototype.filter = function (data) {
data.digitGroupedReward = getDigitGroupedReward(data.jobIncome);

data.gameTime12h = getTimeInTwelveHourFormat(data.gameTime);
data.trailerMassTons = data.hasJob ? ((data.trailerMass / 1000.0) + ' t') : '';
data.trailerMassKg = data.hasJob ? data.trailerMass + ' kg' : '';

// return changed data to the core for rendering
return data;
};
Expand Down Expand Up @@ -64,6 +67,14 @@ Funbit.Ets.Telemetry.Dashboard.prototype.initialize = function (skinConfig) {
$('.truckSpeedRoundedKmhMph').addClass('truckSpeedMphRounded').removeClass('truckSpeedRoundedKmhMph');
}

// Process kg vs tons
var weightUnits = skinConfig.weightUnits;
if (weightUnits === 'kg') {
$('.trailerMassKgOrT').addClass('trailerMassKg').removeClass('trailerMassKgOrT');
} else if (weightUnits === 't') {
$('.trailerMassKgOrT').addClass('trailerMassTons').removeClass('trailerMassKgOrT');
}

// Process 12 vs 24 hr time
var timeFormat = skinConfig.timeFormat;
if (timeFormat === '12h') {
Expand Down

0 comments on commit 3e1ce72

Please sign in to comment.