Skip to content

Commit

Permalink
🚚 #99 move telemetry logic in javascript modules
Browse files Browse the repository at this point in the history
Signed-off-by: JAGFx <[email protected]>
  • Loading branch information
JAGFx committed Feb 22, 2022
1 parent d6f0b12 commit cda5933
Show file tree
Hide file tree
Showing 32 changed files with 591 additions and 593 deletions.
47 changes: 0 additions & 47 deletions public/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -17,52 +17,5 @@
<strong>We're sorry, but the client doesn't work properly without JavaScript enabled. Please enable it to
continue.</strong>
</noscript>

</body>
<script>
/*$( function () {
var noSleep = new NoSleep();
$( 'html' ).on( 'click', '#overlay', function () {
//console.log( 'Plop' );
var elem = document.querySelector( 'html' );
/!* View in fullscreen *!/
function openFullscreen() {
if ( elem.requestFullscreen ) {
elem.requestFullscreen();
} else if ( elem.mozRequestFullScreen ) { /!* Firefox *!/
elem.mozRequestFullScreen();
} else if ( elem.webkitRequestFullscreen ) { /!* Chrome, Safari and Opera *!/
elem.webkitRequestFullscreen();
} else if ( elem.msRequestFullscreen ) { /!* IE/Edge *!/
elem.msRequestFullscreen();
}
noSleep.enable();
}
/!* Close fullscreen *!/
function closeFullscreen() {
if ( document.exitFullscreen ) {
document.exitFullscreen();
} else if ( document.mozCancelFullScreen ) { /!* Firefox *!/
document.mozCancelFullScreen();
} else if ( document.webkitExitFullscreen ) { /!* Chrome, Safari and Opera *!/
document.webkitExitFullscreen();
} else if ( document.msExitFullscreen ) { /!* IE/Edge *!/
document.msExitFullscreen();
}
noSleep.disable();
}
if ( !document.webkitIsFullScreen ) {
openFullscreen();
} else {
closeFullscreen();
}
} );
} );*/
</script>
</html>
6 changes: 3 additions & 3 deletions src/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@
>
<HistoryOverlay />
<Overlay />
<TelemetryEventOverlay v-if="appReady" />
<Header v-if="appReady" />
<TelemetryEventOverlay v-if="$telemetryDataIsEnough()" />
<Header v-if="$telemetryDataIsEnough()" />
<component
:is="currentSkinComponent()"
v-if="appReady"
v-if="$telemetryDataIsEnough()"
v-show="!menuIsDisplayed"
/>
</main>
Expand Down
17 changes: 11 additions & 6 deletions src/components/dashboards/DafXFDashboard.vue
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
/>
<div class="truck-speedRounded wrapper-area">
<span>{{
unit_speed(telemetry.truck.speed, true, false) | $toFixed(0)
$toFixed(unit_speed(telemetry.truck.speed, true, false), 0)
}}</span>
</div>
<Cadran
Expand Down Expand Up @@ -69,8 +69,10 @@
/>
<div class="truck-odometer wrapper-area">
<span>{{
unit_length(telemetry.truck.odometer, 'km', true, false)
| $toFixed(0)
$toFixed(
unit_length(telemetry.truck.odometer, 'km', true, false),
0
)
}}</span>
</div>
<!-- <div class="truck-cruiseControlSpeedRounded wrapper-area"><span>{{ telemetry.truck.cruiseControl.kph }}</span></div>-->
Expand Down Expand Up @@ -111,7 +113,7 @@
<div class="trailer-mass wrapper-area">
<span>
{{
unit_weight(telemetry.job.cargo.mass, true, false) | $toFixed(1)
$toFixed(unit_weight(telemetry.job.cargo.mass, true, false), 1)
}}
<span class="ton">{{
unit_weight(telemetry.job.cargo.mass, false)
Expand All @@ -132,8 +134,11 @@
/>
<div class="game-time wrapper-area">
<span>{{
$gameTime()
| $dateTimeLocalized(DATE_FORMAT_SHORT, TIME_FORMAT_SHORT)
$dateTimeLocalized(
$gameTime(),
DATE_FORMAT_SHORT,
TIME_FORMAT_SHORT
)
}}</span>
</div>
</div>
Expand Down
17 changes: 11 additions & 6 deletions src/components/dashboards/DefaultDashboard.vue
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
/>
<div class="truck-speedRounded wrapper-area">
<span>{{
unit_speed(telemetry.truck.speed, true, false) | $toFixed(0)
$toFixed(unit_speed(telemetry.truck.speed, true, false), 0)
}}</span>
</div>
<div class="truck-speedRounded-unit wrapper-area">
Expand Down Expand Up @@ -72,8 +72,10 @@
/>
<div class="truck-odometer wrapper-area">
<span>{{
unit_length(telemetry.truck.odometer, 'km', true, false)
| $toFixed(0)
$toFixed(
unit_length(telemetry.truck.odometer, 'km', true, false),
0
)
}}</span>
</div>
<div class="truck-cruiseControlSpeedRounded wrapper-area">
Expand Down Expand Up @@ -114,7 +116,7 @@
class="trailer-attached"
/>
<div class="trailer-mass">
{{ unit_weight(telemetry.job.cargo.mass, true, false) | $toFixed(1)
{{ $toFixed(unit_weight(telemetry.job.cargo.mass, true, false), 1)
}}<span class="ton">{{
unit_weight(telemetry.job.cargo.mass, false)
}}</span>
Expand All @@ -128,8 +130,11 @@
<th>{{ $t('Time') }}:</th>
<td>
<span class="game-time">{{
$gameTime()
| $dateTimeLocalized(DATE_FORMAT_LONG, TIME_FORMAT_SHORT)
$dateTimeLocalized(
$gameTime(),
DATE_FORMAT_LONG,
TIME_FORMAT_SHORT
)
}}</span>
</td>
</tr>
Expand Down
18 changes: 11 additions & 7 deletions src/components/dashboards/ManTGXDashboard.vue
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
/>
<div class="truck-speedRounded wrapper-area">
<span>{{
unit_speed(telemetry.truck.speed, true, false) | $toFixed(0)
$toFixed(unit_speed(telemetry.truck.speed, true, false), 0)
}}</span>
</div>
<Cadran
Expand Down Expand Up @@ -91,8 +91,10 @@
/>
<div class="truck-odometer wrapper-area">
<span>{{
unit_length(telemetry.truck.odometer, 'km', true, false)
| $toFixed(0)
$toFixed(
unit_length(telemetry.truck.odometer, 'km', true, false),
0
)
}}</span>
</div>
<!-- <div class="truck-cruiseControlSpeedRounded wrapper-area"><span>{{ telemetry.truck.cruiseControl.kph }}</span></div>-->
Expand Down Expand Up @@ -129,8 +131,7 @@
<!-- <div :class="{'yes': trailer.attached}" class="trailer-attached"></div>-->
<div class="trailer-mass wrapper-area">
<span
>{{
unit_weight(telemetry.job.cargo.mass, true, false) | $toFixed(0)
>{{ $toFixed(unit_weight(telemetry.job.cargo.mass, true, false), 0)
}}<span class="ton">{{
unit_weight(telemetry.job.cargo.mass, false)
}}</span></span
Expand All @@ -155,8 +156,11 @@
</div>
<div class="game-time wrapper-area">
<span>{{
$gameTime()
| $dateTimeLocalized(DATE_FORMAT_SHORT, TIME_FORMAT_SHORT)
$dateTimeLocalized(
$gameTime(),
DATE_FORMAT_SHORT,
TIME_FORMAT_SHORT
)
}}</span>
</div>
<div
Expand Down
17 changes: 11 additions & 6 deletions src/components/dashboards/MercedesAtegoDashboard.vue
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
/>
<div class="truck-speedRounded wrapper-area">
<span>{{
unit_speed(telemetry.truck.speed, true, false) | $toFixed(0)
$toFixed(unit_speed(telemetry.truck.speed, true, false), 0)
}}</span>
</div>
<Cadran
Expand Down Expand Up @@ -78,8 +78,10 @@
/>
<div class="truck-odometer wrapper-area">
<span>{{
unit_length(telemetry.truck.odometer, 'km', true, false)
| $toFixed(0)
$toFixed(
unit_length(telemetry.truck.odometer, 'km', true, false),
0
)
}}</span>
</div>
<!-- <div class="truck-cruiseControlSpeedRounded wrapper-area"><span>{{ telemetry.truck.cruiseControl.kph }}</span></div>-->
Expand Down Expand Up @@ -115,7 +117,7 @@
class="trailer-attached"
/>
<!-- <div class="trailer-mass wrapper-area">-->
<!-- <span>{{ unit_weight( telemetry.job.cargo.mass, true, false ) | $toFixed( 1 ) }}<span class="ton">{{ unit_weight( telemetry.job.cargo.mass, false ) }}</span></span></div>-->
<!-- <span>{{ $toFixed(unit_weight( telemetry.job.cargo.mass, true, false ), 1 ) }}<span class="ton">{{ unit_weight( telemetry.job.cargo.mass, false ) }}</span></span></div>-->
<!-- <div class="trailer-name">{{ telemetry.job.cargo.name }}</div>-->
<div
:class="{ yes: telemetry.truck.fuel.warning.enabled }"
Expand All @@ -138,8 +140,11 @@
<!-- <div class="truck-batteryVoltage">{{ telemetry.truck.engine.batteryVoltage.warning.factor.toFixed(0) }}</div>-->
<div class="game-time wrapper-area">
<span>{{
$gameTime()
| $dateTimeLocalized(DATE_FORMAT_SHORT, TIME_FORMAT_SHORT)
$dateTimeLocalized(
$gameTime(),
DATE_FORMAT_SHORT,
TIME_FORMAT_SHORT
)
}}</span>
</div>
<!-- <div :class="{ 'yes': telemetry.truck.brakes.airPressure.emergency.enabled }" class="truck-airPressureEmergencyOn"></div>-->
Expand Down
29 changes: 20 additions & 9 deletions src/components/dashboards/RdInfoDashboard.vue
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
'minAngle' : -111,
'maxAngle': 110,
}"></Cadran>-->
<!-- <div class="truck-speedRounded wrapper-area"><span>{{ telemetry.truck.speed unit_speed( telemetry.truck.speed, true, false ) | $toFixed( 0 ) }}</span></div>-->
<!-- <div class="truck-speedRounded wrapper-area"><span>{{ $toFixed(telemetry.truck.speed unit_speed( telemetry.truck.speed, true, false ), 0 ) }}</span></div>-->
<!--<Cadran v-bind="{
'classCSS': 'truck-engineRpm',
'type': 'meter',
Expand Down Expand Up @@ -117,8 +117,14 @@
</div>
<div class="truck-fuelAverageConsumption">
{{
unit_consumption(telemetry.truck.fuel.avgConsumption, true, false)
| $toFixed(1)
$toFixed(
unit_consumption(
telemetry.truck.fuel.avgConsumption,
true,
false
),
1
)
}}
</div>
<div class="_fuelAvg">
Expand Down Expand Up @@ -163,12 +169,14 @@
/>
<div class="navigation-speedLimit">
{{
unit_speed(telemetry.navigation.speedLimit, true, false)
| $toFixed(0)
$toFixed(
unit_speed(telemetry.navigation.speedLimit, true, false),
0
)
}}
</div>

<!-- <div class="truck-odometer wrapper-area"><span>{{ unit_length( telemetry.truck.odometer, 'km', true, false ) | $toFixed( 0 ) }}</span></div>-->
<!-- <div class="truck-odometer wrapper-area"><span>{{ $toFixed(unit_length( telemetry.truck.odometer, 'km', true, false ), 0 ) }}</span></div>-->
<!-- <div class="truck-cruiseControlSpeedRounded wrapper-area"><span>{{ telemetry.truck.cruiseControl.kph }}</span></div>-->
<div class="truck-displayedGear wrapper-area">
<span>{{
Expand All @@ -181,8 +189,11 @@

<div class="job-remainingTime wrapper-area">
<span v-if="$jobRemainingTimeToDueDate()">{{
telemetry.job.expectedDeliveryTimestamp.value
| $dateTimeLocalized(DATE_FORMAT_LONG, TIME_FORMAT_SHORT)
$dateTimeLocalized(
telemetry.job.expectedDeliveryTimestamp.value,
DATE_FORMAT_LONG,
TIME_FORMAT_SHORT
)
}}</span>
<span v-else>{{
$jobRemainingTimeDelivery(telemetry.job.deliveryTime.unix)
Expand All @@ -207,7 +218,7 @@

<!-- <div :class="{'yes': telemetry.trailer.attached}" class="trailer-attached"></div>-->
<!-- <div class="trailer-mass wrapper-area">-->
<!-- <span>{{ unit_weight( telemetry.job.cargo.mass, true, false ) | $toFixed( 1 ) }}<span class="ton">{{ unit_weight( telemetry.job.cargo.mass, false ) }}</span></span></div>-->
<!-- <span>{{ $toFixed(unit_weight( telemetry.job.cargo.mass, true, false ), 1 ) }}<span class="ton">{{ unit_weight( telemetry.job.cargo.mass, false ) }}</span></span></div>-->
<!-- <div class="trailer-name">{{ telemetry.job.cargo.name }}</div>-->
<!-- <div :class="{ 'yes': telemetry.truck.fuel.warning.enabled }" class="truck-fuelWarningOn"></div>-->
<!-- <div :class="{ 'yes': telemetry.truck.brakes.airPressure.warning.enabled }" class="truck-airPressureWarningOn"></div>-->
Expand Down
2 changes: 1 addition & 1 deletion src/components/dashboards/TestDashboard.vue
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<Dashboard class="test wrapper">
<div class="speed">
<span class="value">{{
unit_speed(telemetry.truck.speed, true, false) | $toFixed(0)
$toFixed(unit_speed(telemetry.truck.speed, true, false), 0)
}}</span>
<small class="unit">{{ unit_speed(telemetry.truck.speed, false) }}</small>
</div>
Expand Down
18 changes: 11 additions & 7 deletions src/components/dashboards/VolvoFHDashboard.vue
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
/>
<div class="truck-speedRounded wrapper-area">
<span>{{
unit_speed(telemetry.truck.speed, true, false) | $toFixed(0)
$toFixed(unit_speed(telemetry.truck.speed, true, false), 0)
}}</span>
</div>
<Cadran
Expand Down Expand Up @@ -74,8 +74,10 @@
}"></Cadran>-->
<div class="truck-odometer wrapper-area">
<span>{{
unit_length(telemetry.truck.odometer, 'km', true, false)
| $toFixed(0)
$toFixed(
unit_length(telemetry.truck.odometer, 'km', true, false),
0
)
}}</span>
</div>
<!-- <div class="truck-cruiseControlSpeedRounded wrapper-area"><span>{{ telemetry.truck.cruiseControl.kph }}</span></div>-->
Expand Down Expand Up @@ -115,8 +117,7 @@
/>
<div class="trailer-mass wrapper-area">
<span
>{{
unit_weight(telemetry.job.cargo.mass, true, false) | $toFixed(1)
>{{ $toFixed(unit_weight(telemetry.job.cargo.mass, true, false), 1)
}}<span class="ton">{{
unit_weight(telemetry.job.cargo.mass, false)
}}</span></span
Expand All @@ -127,8 +128,11 @@
</div>
<div class="game-time wrapper-area">
<span>{{
$gameTime()
| $dateTimeLocalized(DATE_FORMAT_SHORT, TIME_FORMAT_SHORT)
$dateTimeLocalized(
$gameTime(),
DATE_FORMAT_SHORT,
TIME_FORMAT_SHORT
)
}}</span>
</div>
<div
Expand Down
7 changes: 5 additions & 2 deletions src/components/dashboards/jagfx/Zone/JagfxJob.vue
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,11 @@
<i class="icon-time" />
</div>
<span v-if="$hasJob() && $jobRemainingTimeToDueDate()">{{
jobDeliveryTime
| $dateTimeLocalized(DATE_FORMAT_LONG, TIME_FORMAT_SHORT)
$dateTimeLocalized(
$jobDeliveryTime(),
DATE_FORMAT_LONG,
TIME_FORMAT_SHORT
)
}}</span>
<span v-else-if="$hasJob() && !$jobRemainingTimeToDueDate()">{{
$jobRemainingTimeDelivery(
Expand Down
Loading

0 comments on commit cda5933

Please sign in to comment.