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){ 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'); var sensor_state = $('#sensor-status');
sensor_state.show(); sensor_state.show();

View file

@ -120,7 +120,7 @@
<label for="port-override">Port: <input id="port-override" type="text" value="/dev/rfcomm0"/></label> <label for="port-override">Port: <input id="port-override" type="text" value="/dev/rfcomm0"/></label>
</div> </div>
<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> </div>
</div> </div>

26
main.js
View file

@ -101,6 +101,32 @@ $(document).ready(function () {
function content_ready() { function content_ready() {
GUI.tab_switch_in_progress = false; 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) { switch (tab) {

View file

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

View file

@ -178,21 +178,6 @@ TABS.adjustments.initialize = function (callback) {
// translate to user-selected language // translate to user-selected language
localize(); 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 () { $('a.save').click(function () {

View file

@ -23,7 +23,6 @@ TABS.auxiliary.initialize = function (callback) {
$('#content').load("./tabs/auxiliary.html", process_html); $('#content').load("./tabs/auxiliary.html", process_html);
} }
MSP.send_message(MSP_codes.MSP_BOXNAMES, false, false, get_mode_ranges); MSP.send_message(MSP_codes.MSP_BOXNAMES, false, false, get_mode_ranges);
function createMode(modeIndex, modeId) { function createMode(modeIndex, modeId) {
@ -169,11 +168,6 @@ TABS.auxiliary.initialize = function (callback) {
// translate to user-selected language // translate to user-selected language
localize(); 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 () { $('a.save').click(function () {

View file

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

View file

@ -47,9 +47,6 @@ TABS.configuration.initialize = function (callback, scrollPosition) {
$('#content').load("./tabs/configuration.html", process_html); $('#content').load("./tabs/configuration.html", process_html);
} }
MSP.send_message(MSP_codes.MSP_IDENT, false, false, load_config); MSP.send_message(MSP_codes.MSP_IDENT, false, false, load_config);
function recalculate_cycles_sec() { function recalculate_cycles_sec() {
@ -67,12 +64,6 @@ TABS.configuration.initialize = function (callback, scrollPosition) {
// translate to user-selected language // translate to user-selected language
localize(); 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++) { for (var i = 0; i < mixerList.length; i++) {
mixer_list_e.append('<option value="' + (i + 1) + '">' + mixerList[i].name + '</option>'); mixer_list_e.append('<option value="' + (i + 1) + '">' + mixerList[i].name + '</option>');
@ -143,13 +134,13 @@ TABS.configuration.initialize = function (callback, scrollPosition) {
+ '</td><span>'); + '</td><span>');
radioGroups.push(features[i].group); radioGroups.push(features[i].group);
} else { } else {
row_e = $('<tr><td><input class="feature"' row_e = $('<tr><td><input class="feature toggle"'
+ i + i
+ '" name="' + '" name="'
+ features[i].name + features[i].name
+ '" title="' + '" title="'
+ features[i].name + features[i].name
+ '" type="checkbox" id="toggle"/></td><td><label for="feature-' + '" type="checkbox"/></td><td><label for="feature-'
+ i + i
+ '">' + '">'
+ features[i].name + 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 // loading tooltip
$(document).ready(function() { $(document).ready(function() {
$('.cf_tip').jBox('Tooltip', { $('.cf_tip').jBox('Tooltip', {

View file

@ -86,10 +86,6 @@ TABS.dataflash.initialize = function (callback) {
// translate to user-selected language // translate to user-selected language
localize(); 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; var supportsDataflash = DATAFLASH.totalSize > 0;

View file

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

View file

@ -17,18 +17,6 @@ TABS.firmware_flasher.initialize = function (callback) {
// translate to user-selected language // translate to user-selected language
localize(); 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 // parsing hex in different thread
var worker = new Worker('./js/workers/hex_parser.js'); 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); MSP.send_message(MSP_codes.MSP_STATUS, false, false, load_html);
function process_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 // translate to user-selected language
localize(); localize();

View file

@ -43,11 +43,6 @@ TABS.led_strip.initialize = function (callback, scrollPosition) {
localize(); 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 // Build Grid
var theHTML = []; var theHTML = [];
var theHTMLlength = 0; var theHTMLlength = 0;

View file

@ -30,12 +30,6 @@ TABS.logging.initialize = function (callback) {
// translate to user-selected language // translate to user-selected language
localize(); 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.log_file').click(prepare_file);

View file

@ -47,11 +47,6 @@ TABS.modes.initialize = function (callback) {
// translate to user-selected language // translate to user-selected language
localize(); 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 // generate table from the supplied AUX names and AUX data
for (var i = 0; i < AUX_CONFIG.length; i++) { for (var i = 0; i < AUX_CONFIG.length; i++) {
var line = '<tr class="switches">'; var line = '<tr class="switches">';

View file

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

View file

@ -118,7 +118,7 @@
</div> </div>
<div class="notice"> <div class="notice">
<p i18n="motorsNotice"></p> <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>
<div class="cler-both"></div> <div class="cler-both"></div>
</div> </div>

View file

@ -156,23 +156,6 @@ TABS.motors.initialize = function (callback) {
// translate to user-selected language // translate to user-selected language
localize(); 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); update_model(CONFIG.multiType);

View file

@ -264,11 +264,6 @@ TABS.pid_tuning.initialize = function (callback) {
// translate to user-selected language // translate to user-selected language
localize(); 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 // loading tooltip
$(document).ready(function() { $(document).ready(function() {
$('.cf_tip').jBox('Tooltip', { $('.cf_tip').jBox('Tooltip', {

View file

@ -207,27 +207,8 @@ TABS.ports.initialize = function (callback, scrollPosition) {
localize(); 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(); 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); $('a.save').click(on_save_handler);
// status data pulled via separate timer with static speed // 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 // translate to user-selected language
localize(); 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 // fill in data from RC_tuning
$('.tunings .throttle input[name="mid"]').val(RC_tuning.throttle_MID.toFixed(2)); $('.tunings .throttle input[name="mid"]').val(RC_tuning.throttle_MID.toFixed(2));
$('.tunings .throttle input[name="expo"]').val(RC_tuning.throttle_EXPO.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 // translate to user-selected language
localize(); 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 // disable graphs for sensors that are missing
var checkboxes = $('.tab-sensors .info .checkboxes input'); var checkboxes = $('.tab-sensors .info .checkboxes input');
if (!bit_check(CONFIG.activeSensors, 1)) { // baro if (!bit_check(CONFIG.activeSensors, 1)) { // baro

View file

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

View file

@ -189,22 +189,6 @@ TABS.servos.initialize = function (callback) {
// translate to user-selected language // translate to user-selected language
localize(); 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 // status data pulled via separate timer with static speed
GUI.interval_add('status_pull', function () { GUI.interval_add('status_pull', function () {
MSP.send_message(MSP_codes.MSP_STATUS); MSP.send_message(MSP_codes.MSP_STATUS);

View file

@ -35,14 +35,6 @@ TABS.setup.initialize = function (callback) {
MSP.send_message(MSP_codes.MSP_ACC_TRIM, false, false, load_status); MSP.send_message(MSP_codes.MSP_ACC_TRIM, false, false, load_status);
function process_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 // translate to user-selected language
localize(); localize();