mirror of
https://github.com/iNavFlight/inav-configurator.git
synced 2025-07-21 15:25:19 +03:00
Made highlighting switchable via the config gear
This commit is contained in:
parent
0f27abf733
commit
f9a5eca69f
5 changed files with 50 additions and 12 deletions
|
@ -12,6 +12,9 @@
|
|||
"options_improve_configurator": {
|
||||
"message": "Send anonymous usage data to the developer team"
|
||||
},
|
||||
"options_showProfileParameters": {
|
||||
"message": "Highlight parameters that change when switching battery or control profiles"
|
||||
},
|
||||
"options_unit_type": {
|
||||
"message": "Set how the units render on the configurator only"
|
||||
},
|
||||
|
|
|
@ -12,6 +12,7 @@ var Settings = (function () {
|
|||
var settingName = input.data('setting');
|
||||
var inputUnit = input.data('unit');
|
||||
|
||||
if (globalSettings.showProfileParameters) {
|
||||
if (FC.isBatteryProfileParameter(settingName)) {
|
||||
input.css("background-color","#fef2d5");
|
||||
}
|
||||
|
@ -19,6 +20,7 @@ var Settings = (function () {
|
|||
if (FC.isControlProfileParameter(settingName)) {
|
||||
input.css("background-color","#d5ebfe");
|
||||
}
|
||||
}
|
||||
|
||||
return mspHelper.getSetting(settingName).then(function (s) {
|
||||
// Check if the input declares a parent
|
||||
|
|
31
main.js
31
main.js
|
@ -28,7 +28,8 @@ let globalSettings = {
|
|||
mapProviderType: null,
|
||||
mapApiKey: null,
|
||||
proxyURL: null,
|
||||
proxyLayer: null
|
||||
proxyLayer: null,
|
||||
showProfileParameters: null,
|
||||
};
|
||||
|
||||
$(document).ready(function () {
|
||||
|
@ -65,6 +66,12 @@ $(document).ready(function () {
|
|||
}
|
||||
globalSettings.proxyLayer = result.proxylayer;
|
||||
});
|
||||
chrome.storage.local.get('show_profile_parameters', function (result) {
|
||||
if (typeof result.show_profile_parameters === 'undefined') {
|
||||
result.show_profile_parameters = 1;
|
||||
}
|
||||
globalSettings.showProfileParameters = result.show_profile_parameters;
|
||||
});
|
||||
|
||||
// Resets the OSD units used by the unit coversion when the FC is disconnected.
|
||||
if (!CONFIGURATOR.connectionValid) {
|
||||
|
@ -327,11 +334,33 @@ $(document).ready(function () {
|
|||
googleAnalyticsConfig.setTrackingPermitted(check);
|
||||
});
|
||||
|
||||
$('div.show_profile_parameters input').change(function () {
|
||||
globalSettings.showProfileParameters = $(this).is(':checked');
|
||||
chrome.storage.local.set({
|
||||
'show_profile_parameters': globalSettings.showProfileParameters
|
||||
});
|
||||
|
||||
// Update CSS on select boxes
|
||||
if (globalSettings.showProfileParameters) {
|
||||
$('.dropdown-dark #profilechange').addClass('showProfileParams');
|
||||
$('.dropdown-dark #batteryprofilechange').addClass('showProfileParams');
|
||||
} else {
|
||||
$('.dropdown-dark #profilechange').removeClass('showProfileParams');
|
||||
$('.dropdown-dark #batteryprofilechange').removeClass('showProfileParams');
|
||||
}
|
||||
|
||||
// Horrible way to reload the tab
|
||||
const activeTab = $('#tabs li.active');
|
||||
activeTab.removeClass('active');
|
||||
activeTab.find('a').click();
|
||||
});
|
||||
|
||||
$('#ui-unit-type').val(globalSettings.unitType);
|
||||
$('#map-provider-type').val(globalSettings.mapProviderType);
|
||||
$('#map-api-key').val(globalSettings.mapApiKey);
|
||||
$('#proxyurl').val(globalSettings.proxyURL);
|
||||
$('#proxylayer').val(globalSettings.proxyLayer);
|
||||
$('#showProfileParameters').prop('checked', globalSettings.showProfileParameters);
|
||||
|
||||
// Set the value of the unit type
|
||||
// none, OSD, imperial, metric
|
||||
|
|
|
@ -146,10 +146,10 @@
|
|||
text-shadow: 0 1px rgba(0, 0, 0, 0.4);
|
||||
}
|
||||
|
||||
.dropdown-dark #profilechange {
|
||||
.dropdown-dark #profilechange.showProfileParams {
|
||||
color: #d5ebfe;
|
||||
}
|
||||
|
||||
.dropdown-dark #batteryprofilechange {
|
||||
.dropdown-dark #batteryprofilechange.showProfileParams {
|
||||
color: #fef2d5;
|
||||
}
|
|
@ -8,14 +8,18 @@
|
|||
<div class="spacer_box settings">
|
||||
<div class="checkbox notifications">
|
||||
<input id="notificationsOptions" type="checkbox" />
|
||||
<label for="notificationsOptions"><span
|
||||
data-i18n="options_receive_app_notifications"></span></label>
|
||||
<label for="notificationsOptions"><span data-i18n="options_receive_app_notifications"></span></label>
|
||||
</div>
|
||||
|
||||
<div class="checkbox notifications">
|
||||
<div class="checkbox statistics">
|
||||
<input id="improveConfigurator" type="checkbox" />
|
||||
<label for="improveConfigurator"><span data-i18n="options_improve_configurator"></span></label>
|
||||
</div>
|
||||
|
||||
<div class="checkbox show_profile_parameters">
|
||||
<input id="showProfileParameters" type="checkbox" />
|
||||
<label for="showProfileParameters"><span data-i18n="options_showProfileParameters"></span></label>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue