diff --git a/src/js/tabs/landing.js b/src/js/tabs/landing.js index 9034af6b..27716299 100644 --- a/src/js/tabs/landing.js +++ b/src/js/tabs/landing.js @@ -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(' '); bottomSection.append(' '); - var languagesAvailables = i18n.getLanguagesAvailables(); + const languagesAvailables = i18n.getLanguagesAvailables(); languagesAvailables.forEach(function(element) { bottomSection.append(' '); }); 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); diff --git a/src/js/tabs/map.js b/src/js/tabs/map.js index 49aeae7f..ef563ea2 100644 --- a/src/js/tabs/map.js +++ b/src/js/tabs/map.js @@ -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}`); } } diff --git a/src/js/tabs/setup_osd.js b/src/js/tabs/setup_osd.js index 799b199f..24f10ec4 100644 --- a/src/js/tabs/setup_osd.js +++ b/src/js/tabs/setup_osd.js @@ -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'); diff --git a/src/js/tabs/static_tab.js b/src/js/tabs/static_tab.js index d26b615c..8626f10d 100644 --- a/src/js/tabs/static_tab.js +++ b/src/js/tabs/static_tab.js @@ -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('