forked from iNavFlight/inav-configurator
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathglobalUpdates.js
41 lines (33 loc) · 1.56 KB
/
globalUpdates.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
27
28
29
30
31
32
33
34
35
36
37
38
39
40
'use strict'
const CONFIGURATOR = require('./data_storage');
const FC = require('./fc');
const { globalSettings } = require('./globalSettings');
const i18n = require('./localization');
var update = {
activatedTab: function() {
var activeTab = $('#tabs > ul li.active');
activeTab.removeClass('active');
$('a', activeTab).trigger('click');
},
firmwareVersion: function() {
if (CONFIGURATOR.connectionValid) {
$('#logo .firmware_version').text(FC.CONFIG.flightControllerVersion + " [" + FC.CONFIG.target + "]");
globalSettings.docsTreeLocation = 'https://github.com/iNavFlight/inav/blob/' + FC.CONFIG.flightControllerVersion + '/docs/';
globalSettings.configuratorTreeLocation = 'https://github.com/iNavFlight/inav-configurator/tree/' + FC.CONFIG.flightControllerVersion + '/';
// If this is a master branch firmware, this will find a 404 as there is no tag tree. So default to master for docs.
$.ajax({
url: globalSettings.docsTreeLocation + 'Settings.md',
method: "HEAD",
statusCode: {
404: function () {
globalSettings.docsTreeLocation = 'https://github.com/iNavFlight/inav/blob/master/docs/';
}
}
});
} else {
$('#logo .firmware_version').text(i18n.getMessage('fcNotConnected'));
globalSettings.docsTreeLocation = 'https://github.com/iNavFlight/inav/blob/master/docs/';
}
}
};
module.exports = update;