Skip to content

Commit d36a82b

Browse files
Gary KeebleGary Keeble
authored andcommitted
Add Version Information for Viewer
1 parent 743b56b commit d36a82b

File tree

3 files changed

+42
-1
lines changed

3 files changed

+42
-1
lines changed

css/main.css

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ html, body {
5353

5454
@media (min-width: 768px) {
5555
.welcome-pane .panel-body {
56-
min-height:320px;
56+
min-height: 100px;
5757
}
5858
}
5959

@@ -1017,3 +1017,8 @@ html.hasLaps table#lap-timer-laps {
10171017
div#lap-timer td:first-child {
10181018
padding-right: 10px;
10191019
}
1020+
1021+
1022+
.viewer-download {
1023+
display: none;
1024+
}

index.html

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,21 @@ <h1>Welcome to the Enhanced Blackbox Explorer!</h1>
144144
</div>
145145
</div>
146146
</div>
147+
<div class="col-sm-4">
148+
<div class="panel panel-default">
149+
<div class="panel-heading">
150+
Version
151+
</div>
152+
<div class="panel-body">
153+
<p>
154+
<div id="viewer-version"><!-- current version shown here --></div>
155+
</p>
156+
<p class="viewer-download">
157+
The latest official version is <a class="btn btn-default btn-md btn-viewer-download" data-toggle="tooltip" data-placement="auto top" title="Goto the latest version download page" href="https://github.com/betaflight/blackbox-log-viewer/releases/latest"> vX.X.XX </a>
158+
</p>
159+
</div>
160+
</div>
161+
</div>
147162
</div>
148163
</div>
149164
</div>

js/main.js

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
// Global Level Variables
44
var userSettings = {};
55

6+
var VIEWER_VERSION = '2.4.11'; // Current version
7+
68
function BlackboxLogViewer() {
79
function supportsRequiredAPIs() {
810
return window.File && window.FileReader && window.FileList && Modernizr.canvas;
@@ -33,6 +35,7 @@ function BlackboxLogViewer() {
3335
lastRenderTime = false,
3436
flightLog, flightLogDataArray,
3537
graph = null,
38+
latestVersion,
3639

3740
prefs = new PrefStorage(),
3841

@@ -776,6 +779,24 @@ function BlackboxLogViewer() {
776779

777780
$('[data-toggle="tooltip"]').tooltip(); // initialise tooltips
778781

782+
// Get Latest Version Information
783+
$("#viewer-version").text('You are using version ' + VIEWER_VERSION);
784+
try {
785+
$.getJSON('https://api.github.com/repos/GaryKeeble/blackbox-log-viewer/releases/latest',{},function(data){
786+
latestVersion = data;
787+
if(latestVersion) {
788+
$(".btn-viewer-download").text(latestVersion.tag_name);
789+
$(".viewer-download").show();
790+
} else {
791+
$(".viewer-download").hide();
792+
}
793+
});
794+
} catch (e)
795+
{
796+
console.log('Cannot get latest version information');
797+
$(".viewer-download").hide();
798+
}
799+
779800
graphLegend = new GraphLegend($(".log-graph-legend"), activeGraphConfig, onLegendVisbilityChange, onLegendSelectionChange, zoomGraphConfig, expandGraphConfig, newGraphConfig);
780801

781802
prefs.get('log-legend-hidden', function(item) {

0 commit comments

Comments
 (0)