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

Fix repeated documentation link generation. Fixed repeated switchery

checkbox code.
This commit is contained in:
Dominic Clifton 2015-11-09 23:01:42 +00:00
parent 1f4838c5e2
commit 8324a2c002
25 changed files with 49 additions and 218 deletions

View file

@ -135,23 +135,6 @@ $(document).ready(function () {
});
/** toggle switch **/
var elems = Array.prototype.slice.call(document.querySelectorAll('#togglesmall'));
elems.forEach(function(html) {
var switchery = new Switchery(html,
{
size: 'small',
color: '#59aa29',
secondaryColor: '#c4c4c4'
});
});
/** toggle switch END **/
});
@ -276,14 +259,6 @@ function onConnect() {
if ("CLFL" == CONFIG.flightControllerIdentifier){
/* placing this elsewhere
documentationButton.show();
var documentationButton = $('div#content #button-documentation');
documentationButton.html("Documentation for "+CONFIG.flightControllerVersion);
documentationButton.attr("href","https://github.com/cleanflight/cleanflight/tree/v{0}/docs".format(CONFIG.flightControllerVersion));
/* */
var sensor_state = $('#sensor-status');
sensor_state.show();

View file

@ -120,7 +120,7 @@
<label for="port-override">Port: <input id="port-override" type="text" value="/dev/rfcomm0"/></label>
</div>
<div>
<label><input class="auto_connect" type="checkbox" id="togglesmall" /><span class="auto_connect" i18n="autoConnect"></span></label>
<label><input class="auto_connect togglesmall" type="checkbox"/><span class="auto_connect" i18n="autoConnect"></span></label>
</div>
</div>
</div>

26
main.js
View file

@ -101,6 +101,32 @@ $(document).ready(function () {
function content_ready() {
GUI.tab_switch_in_progress = false;
$('.togglesmall').each(function(index, html) {
var switchery = new Switchery(html,
{
size: 'small',
color: '#59aa29',
secondaryColor: '#c4c4c4'
});
$(html).removeClass('togglesmall');
});
$('.toggle').each(function(index, html) {
var switchery = new Switchery(html,
{
color: '#59aa29',
secondaryColor: '#c4c4c4'
});
$(html).removeClass('toggle');
});
// Build link to in-use CF version documentation
var documentationButton = $('div#content #button-documentation');
documentationButton.html("Documentation for "+CONFIG.flightControllerVersion);
documentationButton.attr("href","https://github.com/cleanflight/cleanflight/tree/v{0}/docs".format(CONFIG.flightControllerVersion));
}
switch (tab) {

View file

@ -48,7 +48,7 @@
<tr class="adjustment">
<td class="info">
<div class="enabling">
<input type="checkbox" class="enable" id="toggle" />
<input type="checkbox" class="enable toggle"/>
</div>
</td>
<td class="channelInfo">

View file

@ -178,22 +178,7 @@ TABS.adjustments.initialize = function (callback) {
// translate to user-selected language
localize();
// locating link to used CF version
var documentationButton = $('div#content #button-documentation');
documentationButton.html("Documentation for "+CONFIG.flightControllerVersion);
documentationButton.attr("href","https://github.com/cleanflight/cleanflight/tree/v{0}/docs".format(CONFIG.flightControllerVersion));
// load switchery
var elems = Array.prototype.slice.call(document.querySelectorAll('#toggle'));
elems.forEach(function(html) {
var switchery = new Switchery(html,
{
color: '#59aa29',
secondaryColor: '#c4c4c4'
});
});
// UI Hooks
// UI Hooks
$('a.save').click(function () {
// update internal data structures based on current UI elements

View file

@ -23,7 +23,6 @@ TABS.auxiliary.initialize = function (callback) {
$('#content').load("./tabs/auxiliary.html", process_html);
}
MSP.send_message(MSP_codes.MSP_BOXNAMES, false, false, get_mode_ranges);
function createMode(modeIndex, modeId) {
@ -169,12 +168,7 @@ TABS.auxiliary.initialize = function (callback) {
// translate to user-selected language
localize();
// locating link to used CF version
var documentationButton = $('div#content #button-documentation');
documentationButton.html("Documentation for "+CONFIG.flightControllerVersion);
documentationButton.attr("href","https://github.com/cleanflight/cleanflight/tree/v{0}/docs".format(CONFIG.flightControllerVersion));
// UI Hooks
// UI Hooks
$('a.save').click(function () {
// update internal data structures based on current UI elements

View file

@ -48,7 +48,7 @@
<div class="disarm">
<div class="checkbox">
<div style="float:left; height:20px; margin-right:15px; margin-left:3px;">
<input type="checkbox" name="disarmkillswitch" id="toggle"/>
<input type="checkbox" name="disarmkillswitch" class="toggle"/>
</div><label for="disarmkillswitch">
<span class="freelabel" i18n="configurationDisarmKillSwitch"></span>
</label>
@ -284,7 +284,7 @@
</div>
<div class="checkbox">
<div class="numberspacer">
<input type="checkbox" name="multiwiicurrentoutput" id="toggle"/>
<input type="checkbox" name="multiwiicurrentoutput" class="toggle"/>
</div><label>
<span i18n="configurationBatteryMultiwiiCurrent"></span>
</label>

View file

@ -47,9 +47,6 @@ TABS.configuration.initialize = function (callback, scrollPosition) {
$('#content').load("./tabs/configuration.html", process_html);
}
MSP.send_message(MSP_codes.MSP_IDENT, false, false, load_config);
function recalculate_cycles_sec() {
@ -67,13 +64,7 @@ TABS.configuration.initialize = function (callback, scrollPosition) {
// translate to user-selected language
localize();
// locating link to used CF version
var documentationButton = $('div#content #button-documentation');
documentationButton.html("Documentation for "+CONFIG.flightControllerVersion);
documentationButton.attr("href","https://github.com/cleanflight/cleanflight/tree/v{0}/docs".format(CONFIG.flightControllerVersion));
var mixer_list_e = $('select.mixerList');
var mixer_list_e = $('select.mixerList');
for (var i = 0; i < mixerList.length; i++) {
mixer_list_e.append('<option value="' + (i + 1) + '">' + mixerList[i].name + '</option>');
}
@ -143,13 +134,13 @@ TABS.configuration.initialize = function (callback, scrollPosition) {
+ '</td><span>');
radioGroups.push(features[i].group);
} else {
row_e = $('<tr><td><input class="feature"'
row_e = $('<tr><td><input class="feature toggle"'
+ i
+ '" name="'
+ features[i].name
+ '" title="'
+ features[i].name
+ '" type="checkbox" id="toggle"/></td><td><label for="feature-'
+ '" type="checkbox"/></td><td><label for="feature-'
+ i
+ '">'
+ features[i].name
@ -367,18 +358,6 @@ TABS.configuration.initialize = function (callback, scrollPosition) {
// load switchery
var elems = Array.prototype.slice.call(document.querySelectorAll('#toggle'));
elems.forEach(function(html) {
var switchery = new Switchery(html,
{
color: '#59aa29',
secondaryColor: '#c4c4c4'
});
});
// loading tooltip
$(document).ready(function() {
$('.cf_tip').jBox('Tooltip', {

View file

@ -86,12 +86,8 @@ TABS.dataflash.initialize = function (callback) {
// translate to user-selected language
localize();
// locating link to used CF version
var documentationButton = $('div#content #button-documentation');
documentationButton.html("Documentation for "+CONFIG.flightControllerVersion);
documentationButton.attr("href","https://github.com/cleanflight/cleanflight/tree/v{0}/docs".format(CONFIG.flightControllerVersion));
if (TABS.dataflash.available) {
if (TABS.dataflash.available) {
var supportsDataflash = DATAFLASH.totalSize > 0;
$(".tab-dataflash").toggleClass("supported", supportsDataflash);

View file

@ -13,7 +13,7 @@
</tr>
<tr>
<td><label>
<input class="updating" type="checkbox" id="toggle" />
<input class="updating toggle" type="checkbox" />
<span i18n="firmwareFlasherNoReboot"></span>
</label>
</td>
@ -21,7 +21,7 @@
</tr>
<tr class="option flash_on_connect_wrapper">
<td><label>
<input class="flash_on_connect" type="checkbox" id="toggle" />
<input class="flash_on_connect toggle" type="checkbox" />
<span i18n="firmwareFlasherFlashOnConnect"></span>
</td>
</label>
@ -29,7 +29,7 @@
</tr>
<tr class="option">
<td><label>
<input class="erase_chip" type="checkbox" id="toggle" />
<input class="erase_chip toggle" type="checkbox" />
<span i18n="firmwareFlasherFullChipErase"></span>
</label>
</td>
@ -38,7 +38,7 @@
<tr class="option manual_baud_rate">
<td>
<label>
<input class="flash_manual_baud" type="checkbox" id="toggle" />
<input class="flash_manual_baud toggle" type="checkbox" />
<span i18n="firmwareFlasherManualBaud"></span>
<select id="flash_manual_baud_rate" title="Baud Rate">
<option value="921600">921600</option>
@ -57,7 +57,7 @@
</tr>
<tr class="option noboarder">
<td><label>
<input class="show_development_releases" type="checkbox" id="toggle" />
<input class="show_development_releases toggle" type="checkbox" />
<span i18n="firmwareFlasherShowDevelopmentReleases"></span>
</label>
</td>

View file

@ -17,19 +17,7 @@ TABS.firmware_flasher.initialize = function (callback) {
// translate to user-selected language
localize();
// load switchery
var elems = Array.prototype.slice.call(document.querySelectorAll('#toggle'));
elems.forEach(function(html) {
var switchery = new Switchery(html,
{
color: '#59aa29',
secondaryColor: '#c4c4c4'
});
});
function parse_hex(str, callback) {
function parse_hex(str, callback) {
// parsing hex in different thread
var worker = new Worker('./js/workers/hex_parser.js');

View file

@ -16,12 +16,6 @@ TABS.gps.initialize = function (callback) {
MSP.send_message(MSP_codes.MSP_STATUS, false, false, load_html);
function process_html() {
// locating link to used CF version
var documentationButton = $('div#content #button-documentation');
documentationButton.html("Documentation for "+CONFIG.flightControllerVersion);
documentationButton.attr("href","https://github.com/cleanflight/cleanflight/tree/v{0}/docs".format(CONFIG.flightControllerVersion));
// translate to user-selected language
localize();

View file

@ -43,11 +43,6 @@ TABS.led_strip.initialize = function (callback, scrollPosition) {
localize();
// locating link to used CF version
var documentationButton = $('div#content #button-documentation');
documentationButton.html("Documentation for "+CONFIG.flightControllerVersion);
documentationButton.attr("href","https://github.com/cleanflight/cleanflight/tree/v{0}/docs".format(CONFIG.flightControllerVersion));
// Build Grid
var theHTML = [];
var theHTMLlength = 0;

View file

@ -30,13 +30,7 @@ TABS.logging.initialize = function (callback) {
// translate to user-selected language
localize();
// locating link to used CF version
var documentationButton = $('div#content #button-documentation');
documentationButton.html("Documentation for "+CONFIG.flightControllerVersion);
documentationButton.attr("href","https://github.com/cleanflight/cleanflight/tree/v{0}/docs".format(CONFIG.flightControllerVersion));
// UI hooks
// UI hooks
$('a.log_file').click(prepare_file);
$('a.logging').click(function () {

View file

@ -47,11 +47,6 @@ TABS.modes.initialize = function (callback) {
// translate to user-selected language
localize();
// locating link to used CF version
var documentationButton = $('div#content #button-documentation');
documentationButton.html("Documentation for "+CONFIG.flightControllerVersion);
documentationButton.attr("href","https://github.com/cleanflight/cleanflight/tree/v{0}/docs".format(CONFIG.flightControllerVersion));
// generate table from the supplied AUX names and AUX data
for (var i = 0; i < AUX_CONFIG.length; i++) {
var line = '<tr class="switches">';

View file

@ -292,7 +292,6 @@
margin-bottom: 10px;
}
.tab-motors .motor_testing .notice input[type="checkbox"] {
vertical-align: middle;
margin-right: 10px;
.tab-motors .motor_testing .notice .motorsEnableTestMode {
margin-left: 10px;
}

View file

@ -118,7 +118,7 @@
</div>
<div class="notice">
<p i18n="motorsNotice"></p>
<input id="motorsEnableTestMode" type="checkbox" /><label for="motorsEnableTestMode" i18n="motorsEnableControl"></label>
<label><input id="motorsEnableTestMode" class="toggle" type="checkbox"/><span class="motorsEnableTestMode" i18n="motorsEnableControl"></span></label>
</div>
<div class="cler-both"></div>
</div>

View file

@ -156,24 +156,7 @@ TABS.motors.initialize = function (callback) {
// translate to user-selected language
localize();
// locating link to used CF version
var documentationButton = $('div#content #button-documentation');
documentationButton.html("Documentation for "+CONFIG.flightControllerVersion);
documentationButton.attr("href","https://github.com/cleanflight/cleanflight/tree/v{0}/docs".format(CONFIG.flightControllerVersion));
// load switchery
var elems = Array.prototype.slice.call(document.querySelectorAll('#motorsEnableTestMode'));
elems.forEach(function(html) {
var switchery = new Switchery(html,
{
color: '#59aa29',
size: 'small',
secondaryColor: '#c4c4c4'
});
});
$('#motorsEnableTestMode').prop('disabled', 'true');
$('#motorsEnableTestMode').prop('disabled', 'true');
update_model(CONFIG.multiType);

View file

@ -264,11 +264,6 @@ TABS.pid_tuning.initialize = function (callback) {
// translate to user-selected language
localize();
// locating link to used CF version
var documentationButton = $('div#content #button-documentation');
documentationButton.html("Documentation for "+CONFIG.flightControllerVersion);
documentationButton.attr("href","https://github.com/cleanflight/cleanflight/tree/v{0}/docs".format(CONFIG.flightControllerVersion));
// loading tooltip
$(document).ready(function() {
$('.cf_tip').jBox('Tooltip', {

View file

@ -207,27 +207,8 @@ TABS.ports.initialize = function (callback, scrollPosition) {
localize();
// locating link to used CF version
var documentationButton = $('div#content #button-documentation');
documentationButton.html("Documentation for "+CONFIG.flightControllerVersion);
documentationButton.attr("href","https://github.com/cleanflight/cleanflight/tree/v{0}/docs".format(CONFIG.flightControllerVersion));
update_ui();
// load switchery
var elems = Array.prototype.slice.call(document.querySelectorAll('.togglesmall'));
elems.forEach(function(html) {
var switchery = new Switchery(html,
{ className: 'switcherymid',
color: '#59aa29',
secondaryColor: '#c4c4c4'
});
}); // load switchery END
$('a.save').click(on_save_handler);
// status data pulled via separate timer with static speed

View file

@ -39,12 +39,6 @@ TABS.receiver.initialize = function (callback) {
// translate to user-selected language
localize();
// locating link to used CF version
var documentationButton = $('div#content #button-documentation');
documentationButton.html("Documentation for "+CONFIG.flightControllerVersion);
documentationButton.attr("href","https://github.com/cleanflight/cleanflight/tree/v{0}/docs".format(CONFIG.flightControllerVersion));
// fill in data from RC_tuning
$('.tunings .throttle input[name="mid"]').val(RC_tuning.throttle_MID.toFixed(2));
$('.tunings .throttle input[name="expo"]').val(RC_tuning.throttle_EXPO.toFixed(2));

View file

@ -184,24 +184,6 @@ TABS.sensors.initialize = function (callback) {
// translate to user-selected language
localize();
// locating link to used CF version
var documentationButton = $('div#content #button-documentation');
documentationButton.html("Documentation for "+CONFIG.flightControllerVersion);
documentationButton.attr("href","https://github.com/cleanflight/cleanflight/tree/v{0}/docs".format(CONFIG.flightControllerVersion));
// load switchery
var elems = Array.prototype.slice.call(document.querySelectorAll('#toggle'));
elems.forEach(function(html) {
var switchery = new Switchery(html,
{
color: '#59aa29',
secondaryColor: '#c4c4c4'
});
});
// disable graphs for sensors that are missing
var checkboxes = $('.tab-sensors .info .checkboxes input');
if (!bit_check(CONFIG.activeSensors, 1)) { // baro

View file

@ -21,7 +21,7 @@
</tr>
</table>
<div class="live">
<input type="checkbox" id="toggle" /> <span i18n="servosLiveMode"></span>
<input type="checkbox" class="toggle" /> <span i18n="servosLiveMode"></span>
</div>
</div>
<div class="note require-upgrade">

View file

@ -189,22 +189,6 @@ TABS.servos.initialize = function (callback) {
// translate to user-selected language
localize();
// locating link to used CF version
var documentationButton = $('div#content #button-documentation');
documentationButton.html("Documentation for "+CONFIG.flightControllerVersion);
documentationButton.attr("href","https://github.com/cleanflight/cleanflight/tree/v{0}/docs".format(CONFIG.flightControllerVersion));
// load switchery
var elems = Array.prototype.slice.call(document.querySelectorAll('#toggle'));
elems.forEach(function(html) {
var switchery = new Switchery(html,
{
color: '#59aa29',
secondaryColor: '#c4c4c4'
});
});
// status data pulled via separate timer with static speed
GUI.interval_add('status_pull', function () {
MSP.send_message(MSP_codes.MSP_STATUS);

View file

@ -35,15 +35,7 @@ TABS.setup.initialize = function (callback) {
MSP.send_message(MSP_codes.MSP_ACC_TRIM, false, false, load_status);
function process_html() {
// locating link to used CF version
var documentationButton = $('div#content #button-documentation');
documentationButton.html("Documentation for "+CONFIG.flightControllerVersion);
documentationButton.attr("href","https://github.com/cleanflight/cleanflight/tree/v{0}/docs".format(CONFIG.flightControllerVersion));
// translate to user-selected language
// translate to user-selected language
localize();
if (semver.lt(CONFIG.apiVersion, CONFIGURATOR.backupRestoreMinApiVersionAccepted)) {