defunk some of the option saving code

10.3.x-maintenance
cTn 2014-05-08 14:56:25 +02:00
parent ccee927c77
commit 21a0242d38
1 changed files with 15 additions and 30 deletions

View File

@ -112,17 +112,12 @@ function tab_initialize_firmware_flasher() {
});
chrome.storage.local.get('no_reboot_sequence', function(result) {
if (typeof result.no_reboot_sequence === 'undefined') {
// wasn't saved yet
$('input.updating').prop('checked', false);
} else {
if (result.no_reboot_sequence) {
$('input.updating').prop('checked', true);
$('label.flash_on_connect_wrapper').show();
} else {
$('input.updating').prop('checked', false);
}
}
// bind UI hook so the status is saved on change
$('input.updating').change(function() {
@ -131,8 +126,8 @@ function tab_initialize_firmware_flasher() {
if (status) {
$('label.flash_on_connect_wrapper').show();
} else {
$('label.flash_on_connect_wrapper').hide();
$('input.flash_on_connect').prop('checked', false).change();
$('label.flash_on_connect_wrapper').hide();
}
chrome.storage.local.set({'no_reboot_sequence': status});
@ -140,16 +135,11 @@ function tab_initialize_firmware_flasher() {
});
chrome.storage.local.get('flash_on_connect', function(result) {
if (typeof result.flash_on_connect === 'undefined') {
// wasn't saved yet
$('input.flash_on_connect').prop('checked', false);
} else {
if (result.flash_on_connect) {
$('input.flash_on_connect').prop('checked', true);
} else {
$('input.flash_on_connect').prop('checked', false);
}
}
$('input.flash_on_connect').change(function() {
var status = $(this).is(':checked');
@ -157,7 +147,7 @@ function tab_initialize_firmware_flasher() {
if (status) {
var flashing_port;
var start = function() {
function start() {
PortHandler.port_detected('flash_next_device', function(result) {
flashing_port = result[0];
GUI.log('Detected: <strong>' + flashing_port + '</strong> - triggering flash on connect');
@ -169,9 +159,9 @@ function tab_initialize_firmware_flasher() {
// Detect port removal to create a new callback
end();
}, false, true);
};
}
var end = function() {
function end() {
PortHandler.port_removed('flashed_device_removed', function(result) {
for (var i = 0; i < result.length; i++) {
if (result[i] == flashing_port) {
@ -189,7 +179,7 @@ function tab_initialize_firmware_flasher() {
// different device removed, we need to retry
end();
}, false, true);
};
}
start();
} else {
@ -201,16 +191,11 @@ function tab_initialize_firmware_flasher() {
});
chrome.storage.local.get('erase_chip', function(result) {
if (typeof result.erase_chip === 'undefined') {
// wasn't saved yet
$('input.updating').prop('checked', false);
} else {
if (result.erase_chip) {
$('input.erase_chip').prop('checked', true);
} else {
$('input.erase_chip').prop('checked', false);
}
}
// bind UI hook so the status is saved on change
$('input.erase_chip').change(function() {