diff --git a/.gitignore b/.gitignore index 07fc3798..fca47b1f 100644 --- a/.gitignore +++ b/.gitignore @@ -4,3 +4,4 @@ /blackbox-chrome-app.zip .idea/workspace.xml .idea/tasks.xml +/.idea/ \ No newline at end of file diff --git a/css/header_dialog.css b/css/header_dialog.css index 175c0c1d..426bc43e 100755 --- a/css/header_dialog.css +++ b/css/header_dialog.css @@ -1,7 +1,7 @@ /* Colums START> */ .cf_column { min-height: 20px; - margin-bottom: 0px; + margin-bottom: 0; } .full { @@ -77,19 +77,19 @@ input[type="number"]::-webkit-inner-spin-button { float: left; width: calc(100% - 2px); margin-bottom: 10px; - font-family: 'open_sansregular', Arial; + font-family: 'open_sansregular', Arial, serif; } .gui_box_titlebar { background-color: #e4e4e4; - border-radius: 3px 3px 0px 0px; + border-radius: 3px 3px 0 0; font-size: 13px; width: 100%; height: 27px; - padding-bottom: 0px; + padding-bottom: 0; float: left; margin-bottom: 7px; - font-family: 'open_sanssemibold', Arial; + font-family: 'open_sanssemibold', Arial, serif; } /* Spacers */ @@ -109,7 +109,7 @@ input[type="number"]::-webkit-inner-spin-button { padding-left: 10px; padding-right: 10px; padding-top: 4px; - margin-bottom: 0px; + margin-bottom: 0; float: left; } @@ -136,7 +136,7 @@ input[type="number"]::-webkit-inner-spin-button { .header-dialog .parameter label { background-color: #828885; padding: 4px; - border-left: 0px solid #ccc; + border-left: 0 solid #ccc; border-bottom: 1px solid #ccc; font-weight: normal; color: white; @@ -147,7 +147,7 @@ input[type="number"]::-webkit-inner-spin-button { .header-dialog .parameter th { background-color: #828885; padding: 4px; - border-left: 0px solid #ccc; + border-left: 0 solid #ccc; border-bottom: 1px solid #ccc; font-weight: bold; color: white; @@ -170,7 +170,7 @@ input[type="number"]::-webkit-inner-spin-button { } .header-dialog .cf th:last-child { - border-right: 0px; + border-right: 0; } .header-dialog .cf td:first-child { @@ -180,7 +180,7 @@ input[type="number"]::-webkit-inner-spin-button { .header-dialog .cf td:last-child { border-bottom-right-radius: 3px; - border-right: 0px; + border-right: 0; border-top-right-radius: 3px; } @@ -215,29 +215,29 @@ input[type="number"]::-webkit-inner-spin-button { .header-dialog table { float: left; - margin: 0px; + margin: 0; border-collapse: collapse; width: calc(100% - 1px); } .header-dialog .gui_box { - /*margin-bottom: 0px;*/ + /*margin-bottom: 0;*/ } .header-dialog .parameter td+input { padding: 1px; background-color:red; - border-bottom: 0px solid #ccc; + border-bottom: 0 solid #ccc; } .header-dialog table, .header-dialog table td { padding: 1px; - border-bottom: 0px solid #ccc; + border-bottom: 0 solid #ccc; } .header-dialog table th { - padding: 0px; - border: 0px; + padding: 0; + border: 0; font-weight: normal; } @@ -245,7 +245,7 @@ input[type="number"]::-webkit-inner-spin-button { padding: 5px; text-align: left; border-right: 1px solid #ccc; - width: calc(100% -1px); + width: calc(100% - 1px); } .header-dialog .pid_titlebar th:first-child { @@ -262,7 +262,7 @@ input[type="number"]::-webkit-inner-spin-button { } .header-dialog table tr td:last-child { - border-right: 0px solid #ccc; + border-right: 0 solid #ccc; } .header-dialog table td { @@ -273,7 +273,7 @@ input[type="number"]::-webkit-inner-spin-button { .header-dialog table tr td { text-align: left; - padding-left: 0px; + padding-left: 0; } .header-dialog table input { @@ -282,8 +282,8 @@ input[type="number"]::-webkit-inner-spin-button { height: 20px; line-height: 20px; text-align: right; - border: 0px solid #ccc; - border-radius: 0px; + border: 0 solid #ccc; + border-radius: 0; } .header-dialog .missing { @@ -302,7 +302,7 @@ input[type="number"]::-webkit-inner-spin-button { .header-dialog .controller { float: left; width: calc(100% - 10px); - margin-left: 0px; + margin-left: 0; margin-bottom: 10px; border-radius: 4px; border: 1px solid #ccc; @@ -330,9 +330,7 @@ input[type="number"]::-webkit-inner-spin-button { color: white; height: 19px; font-weight: normal; - padding: 2px; - padding-bottom: 3px; - padding-left: 6px; + padding: 2px 2px 3px 6px; } .header-dialog .profile select { @@ -374,7 +372,7 @@ input[type="number"]::-webkit-inner-spin-button { float: right; width: calc(100% - 2px); margin-top: 10px; - /* padding-left: 0px; */ + /* padding-left: 0; */ } html:not(.isCF) .cf-only, @@ -396,7 +394,7 @@ html:not(.isBF28) .bf-only { .header-dialog .fixed_band { position: absolute; width: 100%; - bottom: 0px; + bottom: 0; } .header-dialog .spacer_box { @@ -408,24 +406,21 @@ html:not(.isBF28) .bf-only { .pid_mode { width: 100%; height: 25px; - background-color: #D6D6D6; float: left; - margin: 0px; - padding: 0px; + margin: 0; text-align: left; - padding-left: 5px; line-height: 13px; - padding-top: 8px; + padding: 8px 0 0 5px; font-size: 12px; border-bottom: 1px solid #ccc; color: #828282; - font-family: 'open_sans', Arial; - background-image: linear-gradient(-45deg, rgba(255, 255, 255, .2) 10%, transparent 10%, transparent 20%, - rgba(255, 255, 255, .2) 20%, rgba(255, 255, 255, .2) 30%, transparent 30%, transparent 40%, - rgba(255, 255, 255, .2) 40%, rgba(255, 255, 255, .2) 50%, transparent 50%, transparent 60%, - rgba(255, 255, 255, .2) 60%, rgba(255, 255, 255, .2) 70%, transparent 70%, transparent 80%, - rgba(255, 255, 255, .2) 80%, rgba(255, 255, 255, .2) 90%, transparent 90%, transparent 100%, - rgba(255, 255, 255, .2) 100%, transparent); + font-family: 'open_sans', Arial, serif; + background: #D6D6D6 linear-gradient(315deg, rgba(255, 255, 255, .2) 10%, transparent 10%, transparent 20%, + rgba(255, 255, 255, .2) 20%, rgba(255, 255, 255, .2) 30%, transparent 30%, transparent 40%, + rgba(255, 255, 255, .2) 40%, rgba(255, 255, 255, .2) 50%, transparent 50%, transparent 60%, + rgba(255, 255, 255, .2) 60%, rgba(255, 255, 255, .2) 70%, transparent 70%, transparent 80%, + rgba(255, 255, 255, .2) 80%, rgba(255, 255, 255, .2) 90%, transparent 90%, transparent 100%, + rgba(255, 255, 255, .2) 100%, transparent); } .pid_titlebar { @@ -457,7 +452,7 @@ html:not(.isBF28) .bf-only { .header-dialog .number .helpicon { margin-top: 3px; - margin-right: 0px; + margin-right: 0; } .header-dialog .gui_box_titlebar .helpicon { @@ -482,7 +477,7 @@ html:not(.isBF28) .bf-only { .header-dialog .number:last-child { padding-bottom: 5px; - border-bottom: 0px; + border-bottom: 0; } .header-dialog .number input { @@ -502,11 +497,11 @@ html:not(.isBF28) .bf-only { .header-dialog .misc table td { padding: 1px; - border: 0px solid #ccc; + border: 0 solid #ccc; } .header-dialog .noline td { - border: 0px solid #ccc; + border: 0 solid #ccc; } .header-dialog .features label, @@ -516,7 +511,7 @@ html:not(.isBF28) .bf-only { height: 20px; line-height: 20px; text-align: left; - border: 0px solid silver; + border: 0 solid silver; border-radius: 3px; margin-right: 11px; font-weight: normal; @@ -530,7 +525,7 @@ html:not(.isBF28) .bf-only { height: 20px; line-height: 20px; text-align: left; - border: 0px solid silver; + border: 0 solid silver; border-radius: 3px; margin-right: 11px; font-weight: normal; @@ -539,29 +534,14 @@ html:not(.isBF28) .bf-only { .header-dialog .gui_box span { font-style: normal; - font-family: 'open_sansregular', Arial; + font-family: 'open_sansregular', Arial, sans-serif; line-height: 19px; color: #7d7d7d; font-size: 11px; } .noline { - border:0px; -} - -#content-watermark { - position: absolute; - bottom: 40px; - left: 0; - right: 0; - z-index: -1; - overflow: hidden; - background-image: url("../images/light-wide-2.svg"); - background-repeat: no-repeat; - background-position: 95% 20%; - background-size: 430px; - height: 174px; - opacity: 0.15; + border:0; } .header-dialog .resetbt { @@ -579,11 +559,11 @@ html:not(.isBF28) .bf-only { } .header-dialog .leftzero { - padding-left: 0px; + padding-left: 0; } .header-dialog .tpa-breakpoint { - border-top-left-radius: 0px; + border-top-left-radius: 0; } .header-dialog .roll { diff --git a/css/keys_dialog.css b/css/keys_dialog.css index 4c3561c7..39a076b5 100755 --- a/css/keys_dialog.css +++ b/css/keys_dialog.css @@ -1,7 +1,7 @@ .keys-dialog .parameter th { background-color: #828885; padding: 4px; - border-left: 0px solid #ccc; + border-left: 0 solid #ccc; border-bottom: 1px solid #ccc; font-weight: bold; color: white; @@ -14,7 +14,7 @@ } .keys-dialog .gui_box { - margin-bottom: 0px; + margin-bottom: 0; } .keys-dialog .spacer_box { @@ -60,25 +60,20 @@ .keys-dialog .key { margin: 3px; - padding: 5px; background-color: beige; display: inline-block; border-radius: 8px; border-style: groove; - padding-left: 10px; - padding-right: 10px; + padding: 5px 10px; vertical-align: middle; } .keys-dialog .normal { margin: 3px; - padding: 8px; - background-color: none; display: inline-block; border-radius: 8px; border-style: none; - padding-left: 0px; - padding-right: 0px; + padding: 8px 0; vertical-align: middle; } @@ -100,12 +95,12 @@ } .keys-dialog .noline td { - border: 0px solid #ccc; + border: 0 solid #ccc; } .keys-dialog .gui_box span { font-style: normal; - font-family: 'open_sansregular', Arial; + font-family: 'open_sansregular', Arial, sans-serif; line-height: 19px; color: #7d7d7d; font-size: 11px; @@ -115,7 +110,7 @@ } .noline { - border:0px; + border:0; } .keys-dialog .right { @@ -123,7 +118,7 @@ } .keys-dialog .leftzero { - padding-left: 0px; + padding-left: 0; } .keys-dialog .borderleft { diff --git a/css/main.css b/css/main.css index c78e674f..65f1b0c4 100644 --- a/css/main.css +++ b/css/main.css @@ -30,7 +30,7 @@ html, body { } .navbar-nav { float: none!important; - margin: 7.5px -15px; + margin: 7px -15px; } .navbar-nav>li { float: none; @@ -219,8 +219,8 @@ html.has-log .log-graph-config { } .config-graph-header { - margin-bottom: 0px; - margin-right: 0px; + margin-bottom: 0; + margin-right: 0; width: 100%; } @@ -230,7 +230,7 @@ html.has-log .log-graph-config { } .config-graph-field-header { - margin-bottom: 0px; + margin-bottom: 0; } .config-graph-field select { @@ -376,7 +376,6 @@ html.has-analyser-fullscreen.has-analyser .analyser input { -webkit-appearance: slider-vertical; left: 1085px; top: 30px; - */ } .analyser input { @@ -429,12 +428,11 @@ html.has-table-overlay .log-field-values { left: 10%; width: 78.5%; display:block; - padding-left:0px; - padding-right:0px; + padding-left:0; + padding-right:0; font-size:xx-small; background-color: white; - border: #337ab7; - border-style: groove; + border: groove #337ab7; z-index: 10; } @@ -466,8 +464,7 @@ html.has-config .configuration-file { width: 78.5%; padding:10px; background-color: white; - border: #337ab7; - border-style: groove; + border: groove #337ab7; z-index: 11; } @@ -753,12 +750,12 @@ html.isINAV .navbar-logo img { position:relative; height: 35px; width: 210px; - padding: 0px; + padding: 0; display:block; } .navbar-logo a { - padding: 0px; + padding: 0; position: absolute; top: 44%; left: 68%; @@ -766,7 +763,7 @@ html.isINAV .navbar-logo img { } .navbar-logo span { - padding-left: 0px; + padding-left: 0; position: relative; left: -150px; top: 20px; @@ -780,7 +777,7 @@ html.isINAV .navbar-logo img { #status-bar { position: fixed; - bottom: 0px; + bottom: 0; width: 100%; height: 20px; line-height: 20px; @@ -811,8 +808,8 @@ html:not(.has-log) #status-bar { /* padding-left: 5px; */ /* padding-right: 0; */ width: 20px; - /* margin-right: 0px; */ - /* margin-left: 0px; */ + /* margin-right: 0; */ + /* margin-left: 0; */ text-align: center; visibility: hidden; cursor: pointer; @@ -829,8 +826,8 @@ html:not(.has-log) #status-bar { padding-left: 0; padding-right: 0; width: 60px; - margin-right: 0px; - margin-left: 0px; + margin-right: 0; + margin-left: 0; text-align: center; visibility: hidden; cursor: pointer; @@ -880,17 +877,16 @@ input[type="checkbox"].ios-switch + div { background-color: rgba(0, 0, 0, 0.1); -webkit-transition-duration: .4s; -webkit-transition-property: background-color, box-shadow; - box-shadow: inset 0 0 0 0px rgba(0,0,0,0.4); - margin: 0px 0em 0px 2.5em; + box-shadow: inset 0 0 0 0 rgba(0,0,0,0.4); + margin: 0 0 0 2.5em; display: inherit; } /* Checked Track (Blue) */ input[type="checkbox"].ios-switch:checked + div { width: 40px; - background-position: 0 0; - background-color: #3b89ec; - border: 1px solid #0e62cd; + background: #3b89ec 0 0; + border: 1px solid #0e62cd; box-shadow: inset 0 0 0 10px rgba(59,137,259,1); } @@ -933,10 +929,9 @@ input[type="checkbox"].ios-switch + div > div { -moz-transition-timing-function: cubic-bezier(.54,1.85,.5,1); -moz-transition-duration: 0.4s; -moz-transition-property: transform, background-color; - box-shadow: 0px 2px 5px rgba(0, 0, 0, 0.3), 0px 0px 0 1px rgba(0, 0, 0, 0.4); + box-shadow: 0 2px 5px rgba(0, 0, 0, 0.3), 0 0 0 1px rgba(0, 0, 0, 0.4); pointer-events: none; - margin-left: 0px; - margin-left: 1px; + margin-left: 0; } /* Checked Knob (Blue Style) */ @@ -944,7 +939,7 @@ input[type="checkbox"].ios-switch:checked + div > div { -webkit-transform: translate3d(20px, 0, 0); -moz-transform: translate3d(20px, 0, 0); background-color: #ffffff; - box-shadow: 0px 2px 5px rgba(0, 0, 0, 0.3), 0px 0px 0 1px rgba(8, 80, 172,1); + box-shadow: 0 2px 5px rgba(0, 0, 0, 0.3), 0 0 0 1px rgba(8, 80, 172,1); } /* Tiny Knob */ @@ -957,7 +952,7 @@ input[type="checkbox"].tinyswitch.ios-switch + div > div { input[type="checkbox"].tinyswitch.ios-switch:checked + div > div { -webkit-transform: translate3d(16px, 0, 0); -moz-transform: translate3d(16px, 0, 0); - box-shadow: 0px 2px 5px rgba(0, 0, 0, 0.3), 0px 0px 0 1px rgba(8, 80, 172,1); + box-shadow: 0 2px 5px rgba(0, 0, 0, 0.3), 0 0 0 1px rgba(8, 80, 172,1); } /* Big Knob */ @@ -970,25 +965,25 @@ input[type="checkbox"].bigswitch.ios-switch + div > div { input[type="checkbox"].bigswitch.ios-switch:checked + div > div { -webkit-transform: translate3d(25px, 0, 0); -moz-transform: translate3d(16px, 0, 0); - box-shadow: 0px 4px 8px rgba(0, 0, 0, 0.3), 0px 0px 0 1px rgba(8, 80, 172,1); + box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3), 0 0 0 1px rgba(8, 80, 172,1); } /* Green Knob */ input[type="checkbox"].green.ios-switch:checked + div > div , html.isCF input[type="checkbox"].ios-switch:checked + div > div { - box-shadow: 0px 2px 5px rgba(0, 0, 0, 0.3), 0 0 0 1px rgba(0, 162, 63,1); + box-shadow: 0 2px 5px rgba(0, 0, 0, 0.3), 0 0 0 1px rgba(0, 162, 63,1); } /* Orange Knob */ input[type="checkbox"].orange.ios-switch:checked + div > div , html.isBF input[type="checkbox"].ios-switch:checked + div > div { - box-shadow: 0px 2px 5px rgba(0, 0, 0, 0.3), 0 0 0 1px rgba(158, 100, 0,1); + box-shadow: 0 2px 5px rgba(0, 0, 0, 0.3), 0 0 0 1px rgba(158, 100, 0,1); } /* Blue Knob */ input[type="checkbox"].blue.ios-switch:checked + div > div , html.isINAV input[type="checkbox"].ios-switch:checked + div > div { - box-shadow: 0px 2px 5px rgba(0, 0, 0, 0.3), 0 0 0 1px rgba(8, 80, 172,1); + box-shadow: 0 2px 5px rgba(0, 0, 0, 0.3), 0 0 0 1px rgba(8, 80, 172,1); } html.isBF .config-graph h4 span, @@ -1009,10 +1004,7 @@ html.isINAV .log-graph-config h3 span { .config-graph h4 span, .log-graph-config h3 span { /* background-color: rgba(239,187,0,0.5); */ - padding-top: 2px; - padding-bottom: 4px; - padding-left: 4px; - padding-right: 4px; + padding: 2px 4px 4px; border-radius: 5px; margin-right:3px; background-image: linear-gradient(to bottom,#fff8e9 0,#ffbb00 100%); @@ -1027,16 +1019,13 @@ div#lap-timer { border-radius: 5px; padding: 5px; color: #bbb; - border-style: solid; - border-width: thin; + border: thin solid; } tr.lap-timer-heading td { font-style: italic; - border-bottom-color: white; - border-bottom-width: thin; /* text-decoration: underline; */ - border-bottom-style: solid; + border-bottom: thin solid white; } table#lap-timer-laps { diff --git a/index.html b/index.html index 41951810..2f619049 100755 --- a/index.html +++ b/index.html @@ -292,7 +292,7 @@

Log sync

- +
@@ -617,12 +617,12 @@ - + Setpoint Weight Acceleration Limit - + diff --git a/js/main.js b/js/main.js index 2a056d7f..0b9e02dd 100644 --- a/js/main.js +++ b/js/main.js @@ -19,7 +19,6 @@ function BlackboxLogViewer() { GRAPH_STATE_PLAY = 1, SMALL_JUMP_TIME = 100 * 1000, - LARGE_JUMP_TIME = 1000 * 1000, PLAYBACK_MIN_RATE = 5, PLAYBACK_MAX_RATE = 300, PLAYBACK_DEFAULT_RATE = 100, @@ -75,6 +74,9 @@ function BlackboxLogViewer() { analyserCanvas = $("#analyserCanvas")[0], analyserStickCanvas = $("#analyserStickCanvas")[0], craftCanvas = $("#craftCanvas")[0], + statusBar = $('#status-bar'), + html = $('html'), + videoURL = false, videoOffset = 0.0, @@ -99,7 +101,7 @@ function BlackboxLogViewer() { graphZoom = GRAPH_DEFAULT_ZOOM, lastGraphZoom = GRAPH_DEFAULT_ZOOM; // QuickZoom function. - + function blackboxTimeFromVideoTime() { return (video.currentTime - videoOffset) * 1000000 + flightLog.getMinTime(); } @@ -182,14 +184,14 @@ function BlackboxLogViewer() { } // Update flight mode flags on status bar - $("#status-bar .flight-mode").text( + $(".flight-mode", statusBar).text( fieldPresenter.decodeFieldToFriendly(null, 'flightModeFlags', currentFlightMode, null) ); // update time field on status bar $(".graph-time").val(formatTime((currentBlackboxTime-flightLog.getMinTime())/1000, true)); if(hasMarker) { - $("#status-bar .marker-offset").text('Marker Offset ' + formatTime((currentBlackboxTime-markerTime)/1000, true) + 'ms ' + (1000000/(currentBlackboxTime-markerTime)).toFixed(0) + "Hz"); + $(".marker-offset", statusBar).text('Marker Offset ' + formatTime((currentBlackboxTime-markerTime)/1000, true) + 'ms ' + (1000000/(currentBlackboxTime-markerTime)).toFixed(0) + "Hz"); } // Update the Legend Values @@ -272,13 +274,13 @@ function BlackboxLogViewer() { function renderLogFileInfo(file) { $(".log-filename").text(file.name); - - var + + var logIndexContainer = $(".log-index"), logIndexPicker, logCount = flightLog.getLogCount(), index; - + logIndexContainer.empty(); if (logCount > 1) { @@ -287,7 +289,7 @@ function BlackboxLogViewer() { logIndexPicker.change(function() { selectLog(parseInt($(this).val(), 10)); if(graph) { - (hasAnalyserFullscreen)?$("html").addClass("has-analyser-fullscreen"):$("html").removeClass("has-analyser-fullscreen"); + (hasAnalyserFullscreen)?html.addClass("has-analyser-fullscreen"):html.removeClass("has-analyser-fullscreen"); graph.setAnalyser(hasAnalyserFullscreen); } }); @@ -359,10 +361,10 @@ function BlackboxLogViewer() { // Add log version information to status bar var sysConfig = flightLog.getSysConfig(); - $('#status-bar .version').text( ((sysConfig['Craft name']!=null)?(sysConfig['Craft name'] + ' : '):'') + + $('.version', statusBar).text( ((sysConfig['Craft name']!=null)?(sysConfig['Craft name'] + ' : '):'') + ((sysConfig['Firmware revision']!=null)?(sysConfig['Firmware revision']):'')); - $('#status-bar .looptime').text( stringLoopTime(sysConfig.looptime, sysConfig.pid_process_denom, sysConfig.unsynced_fast_pwm, sysConfig.motor_pwm_rate)); - $('#status-bar .lograte').text( ((sysConfig['frameIntervalPDenom']!=null && sysConfig['frameIntervalPNum']!=null)?( 'Sample Rate : ' + sysConfig['frameIntervalPNum'] +'/' + sysConfig['frameIntervalPDenom']):'')); + $('.looptime', statusBar).text( stringLoopTime(sysConfig.looptime, sysConfig.pid_process_denom, sysConfig.unsynced_fast_pwm, sysConfig.motor_pwm_rate)); + $('.lograte', statusBar).text( ((sysConfig['frameIntervalPDenom']!=null && sysConfig['frameIntervalPNum']!=null)?( 'Sample Rate : ' + sysConfig['frameIntervalPNum'] +'/' + sysConfig['frameIntervalPDenom']):'')); seekBar.setTimeRange(flightLog.getMinTime(), flightLog.getMaxTime(), currentBlackboxTime); seekBar.setActivityRange(flightLog.getSysConfig().minthrottle, flightLog.getSysConfig().maxthrottle); @@ -377,7 +379,8 @@ function BlackboxLogViewer() { function setGraphState(newState) { graphState = newState; - + var btnLogPlayPause = $(".log-play-pause"); + lastRenderTime = false; switch (newState) { @@ -385,13 +388,13 @@ function BlackboxLogViewer() { if (hasVideo) { video.play(); } - $(".log-play-pause span").attr('class', 'glyphicon glyphicon-pause'); + $("span", btnLogPlayPause).attr('class', 'glyphicon glyphicon-pause'); break; case GRAPH_STATE_PAUSED: if (hasVideo) { video.pause(); } - $(".log-play-pause span").attr('class', 'glyphicon glyphicon-play'); + $("span", btnLogPlayPause).attr('class', 'glyphicon glyphicon-play'); break; } @@ -474,7 +477,7 @@ function BlackboxLogViewer() { } else { //state defined, just set item hasConfigOverlay = (state)?true:false; } - (hasConfigOverlay)?$("html").addClass("has-config-overlay"):$("html").removeClass("has-config-overlay"); + html.toggleClass("has-config-overlay", hasConfigOverlay); } } @@ -574,7 +577,7 @@ function BlackboxLogViewer() { configuration = new Configuration(file, configurationDefaults, showConfigFile); // the configuration class will actually re-open the file as a text object. hasConfig = true; - (hasConfig)?$("html").addClass("has-config"):$("html").removeClass("has-config"); + html.toggleClass("has-config", hasConfig); } } catch(e) { @@ -597,16 +600,15 @@ function BlackboxLogViewer() { currentOffsetCache.log = file.name; // store the name of the loaded log file currentOffsetCache.index = null; // and clear the index - hasLog = true; - $("html").addClass("has-log"); - (hasCraft)?$("html").addClass("has-craft"):$("html").removeClass("has-craft"); - (hasTable)?$("html").addClass("has-table"):$("html").removeClass("has-table"); - (hasSticks)?$("html").addClass("has-sticks"):$("html").removeClass("has-sticks"); + hasLog = true; html.toggleClass("has-log", hasLog); + html.toggleClass("has-craft", hasCraft); + html.toggleClass("has-table", hasTable); + html.toggleClass("has-sticks", hasSticks); selectLog(null); if (graph) { - (hasAnalyserFullscreen)?$("html").addClass("has-analyser-fullscreen"):$("html").removeClass("has-analyser-fullscreen"); + (hasAnalyserFullscreen)?html.addClass("has-analyser-fullscreen"):html.removeClass("has-analyser-fullscreen"); graph.setAnalyser(hasAnalyserFullscreen); } @@ -638,8 +640,7 @@ function BlackboxLogViewer() { function videoLoaded(e) { hasVideo = true; - - $("html").addClass("has-video"); + html.toggleClass("has-video", hasVideo); setGraphState(GRAPH_STATE_PAUSED); invalidateGraph(); @@ -657,19 +658,19 @@ function BlackboxLogViewer() { function onLegendSelectionChange() { hasAnalyser = true; graph.setDrawAnalyser(hasAnalyser); - (hasAnalyser)?$("html").addClass("has-analyser"):$("html").removeClass("has-analyser"); + html.toggleClass("has-analyser", hasAnalyser); prefs.set('hasAnalyser', hasAnalyser); invalidateGraph(); } function setMarker(state) { // update marker field hasMarker = state; - (state)?$("html").addClass("has-marker"):$("html").removeClass("has-marker"); + html.toggleClass("has-marker",state); } function setFullscreen(state) { // update fullscreen status isFullscreen = state; - (state)?$("html").addClass("is-fullscreen"):$("html").removeClass("is-fullscreen"); + html.toggleClass("is-fullscreen",state); } this.getMarker = function() { // get marker field @@ -791,7 +792,7 @@ function BlackboxLogViewer() { // Get Latest Version Information $("#viewer-version").text('You are using version ' + VIEWER_VERSION); - $("#status-bar .viewer-version").text('v'+VIEWER_VERSION); + $(".viewer-version", statusBar).text('v'+VIEWER_VERSION); try { $.getJSON('https://api.github.com/repos/GaryKeeble/blackbox-log-viewer/releases/latest',{},function(data){ latestVersion = data; @@ -819,36 +820,27 @@ function BlackboxLogViewer() { prefs.get('hasCraft', function(item) { if (item) { hasCraft = item; - (hasCraft)?$("html").addClass("has-craft"):$("html").removeClass("has-craft"); + html.toggleClass("has-craft", hasCraft); } }); prefs.get('hasSticks', function(item) { if (item) { hasSticks = item; - (hasSticks)?$("html").addClass("has-sticks"):$("html").removeClass("has-sticks"); + html.toggleClass("has-sticks", hasSticks); } }); - prefs.get('hasTable', function(item) { if (item) { hasTable = item; - (hasTable)?$("html").addClass("has-table"):$("html").removeClass("has-table"); + html.toggleClass("has-table", hasTable); } }); - /** - prefs.get('hasAnalyser', function(item) { - if (item) { - hasAnalyser = item; - (hasAnalyser)?$("html").addClass("has-analyser"):$("html").removeClass("has-analyser"); - } - }); - **/ // Reset the analyser window on application startup. hasAnalyser = false; - (hasAnalyser)?$("html").addClass("has-analyser"):$("html").removeClass("has-analyser"); + html.toggleClass("has-analyser", hasAnalyser); $(".file-open").change(function(e) { var @@ -892,32 +884,32 @@ function BlackboxLogViewer() { // New View Controls $(".view-video").click(function() { viewVideo = !viewVideo; - (!viewVideo)?$("html").addClass("video-hidden"):$("html").removeClass("video-hidden"); + html.toggleClass("video-hidden", !viewVideo); }); $(".view-craft").click(function() { hasCraft = !hasCraft; - (hasCraft)?$("html").addClass("has-craft"):$("html").removeClass("has-craft"); + html.toggleClass("has-craft", hasCraft); prefs.set('hasCraft', hasCraft); }); $(".view-sticks").click(function() { hasSticks = !hasSticks; graph.setDrawSticks(hasSticks); - (hasSticks)?$("html").addClass("has-sticks"):$("html").removeClass("has-sticks"); + html.toggleClass("has-sticks", hasSticks); prefs.set('hasSticks', hasSticks); invalidateGraph(); }); $(".view-table").click(function() { hasTable = !hasTable; - (hasTable)?$("html").addClass("has-table"):$("html").removeClass("has-table"); + html.toggleClass("has-table", hasTable); prefs.set('hasTable', hasTable); }); $(".view-analyser-sticks").click(function() { hasAnalyserSticks = !hasAnalyserSticks; - (hasAnalyserSticks)?$("html").addClass("has-analyser-sticks"):$("html").removeClass("has-analyser-sticks"); + html.toggleClass("has-analyser-sticks", hasAnalyserSticks); prefs.set('hasAnalyserSticks', hasAnalyserSticks); }); @@ -926,7 +918,7 @@ function BlackboxLogViewer() { hasAnalyser = !hasAnalyser; } else hasAnalyser = false; graph.setDrawAnalyser(hasAnalyser); - (hasAnalyser)?$("html").addClass("has-analyser"):$("html").removeClass("has-analyser"); + html.toggleClass("has-analyser", hasAnalyser); prefs.set('hasAnalyser', hasAnalyser); invalidateGraph(); }); @@ -935,7 +927,7 @@ function BlackboxLogViewer() { if(hasAnalyser) { hasAnalyserFullscreen = !hasAnalyserFullscreen; } else hasAnalyserFullscreen = false; - (hasAnalyserFullscreen)?$("html").addClass("has-analyser-fullscreen"):$("html").removeClass("has-analyser-fullscreen"); + (hasAnalyserFullscreen)?html.addClass("has-analyser-fullscreen"):html.removeClass("has-analyser-fullscreen"); graph.setAnalyser(hasAnalyserFullscreen); invalidateGraph(); }); @@ -1192,28 +1184,28 @@ function BlackboxLogViewer() { userSettingsDialog.show(flightLog, userSettings); }); - $("#status-bar .marker-offset").click(function(e) { + $(".marker-offset", statusBar).click(function(e) { setCurrentBlackboxTime(markerTime); invalidateGraph(); }); for(var i=1; i< 9; i++) { // Loop through all the bookmarks. - $('#status-bar .bookmark-'+i).click(function(e) { + $('.bookmark-'+i, statusBar).click(function() { setCurrentBlackboxTime(bookmarkTimes[parseInt(this.className.slice(-1))]); invalidateGraph(); }); } - $('#status-bar .bookmark-clear').click(function(e) { + $('.bookmark-clear', statusBar).click(function() { bookmarkTimes = null; for(var i=1; i<=9; i++) { - $('#status-bar .bookmark-'+ i).css('visibility', 'hidden' ); + $('.bookmark-'+ i, statusBar).css('visibility', 'hidden' ); } - $('#status-bar .bookmark-clear').css('visibility', 'hidden' ); + $('.bookmark-clear', statusBar).css('visibility', 'hidden' ); invalidateGraph(); }); - $('#status-bar .configuration-file-name').click(function(e) { + $('.configuration-file-name', statusBar).click(function(e) { showConfigFile(true); // show the config file e.preventDefault(); }); @@ -1263,8 +1255,8 @@ function BlackboxLogViewer() { $(".log-seek-bar").css("top", newHeight+"px"); $(".log-field-values").css("top", newHeight+"px"); invalidateGraph(); - }; - + } + $(document).on("mousewheel", function(e) { if (graph && $(e.target).parents('.modal').length == 0 && $(e.target).attr('id') == 'graphCanvas') { var delta = Math.max(-1, Math.min(1, (e.originalEvent.wheelDelta))); @@ -1320,17 +1312,17 @@ function BlackboxLogViewer() { case "M".charCodeAt(0): if (e.altKey && hasMarker && hasVideo && hasLog) { // adjust the video sync offset and remove marker try{ - setVideoOffset(videoOffset + (stringTimetoMsec($("#status-bar .marker-offset").text()) / 1000000), true); + setVideoOffset(videoOffset + (stringTimetoMsec($(".marker-offset", statusBar).text()) / 1000000), true); } catch(e) { console.log('Failed to set video offset'); } } else { // Add a marker to graph window markerTime = currentBlackboxTime; - $("#status-bar .marker-offset").text('Marker Offset ' + formatTime(0) + 'ms'); + $(".marker-offset", statusBar).text('Marker Offset ' + formatTime(0) + 'ms'); } setMarker(!hasMarker); - $("#status-bar .marker-offset").css('visibility', (hasMarker)?'visible':'hidden'); + $(".marker-offset", statusBar).css('visibility', (hasMarker)?'visible':'hidden'); invalidateGraph(); e.preventDefault(); break; @@ -1344,7 +1336,7 @@ function BlackboxLogViewer() { case "T".charCodeAt(0): hasTableOverlay = !hasTableOverlay; - (hasTableOverlay)?$("html").addClass("has-table-overlay"):$("html").removeClass("has-table-overlay"); + html.toggleClass("has-table-overlay", hasTableOverlay); if (hasTableOverlay) hadTable = hasTable; // Store the state of the table view when quickshow selected @@ -1355,7 +1347,7 @@ function BlackboxLogViewer() { hasTable = false; // return table state when we remove quickshow. } - (hasTable)?$("html").addClass("has-table"):$("html").removeClass("has-table"); + html.toggleClass("has-table", hasTable); invalidateGraph(); e.preventDefault(); break; @@ -1394,9 +1386,9 @@ function BlackboxLogViewer() { if(e.which==48) { bookmarkTimes = null; for(var i=1; i<=9; i++) { - $('#status-bar .bookmark-'+ i).css('visibility', 'hidden' ); + $('.bookmark-'+ i, statusBar).css('visibility', 'hidden' ); } - $('#status-bar .bookmark-clear').css('visibility', 'hidden' ); + $('.bookmark-clear', statusBar).css('visibility', 'hidden' ); } else { if(bookmarkTimes==null) bookmarkTimes = new Array(); if (bookmarkTimes[e.which-48] == null) { @@ -1404,12 +1396,12 @@ function BlackboxLogViewer() { } else { bookmarkTimes[e.which-48] = null; // clear the bookmark } - $('#status-bar .bookmark-'+(e.which-48)).css('visibility', ((bookmarkTimes[e.which-48]!=null)?('visible'):('hidden')) ); + $('.bookmark-'+(e.which-48), statusBar).css('visibility', ((bookmarkTimes[e.which-48]!=null)?('visible'):('hidden')) ); var countBookmarks = 0; for(var i=0; i<=9; i++) { countBookmarks += (bookmarkTimes[i]!=null)?1:0; } - $('#status-bar .bookmark-clear').css('visibility', ((countBookmarks>0)?('visible'):('hidden')) ); + $('.bookmark-clear', statusBar).css('visibility', ((countBookmarks>0)?('visible'):('hidden')) ); } invalidateGraph(); @@ -1447,7 +1439,7 @@ function BlackboxLogViewer() { var overrideStatus = ((userSettings.graphSmoothOverride)?'SMOOTH':'') + ((userSettings.graphSmoothOverride && userSettings.graphExpoOverride)?'|':'') + ((userSettings.graphExpoOverride)?'EXPO':'') + ((userSettings.graphSmoothOverride && userSettings.graphGridOverride)?'|':'') + ((userSettings.graphGridOverride)?'GRID':''); - $("#status-bar .overrides").text(overrideStatus); + $(".overrides", statusBar).text(overrideStatus); e.preventDefault(); } @@ -1468,7 +1460,7 @@ function BlackboxLogViewer() { var overrideStatus = ((userSettings.graphSmoothOverride)?'SMOOTH':'') + ((userSettings.graphSmoothOverride && userSettings.graphExpoOverride)?'|':'') + ((userSettings.graphExpoOverride)?'EXPO':'') + ((userSettings.graphSmoothOverride && userSettings.graphGridOverride)?'|':'') + ((userSettings.graphGridOverride)?'GRID':''); - $("#status-bar .overrides").text(overrideStatus); + $(".overrides", statusBar).text(overrideStatus); e.preventDefault(); } } catch(e) { @@ -1488,7 +1480,7 @@ function BlackboxLogViewer() { var overrideStatus = ((userSettings.graphSmoothOverride)?'SMOOTH':'') + ((userSettings.graphSmoothOverride && userSettings.graphExpoOverride)?'|':'') + ((userSettings.graphExpoOverride)?'EXPO':'') + ((userSettings.graphSmoothOverride && userSettings.graphGridOverride)?'|':'') + ((userSettings.graphGridOverride)?'GRID':''); - $("#status-bar .overrides").text(overrideStatus); + $(".overrides", statusBar).text(overrideStatus); e.preventDefault(); }