1
0
Fork 0
mirror of https://github.com/betaflight/betaflight-configurator.git synced 2025-07-19 14:25:14 +03:00

Merge pull request #2315 from haslinghuis/osd

This commit is contained in:
Michael Keller 2020-12-16 14:58:29 +01:00 committed by GitHub
commit 4469851a75
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 24 additions and 29 deletions

View file

@ -2,7 +2,6 @@
TABS.landing = {};
TABS.landing.initialize = function (callback) {
var self = this;
if (GUI.active_tab != 'landing') {
GUI.active_tab = 'landing';
@ -10,10 +9,10 @@ TABS.landing.initialize = function (callback) {
$('#content').load("./tabs/landing.html", function () {
function showLang(newLang) {
var bottomSection = $('.languageSwitcher');
bottomSection = $('.languageSwitcher');
bottomSection.find('a').each(function(index) {
var element = $(this);
var languageSelected = element.attr('lang');
const element = $(this);
const languageSelected = element.attr('lang');
if (newLang == languageSelected) {
element.removeClass('selected_language');
element.addClass('selected_language');
@ -22,18 +21,18 @@ TABS.landing.initialize = function (callback) {
}
});
}
var bottomSection = $('.languageSwitcher');
let bottomSection = $('.languageSwitcher');
bottomSection.html(' <span i18n="language_choice_message"></span>');
bottomSection.append(' <a href="#" i18n="language_default_pretty" lang="DEFAULT"></a>');
var languagesAvailables = i18n.getLanguagesAvailables();
const languagesAvailables = i18n.getLanguagesAvailables();
languagesAvailables.forEach(function(element) {
bottomSection.append(' <a href="#" lang="' + element + '" i18n="language_' + element + '"></a>');
});
bottomSection.find('a').each(function(index) {
var element = $(this);
let element = $(this);
element.click(function(){
var element = $(this);
var languageSelected = element.attr('lang');
element = $(this);
const languageSelected = element.attr('lang');
if (!languageSelected) { return; }
if (i18n.selectedLanguage != languageSelected) {
i18n.changeLanguage(languageSelected);

View file

@ -4,7 +4,7 @@ const DEFAULT_ZOOM = 16,
ICON_IMAGE = '/images/icons/cf_icon_position.png',
ICON_IMAGE_NOFIX = '/images/icons/cf_icon_position_nofix.png';
var iconGeometry,
let iconGeometry,
map,
mapView,
iconStyle,
@ -15,7 +15,7 @@ window.onload = initializeMap;
function initializeMap() {
var lonLat = ol.proj.fromLonLat([DEFAULT_LON, DEFAULT_LAT]);
const lonLat = ol.proj.fromLonLat([DEFAULT_LON, DEFAULT_LAT]);
mapView = new ol.View({
center: lonLat,
@ -33,14 +33,14 @@ function initializeMap() {
controls: []
});
var icon = new ol.style.Icon(({
const icon = new ol.style.Icon(({
anchor: [0.5, 1],
opacity: 1,
scale: 0.5,
src: ICON_IMAGE
}));
var iconNoFix = new ol.style.Icon(({
const iconNoFix = new ol.style.Icon(({
anchor: [0.5, 1],
opacity: 1,
scale: 0.5,
@ -62,11 +62,11 @@ function initializeMap() {
iconFeature.setStyle(iconStyle);
var vectorSource = new ol.source.Vector({
const vectorSource = new ol.source.Vector({
features: [iconFeature]
});
var currentPositionLayer = new ol.layer.Vector({
const currentPositionLayer = new ol.layer.Vector({
source: vectorSource
});
@ -90,7 +90,7 @@ function processMapEvents(e) {
case 'center':
iconFeature.setStyle(iconStyle);
var center = ol.proj.fromLonLat([e.data.lon, e.data.lat]);
const center = ol.proj.fromLonLat([e.data.lon, e.data.lat]);
mapView.setCenter(center);
iconGeometry.setCoordinates(center);
break;
@ -100,7 +100,7 @@ function processMapEvents(e) {
break;
}
} catch (e) {
console.log('Map error ' + e);
} catch (err) {
console.log(`Map error ${err}`);
}
}

View file

@ -4,7 +4,6 @@ TABS.setup_osd = {
};
TABS.setup_osd.initialize = function (callback) {
var self = this;
if (GUI.active_tab != 'setup_osd') {
GUI.active_tab = 'setup_osd';
@ -25,13 +24,13 @@ TABS.setup_osd.initialize = function (callback) {
function process_html() {
$('.tab-setup-osd .info').hide(); // requires an MSP update
var osdVideoModes = [
/* Only used by get_slow_data() which is commented out.
const osdVideoModes = new Set([
'AUTO',
'NTSC',
'PAL'
];
]);
*/
// translate to user-selected language
i18n.localizePage();
@ -48,10 +47,8 @@ TABS.setup_osd.initialize = function (callback) {
function get_slow_data() {
/* FIXME requires MSP update
MSP.send_message(MSPCodes.MSP_OSD_VIDEO_STATUS, false, false, function () {
var element;
element = $('.video-mode');
var osdVideoMode = osdVideoModes[OSD_VIDEO_STATE.video_mode];
let element element = $('.video-mode');
const osdVideoMode = osdVideoModes[OSD_VIDEO_STATE.video_mode];
element.text(osdVideoMode);
element = $('.camera-connected');

View file

@ -2,12 +2,11 @@
TABS.staticTab = {};
TABS.staticTab.initialize = function (staticTabName, callback) {
var self = this;
if (GUI.active_tab != staticTabName) {
GUI.active_tab = staticTabName;
}
var tabFile = "./tabs/" + staticTabName + ".html";
const tabFile = `./tabs/${staticTabName}.html`;
$('#content').html('<div id="tab-static"><div id="tab-static-contents"></div>');
$('#tab-static-contents').load(tabFile, function () {