mirror of
https://github.com/betaflight/betaflight-configurator.git
synced 2025-07-17 05:15:21 +03:00
Fix critical and major bugs from Sonar in JS files
This commit is contained in:
parent
377149f06a
commit
c8b4958e8c
8 changed files with 93 additions and 98 deletions
|
@ -11,7 +11,6 @@
|
||||||
|
|
||||||
|
|
||||||
.dropdown {
|
.dropdown {
|
||||||
|
|
||||||
display: inline-block;
|
display: inline-block;
|
||||||
position: relative;
|
position: relative;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
|
@ -26,14 +25,10 @@
|
||||||
width:99%;
|
width:99%;
|
||||||
margin-bottom:7px;
|
margin-bottom:7px;
|
||||||
border: 1px solid;
|
border: 1px solid;
|
||||||
border-color: #ccc #ccc #ccc;
|
border-color: #ccc #ccc #ccc;
|
||||||
border-radius: 3px;
|
border-radius: 3px;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.dropdown:before, .dropdown:after {
|
.dropdown:before, .dropdown:after {
|
||||||
content: '';
|
content: '';
|
||||||
position: absolute;
|
position: absolute;
|
||||||
|
@ -46,12 +41,14 @@
|
||||||
border-color: #888 transparent;
|
border-color: #888 transparent;
|
||||||
pointer-events: none;
|
pointer-events: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
.dropdown:before {
|
.dropdown:before {
|
||||||
border-bottom-style: solid;
|
border-bottom-style: solid;
|
||||||
border-top: none;
|
border-top: none;
|
||||||
margin-top: -2px;
|
margin-top: -2px;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.dropdown:after {
|
.dropdown:after {
|
||||||
margin-top: 5px;
|
margin-top: 5px;
|
||||||
border-top-style: solid;
|
border-top-style: solid;
|
||||||
|
@ -63,7 +60,6 @@
|
||||||
overflow:visible;
|
overflow:visible;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
margin-top:0px;
|
margin-top:0px;
|
||||||
padding-bottom:0px;
|
|
||||||
padding: 1px 8px 6px 5px;
|
padding: 1px 8px 6px 5px;
|
||||||
height: 23px;
|
height: 23px;
|
||||||
line-height: 20px;
|
line-height: 20px;
|
||||||
|
@ -77,9 +73,8 @@
|
||||||
border: 0;
|
border: 0;
|
||||||
border-radius: 0;
|
border-radius: 0;
|
||||||
-webkit-appearance: none;
|
-webkit-appearance: none;
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.dropdown-select:focus {
|
.dropdown-select:focus {
|
||||||
z-index: 3;
|
z-index: 3;
|
||||||
width: 90%;
|
width: 90%;
|
||||||
|
@ -87,9 +82,9 @@
|
||||||
outline: 0px solid #49aff2;
|
outline: 0px solid #49aff2;
|
||||||
outline: 0px solid -webkit-focus-ring-color;
|
outline: 0px solid -webkit-focus-ring-color;
|
||||||
outline-offset: 5px;
|
outline-offset: 5px;
|
||||||
|
|
||||||
height:25px;
|
height:25px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.dropdown-select > option {
|
.dropdown-select > option {
|
||||||
margin: 3px;
|
margin: 3px;
|
||||||
padding: 6px 8px;
|
padding: 6px 8px;
|
||||||
|
@ -104,17 +99,18 @@
|
||||||
.lt-ie9 .dropdown {
|
.lt-ie9 .dropdown {
|
||||||
z-index: 1;
|
z-index: 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
.lt-ie9 .dropdown-select {
|
.lt-ie9 .dropdown-select {
|
||||||
z-index: -1;
|
z-index: -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
.lt-ie9 .dropdown-select:focus {
|
.lt-ie9 .dropdown-select:focus {
|
||||||
z-index: 3;
|
z-index: 3;
|
||||||
}
|
}
|
||||||
|
|
||||||
.dropdown-dark {
|
.dropdown-dark {
|
||||||
background: #636363; /* NEW2 */
|
background: #636363; /* NEW2 */
|
||||||
background: #3e403f; /* NEW */
|
background: #3e403f; /* NEW */
|
||||||
|
|
||||||
border-color: #111 #0a0a0a black;
|
border-color: #111 #0a0a0a black;
|
||||||
background-image: -webkit-linear-gradient(top, transparent, rgba(0, 0, 0, 0.4));
|
background-image: -webkit-linear-gradient(top, transparent, rgba(0, 0, 0, 0.4));
|
||||||
background-image: -moz-linear-gradient(top, transparent, rgba(0, 0, 0, 0.4));
|
background-image: -moz-linear-gradient(top, transparent, rgba(0, 0, 0, 0.4));
|
||||||
|
@ -123,28 +119,28 @@
|
||||||
-webkit-box-shadow: inset 0 1px rgba(255, 255, 255, 0.1), 0 1px 1px rgba(0, 0, 0, 0.2);
|
-webkit-box-shadow: inset 0 1px rgba(255, 255, 255, 0.1), 0 1px 1px rgba(0, 0, 0, 0.2);
|
||||||
box-shadow: inset 0 1px rgba(255, 255, 255, 0.1), 0 1px 1px rgba(0, 0, 0, 0.2);
|
box-shadow: inset 0 1px rgba(255, 255, 255, 0.1), 0 1px 1px rgba(0, 0, 0, 0.2);
|
||||||
color:#a6a6a6;
|
color:#a6a6a6;
|
||||||
text-shadow:0px 1px rgba(0, 0, 0, 0.25);
|
text-shadow:0px 1px rgba(0, 0, 0, 0.25);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.dropdown-dark:before {
|
.dropdown-dark:before {
|
||||||
border-bottom-color: #aaa;
|
border-bottom-color: #aaa;
|
||||||
}
|
}
|
||||||
|
|
||||||
.dropdown-dark:after {
|
.dropdown-dark:after {
|
||||||
border-top-color: #aaa;
|
border-top-color: #aaa;
|
||||||
}
|
}
|
||||||
|
|
||||||
.dropdown-dark .dropdown-select {
|
.dropdown-dark .dropdown-select {
|
||||||
color: #a6a6a6;
|
color: #a6a6a6;
|
||||||
text-shadow: 0 1px black;
|
text-shadow: 0 1px black;
|
||||||
/* Fallback for IE 8 */
|
/* Fallback for IE 8 */
|
||||||
background: #444;
|
background: #444;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.dropdown-dark .dropdown-select:focus {
|
.dropdown-dark .dropdown-select:focus {
|
||||||
color: #fff;
|
color: #fff;
|
||||||
}
|
}
|
||||||
|
|
||||||
.dropdown-dark .dropdown-select > option {
|
.dropdown-dark .dropdown-select > option {
|
||||||
background: #56ab1a;
|
background: #56ab1a;
|
||||||
text-shadow: 0 1px rgba(0, 0, 0, 0.4);
|
text-shadow: 0 1px rgba(0, 0, 0, 0.4);
|
||||||
|
|
|
@ -694,7 +694,6 @@
|
||||||
|
|
||||||
.tabarea {
|
.tabarea {
|
||||||
width: calc(100% - 22px);
|
width: calc(100% - 22px);
|
||||||
padding-left: 10px;
|
|
||||||
position: relative;
|
position: relative;
|
||||||
padding: 10px;
|
padding: 10px;
|
||||||
border: 1px solid var(--subtleAccent);
|
border: 1px solid var(--subtleAccent);
|
||||||
|
|
|
@ -54,7 +54,7 @@ CliAutoComplete.initialize = function($textarea, sendLine, writeToOutput) {
|
||||||
analytics.sendEvent(analytics.EVENT_CATEGORIES.APPLICATION, 'CliAutoComplete', this.configEnabled);
|
analytics.sendEvent(analytics.EVENT_CATEGORIES.APPLICATION, 'CliAutoComplete', this.configEnabled);
|
||||||
|
|
||||||
this.$textarea = $textarea;
|
this.$textarea = $textarea;
|
||||||
this.forceOpen = false,
|
this.forceOpen = false;
|
||||||
this.sendLine = sendLine;
|
this.sendLine = sendLine;
|
||||||
this.writeToOutput = writeToOutput;
|
this.writeToOutput = writeToOutput;
|
||||||
this.cleanup();
|
this.cleanup();
|
||||||
|
|
|
@ -8,9 +8,9 @@ var GUI_control = function () {
|
||||||
this.connecting_to = false;
|
this.connecting_to = false;
|
||||||
this.connected_to = false;
|
this.connected_to = false;
|
||||||
this.connect_lock = false;
|
this.connect_lock = false;
|
||||||
this.active_tab;
|
this.active_tab = null;
|
||||||
this.tab_switch_in_progress = false;
|
this.tab_switch_in_progress = false;
|
||||||
this.operating_system;
|
this.operating_system = null;
|
||||||
this.interval_array = [];
|
this.interval_array = [];
|
||||||
this.timeout_array = [];
|
this.timeout_array = [];
|
||||||
|
|
||||||
|
|
|
@ -8,19 +8,19 @@
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
var STM32_protocol = function () {
|
var STM32_protocol = function () {
|
||||||
this.baud;
|
this.baud = null;
|
||||||
this.options = {};
|
this.options = {};
|
||||||
this.callback; // ref
|
this.callback = null;
|
||||||
this.hex; // ref
|
this.hex = null;
|
||||||
this.verify_hex;
|
this.verify_hex = [];
|
||||||
|
|
||||||
this.receive_buffer;
|
this.receive_buffer = [];
|
||||||
|
|
||||||
this.bytes_to_read = 0; // ref
|
this.bytes_to_read = 0;
|
||||||
this.read_callback; // ref
|
this.read_callback = null;
|
||||||
|
|
||||||
this.upload_time_start;
|
this.upload_time_start = 0;
|
||||||
this.upload_process_alive;
|
this.upload_process_alive = false;
|
||||||
|
|
||||||
this.msp_connector = new MSPConnectorImpl();
|
this.msp_connector = new MSPConnectorImpl();
|
||||||
|
|
||||||
|
@ -282,18 +282,18 @@ STM32_protocol.prototype.retrieve = function (n_bytes, callback) {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
// Array = array of bytes that will be send over serial
|
// bytes_to_send = array of bytes that will be send over serial
|
||||||
// bytes_to_read = received bytes necessary to trigger read_callback
|
// bytes_to_read = received bytes necessary to trigger read_callback
|
||||||
// callback = function that will be executed after received bytes = bytes_to_read
|
// callback = function that will be executed after received bytes = bytes_to_read
|
||||||
STM32_protocol.prototype.send = function (Array, bytes_to_read, callback) {
|
STM32_protocol.prototype.send = function (bytes_to_send, bytes_to_read, callback) {
|
||||||
// flip flag
|
// flip flag
|
||||||
this.upload_process_alive = true;
|
this.upload_process_alive = true;
|
||||||
|
|
||||||
var bufferOut = new ArrayBuffer(Array.length);
|
var bufferOut = new ArrayBuffer(bytes_to_send.length);
|
||||||
var bufferView = new Uint8Array(bufferOut);
|
var bufferView = new Uint8Array(bufferOut);
|
||||||
|
|
||||||
// set Array values inside bufferView (alternative to for loop)
|
// set bytes_to_send values inside bufferView (alternative to for loop)
|
||||||
bufferView.set(Array);
|
bufferView.set(bytes_to_send);
|
||||||
|
|
||||||
// update references
|
// update references
|
||||||
this.bytes_to_read = bytes_to_read;
|
this.bytes_to_read = bytes_to_read;
|
||||||
|
|
|
@ -13,9 +13,9 @@
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
var STM32DFU_protocol = function () {
|
var STM32DFU_protocol = function () {
|
||||||
this.callback; // ref
|
this.callback = null;
|
||||||
this.hex; // ref
|
this.hex = null;
|
||||||
this.verify_hex;
|
this.verify_hex = [];
|
||||||
|
|
||||||
this.handle = null; // connection handle
|
this.handle = null; // connection handle
|
||||||
|
|
||||||
|
|
|
@ -277,7 +277,7 @@ OSD.getNumberOfProfiles = function() {
|
||||||
|
|
||||||
OSD.getCurrentPreviewProfile = function() {
|
OSD.getCurrentPreviewProfile = function() {
|
||||||
let osdprofile_e = $('.osdprofile-selector');
|
let osdprofile_e = $('.osdprofile-selector');
|
||||||
if (osdprofile_e) {
|
if (osdprofile_e.length > 0) {
|
||||||
return osdprofile_e.val();
|
return osdprofile_e.val();
|
||||||
} else {
|
} else {
|
||||||
return 0;
|
return 0;
|
||||||
|
|
|
@ -147,7 +147,7 @@ TABS.servos.initialize = function (callback) {
|
||||||
$('div.tab-servos table.fields tr:not(:first)').remove();
|
$('div.tab-servos table.fields tr:not(:first)').remove();
|
||||||
|
|
||||||
for (var servoIndex = 0; servoIndex < 8; servoIndex++) {
|
for (var servoIndex = 0; servoIndex < 8; servoIndex++) {
|
||||||
process_servos('Servo ' + servoIndex, '', servoIndex, false);
|
process_servos('Servo ' + servoIndex, '', servoIndex);
|
||||||
}
|
}
|
||||||
|
|
||||||
// UI hooks for dynamically generated elements
|
// UI hooks for dynamically generated elements
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue