Check that bookmark save succeeded

If not, enable the old "Save new bookmarks" button.

Also
* add icons for buttons
* simplify invert URL handling.
This commit is contained in:
df 2020-11-11 13:04:34 +00:00 committed by HummyPkg
parent f7c37e83ae
commit 73d25247f0
1 changed files with 15 additions and 14 deletions

View File

@ -1,12 +1,5 @@
var handle = 0; var handle = 0;
function escapestring(str)
{
str = JSON.stringify(String(str));
str = str.substring(1, str.length - 1);
return str;
}
function update() function update()
{ {
$.get('progress.jim', { $.get('progress.jim', {
@ -27,7 +20,8 @@ $('[type="checkbox"]').iphoneStyle({
$('#progressbar').reportprogress(0); $('#progressbar').reportprogress(0);
$('#back').button().click(function() { $('#back').button({icons: {primary: "ui-icon-arrowreturnthick-1-w"}})
.on('click', function() {
window.location = '/go/browse?dir=' + $('#params').attr('dir'); window.location = '/go/browse?dir=' + $('#params').attr('dir');
}); });
@ -44,10 +38,17 @@ $('#save').button({icons: {primary: "ui-icon-disk"}})
.slideUp('slow'); .slideUp('slow');
$('#originalbookmarks') $('#originalbookmarks')
.html($('#newbookmarks').clone()); .html($('#newbookmarks').clone());
$('#esttime').hide();
if ($('#results').html().indexOf(' successful') < 0) {
$('#saveit').hide();
$('#saveitlabel').hide();
$('#save').show();
}
}); });
}); });
$('#cropit').button().click(function() { $('#cropit').button({icons: {primary: "ui-icon-scissors"}})
.on('click', function() {
$('#cropdiv').hide('slow'); $('#cropdiv').hide('slow');
$('#progressdiv').show('slow'); $('#progressdiv').show('slow');
$('#back').hide(); $('#back').hide();
@ -56,7 +57,7 @@ $('#cropit').button().click(function() {
.load('execute.jim', { .load('execute.jim', {
'file': $('#params').attr('file'), 'file': $('#params').attr('file'),
'invert': $('#invert').attr('invert') 'invert': $('#invert').attr('invert')
}, function() { }, function() {
clearInterval(handle); clearInterval(handle);
handle = 0; handle = 0;
$('#back,#save').show(); $('#back,#save').show();
@ -73,10 +74,10 @@ $('#cropit').button().click(function() {
}); });
}); });
$('#invert').button().on('click', function() { $('#invert').button({icons: {primary: "ui-icon-shuffle"}})
window.location = 'crop.jim?file=' + .on('click', function() {
escapestring($('#params').attr('file')) + window.location = window.location.href.replace(/&invert=[01]/,'') +
'&invert=' + ($(this).attr('invert') == '1' ? '0' : '1'); '&invert=' + ($(this).attr('invert') == '1' ? '0' : '1');
}); });
}); });