Cleaned up show / hide PID code a bunch.

10.3.x-maintenance
Michael Keller 2016-07-01 10:51:47 +12:00
parent cf04dd6587
commit ce9791f148
3 changed files with 28 additions and 24 deletions

View File

@ -754,6 +754,12 @@
"pidTuningName": {
"message": "Name"
},
"pidTuningShowAllPids": {
"message": "Show all PIDs"
},
"pidTuningHideUnusedPids": {
"message": "Hide unused PIDs"
},
"pidTuningProportional": {
"message": "Proportional"
},
@ -781,16 +787,16 @@
"pidTuningTPABreakPoint": {
"message": "TPA Breakpoint"
},
"pidTuningFilter": {
"pidTuningFilter": {
"message": "Filter"
},
"pidTuningFilterFrequency": {
"pidTuningFilterFrequency": {
"message": "Frequency"
},
"rcCurve": {
"pidTuningRcCurve": {
"message": "RC Curve"
},
"rcYawCurve": {
"pidTuningRcYawCurve": {
"message": "RC Yaw Curve"
},
"throttle": {

View File

@ -226,7 +226,7 @@
<table class="rc_curve cf">
<thead>
<tr>
<th i18n="rcCurve"></th>
<th i18n="pidTuningRcCurve"></th>
</tr>
</thead>
</tbody>
@ -247,7 +247,7 @@
<table class="rc_yaw_curve cf">
<thead>
<tr>
<th i18n="rcYawCurve"></th>
<th i18n="pidTuningRcYawCurve"></th>
</tr>
</thead>
</tbody>

View File

@ -316,29 +316,27 @@ TABS.pid_tuning.initialize = function (callback) {
localize();
var showAllButton = $('#showAllPids');
var showAllMsg = "Show all PIDs";
var hideUnusedMsg = "Hide unused PIDs";
var showAllMsg = chrome.i18n.getMessage("pidTuningShowAllPids");
var hideUnusedMsg = chrome.i18n.getMessage("pidTuningHideUnusedPids");
if (!TABS.pid_tuning.showAllPids) {
hideUnusedPids();
showAllButton.text(showAllMsg);
} else {
showAllPids();
showAllButton.text(hideUnusedMsg);
function updatePidDisplay() {
if (!TABS.pid_tuning.showAllPids) {
hideUnusedPids();
showAllButton.text(showAllMsg);
} else {
showAllPids();
showAllButton.text(hideUnusedMsg);
}
}
$('#showAllPids').on('click', function(){
if($(this).text() == showAllMsg) {
showAllPids();
$(this).text(hideUnusedMsg);
updatePidDisplay();
TABS.pid_tuning.showAllPids = true;
} else {
hideUnusedPids();
$(this).text(showAllMsg);
showAllButton.on('click', function(){
TABS.pid_tuning.showAllPids = !TABS.pid_tuning.showAllPids;
TABS.pid_tuning.showAllPids = false;
}
updatePidDisplay();
});
$('#resetPIDs').on('click', function(){