1
0
Fork 0
mirror of https://github.com/betaflight/betaflight-configurator.git synced 2025-07-16 04:45:20 +03:00

Fix critical and major bugs from Sonar in JS files

This commit is contained in:
Miguel Angel Mulero Martinez 2019-11-04 16:37:54 +01:00
parent 377149f06a
commit c8b4958e8c
8 changed files with 93 additions and 98 deletions

View file

@ -11,7 +11,6 @@
.dropdown {
display: inline-block;
position: relative;
overflow: hidden;
@ -26,14 +25,10 @@
width:99%;
margin-bottom:7px;
border: 1px solid;
border-color: #ccc #ccc #ccc;
border-color: #ccc #ccc #ccc;
border-radius: 3px;
}
.dropdown:before, .dropdown:after {
content: '';
position: absolute;
@ -46,12 +41,14 @@
border-color: #888 transparent;
pointer-events: none;
}
.dropdown:before {
border-bottom-style: solid;
border-top: none;
margin-top: -2px;
}
.dropdown:after {
margin-top: 5px;
border-top-style: solid;
@ -63,7 +60,6 @@
overflow:visible;
width: 100%;
margin-top:0px;
padding-bottom:0px;
padding: 1px 8px 6px 5px;
height: 23px;
line-height: 20px;
@ -77,9 +73,8 @@
border: 0;
border-radius: 0;
-webkit-appearance: none;
}
.dropdown-select:focus {
z-index: 3;
width: 90%;
@ -87,9 +82,9 @@
outline: 0px solid #49aff2;
outline: 0px solid -webkit-focus-ring-color;
outline-offset: 5px;
height:25px;
}
.dropdown-select > option {
margin: 3px;
padding: 6px 8px;
@ -104,17 +99,18 @@
.lt-ie9 .dropdown {
z-index: 1;
}
.lt-ie9 .dropdown-select {
z-index: -1;
}
.lt-ie9 .dropdown-select:focus {
z-index: 3;
}
.dropdown-dark {
background: #636363; /* NEW2 */
background: #636363; /* NEW2 */
background: #3e403f; /* NEW */
border-color: #111 #0a0a0a black;
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));
@ -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);
box-shadow: inset 0 1px rgba(255, 255, 255, 0.1), 0 1px 1px rgba(0, 0, 0, 0.2);
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 {
border-bottom-color: #aaa;
}
.dropdown-dark:after {
border-top-color: #aaa;
}
.dropdown-dark .dropdown-select {
color: #a6a6a6;
text-shadow: 0 1px black;
/* Fallback for IE 8 */
background: #444;
}
.dropdown-dark .dropdown-select:focus {
color: #fff;
}
.dropdown-dark .dropdown-select > option {
background: #56ab1a;
text-shadow: 0 1px rgba(0, 0, 0, 0.4);

View file

@ -694,7 +694,6 @@
.tabarea {
width: calc(100% - 22px);
padding-left: 10px;
position: relative;
padding: 10px;
border: 1px solid var(--subtleAccent);

View file

@ -54,7 +54,7 @@ CliAutoComplete.initialize = function($textarea, sendLine, writeToOutput) {
analytics.sendEvent(analytics.EVENT_CATEGORIES.APPLICATION, 'CliAutoComplete', this.configEnabled);
this.$textarea = $textarea;
this.forceOpen = false,
this.forceOpen = false;
this.sendLine = sendLine;
this.writeToOutput = writeToOutput;
this.cleanup();

View file

@ -8,9 +8,9 @@ var GUI_control = function () {
this.connecting_to = false;
this.connected_to = false;
this.connect_lock = false;
this.active_tab;
this.active_tab = null;
this.tab_switch_in_progress = false;
this.operating_system;
this.operating_system = null;
this.interval_array = [];
this.timeout_array = [];

View file

@ -8,19 +8,19 @@
'use strict';
var STM32_protocol = function () {
this.baud;
this.baud = null;
this.options = {};
this.callback; // ref
this.hex; // ref
this.verify_hex;
this.callback = null;
this.hex = null;
this.verify_hex = [];
this.receive_buffer;
this.receive_buffer = [];
this.bytes_to_read = 0; // ref
this.read_callback; // ref
this.bytes_to_read = 0;
this.read_callback = null;
this.upload_time_start;
this.upload_process_alive;
this.upload_time_start = 0;
this.upload_process_alive = false;
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
// 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
this.upload_process_alive = true;
var bufferOut = new ArrayBuffer(Array.length);
var bufferOut = new ArrayBuffer(bytes_to_send.length);
var bufferView = new Uint8Array(bufferOut);
// set Array values inside bufferView (alternative to for loop)
bufferView.set(Array);
// set bytes_to_send values inside bufferView (alternative to for loop)
bufferView.set(bytes_to_send);
// update references
this.bytes_to_read = bytes_to_read;

View file

@ -13,9 +13,9 @@
'use strict';
var STM32DFU_protocol = function () {
this.callback; // ref
this.hex; // ref
this.verify_hex;
this.callback = null;
this.hex = null;
this.verify_hex = [];
this.handle = null; // connection handle

View file

@ -277,7 +277,7 @@ OSD.getNumberOfProfiles = function() {
OSD.getCurrentPreviewProfile = function() {
let osdprofile_e = $('.osdprofile-selector');
if (osdprofile_e) {
if (osdprofile_e.length > 0) {
return osdprofile_e.val();
} else {
return 0;

View file

@ -147,7 +147,7 @@ TABS.servos.initialize = function (callback) {
$('div.tab-servos table.fields tr:not(:first)').remove();
for (var servoIndex = 0; servoIndex < 8; servoIndex++) {
process_servos('Servo ' + servoIndex, '', servoIndex, false);
process_servos('Servo ' + servoIndex, '', servoIndex);
}
// UI hooks for dynamically generated elements