From b8964c8017e34cbcf7f7717ab24da9fd5ca3f8ac Mon Sep 17 00:00:00 2001 From: df Date: Wed, 11 Nov 2020 13:04:34 +0000 Subject: [PATCH] Check that bookmark save succeeded If not, enable the old "Save new bookmarks" button. Also * add icons for buttons * simplify invert URL handling. --- webif/html/browse/crop/crop.js | 29 +++++++++++++++-------------- 1 file changed, 15 insertions(+), 14 deletions(-) diff --git a/webif/html/browse/crop/crop.js b/webif/html/browse/crop/crop.js index a400e0b..dfaed43 100755 --- a/webif/html/browse/crop/crop.js +++ b/webif/html/browse/crop/crop.js @@ -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'); }); });