--- script.js.org
+++ script.js
@@ -1,14 +1,37 @@
-function refresh_backup_files()
+function refresh_backup_files(viewing)
{
- $('#restore_button,#delete_button,#view_button')
+ $('#restore_button,#delete_button,#view_button,#close_view_button')
.button('option', 'disabled', true);
+ $('#close_view_button').hide();
+ var backup=$('input.restore:checked').val();
$('#backup_files').load('backup/files.jim', function() {
- $('input.restore').change(function() {
+ if (backup) backup=$('input.restore[value="'+backup+'"]').val();
+ if (!backup) {
+ $('input.restore').change(function() {
$('#restore_button,#delete_button,#view_button')
.removeAttr('disabled')
.button('option', 'disabled', false);
- });
+ });
+ } else {
+ $('input.restore[value="'+backup+'"]').prop('checked',true);
+ $('#restore_button,#delete_button')
+ .removeAttr('disabled')
+ .button('option', 'disabled', false);
+ }
+ if (viewing) {
+ $('#close_view_button')
+ .removeAttr('disabled')
+ .button('option', 'disabled', false)
+ .show();
+ $('input.restore').change(function() {
+ $('#close_view_button').click();
+ });
+ } else if (backup) {
+ $('#view_button')
+ .removeAttr('disabled')
+ .button('option', 'disabled', false);
+ }
});
}
@@ -19,6 +42,7 @@
$('#restore_button').button({icons: {primary: "ui-icon-play"}});
$('#delete_button').button({icons: {primary: "ui-icon-trash"}});
$('#view_button').button({icons: {primary: "ui-icon-script"}});
+$('#close_view_button').button({icons: {primary: "ui-icon-script"}});
refresh_backup_files();
@@ -49,9 +73,13 @@
$('#backup_results').load('backup/view.jim?' +
$('input.restore').serialize(), function() {
$('#backup_results').slideDown(function() {
- refresh_backup_files();
+ refresh_backup_files(true);
});
});
+});
+$('#close_view_button').click(function() {
+ $('#backup_results').slideUp();
+ refresh_backup_files();
});
$('#restore_button').click(function() {
var backup = $('input.restore:checked').val();