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

View File

@ -1,12 +1,5 @@
var handle = 0;
function escapestring(str)
{
str = JSON.stringify(String(str));
str = str.substring(1, str.length - 1);
return str;
}
function update()
{
$.get('progress.jim', {
@ -27,7 +20,8 @@ $('[type="checkbox"]').iphoneStyle({
$('#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');
});
@ -44,10 +38,17 @@ $('#save').button({icons: {primary: "ui-icon-disk"}})
.slideUp('slow');
$('#originalbookmarks')
.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');
$('#progressdiv').show('slow');
$('#back').hide();
@ -56,7 +57,7 @@ $('#cropit').button().click(function() {
.load('execute.jim', {
'file': $('#params').attr('file'),
'invert': $('#invert').attr('invert')
}, function() {
}, function() {
clearInterval(handle);
handle = 0;
$('#back,#save').show();
@ -73,10 +74,10 @@ $('#cropit').button().click(function() {
});
});
$('#invert').button().on('click', function() {
window.location = 'crop.jim?file=' +
escapestring($('#params').attr('file')) +
'&invert=' + ($(this).attr('invert') == '1' ? '0' : '1');
$('#invert').button({icons: {primary: "ui-icon-shuffle"}})
.on('click', function() {
window.location = window.location.href.replace(/&invert=[01]/,'') +
'&invert=' + ($(this).attr('invert') == '1' ? '0' : '1');
});
});