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:
parent
e43598a23e
commit
cc5a9d6df1
|
@ -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,57 +20,64 @@ $('[type="checkbox"]').iphoneStyle({
|
|||
|
||||
$('#progressbar').reportprogress(0);
|
||||
|
||||
$('#back').button().click(function() {
|
||||
window.location = '/go/browse?dir=' + $('#params').attr('dir');
|
||||
$('#back').button({icons: {primary: "ui-icon-arrowreturnthick-1-w"}}).
|
||||
on('click', function() {
|
||||
window.location = '/go/browse?dir=' + $('#params').attr('dir');
|
||||
});
|
||||
|
||||
$('#save').button({icons: {primary: "ui-icon-disk"}})
|
||||
.on('click', function() {
|
||||
$('#progressdiv,#output,#save').hide('slow');
|
||||
$.post('../bookmarks/save.jim', {
|
||||
'file': $('#fileparams').attr('file'),
|
||||
'bookmarks': $('#bookmarks').attr('val')
|
||||
}, function(data) {
|
||||
$('#results').html(data)
|
||||
.slideDown('slow')
|
||||
.delay(6000)
|
||||
.slideUp('slow');
|
||||
$('#originalbookmarks')
|
||||
.html($('#newbookmarks').clone());
|
||||
$('#progressdiv,#output,#save').hide('slow');
|
||||
$.post('../bookmarks/save.jim', {
|
||||
'file': $('#fileparams').attr('file'),
|
||||
'bookmarks': $('#bookmarks').attr('val')
|
||||
}, function(data) {
|
||||
$('#results').html(data)
|
||||
.slideDown('slow')
|
||||
.delay(6000)
|
||||
.slideUp('slow');
|
||||
$('#originalbookmarks')
|
||||
.html($('#newbookmarks').clone());
|
||||
$('#esttime').hide();
|
||||
if ($('#results').html().indexOf(' successful') < 0) {
|
||||
$('#saveit').hide();
|
||||
$('#saveitlabel').hide();
|
||||
$('#save').show();
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
$('#cropit').button({icons: {primary: "ui-icon-scissors"}})
|
||||
.on('click', function() {
|
||||
$('#cropdiv').hide('slow');
|
||||
$('#progressdiv').show('slow');
|
||||
$('#back').hide();
|
||||
handle = setInterval("update()", 1000);
|
||||
$('#output').show().text('Please do not interrupt...')
|
||||
.load('execute.jim', {
|
||||
'file': $('#params').attr('file'),
|
||||
'invert': $('#invert').attr('invert')
|
||||
}, function() {
|
||||
clearInterval(handle);
|
||||
handle = 0;
|
||||
$('#back,#save').show();
|
||||
$('#cutplan').html('File cropping complete');
|
||||
$('#originalbookmarks').empty();
|
||||
$('#progressbar').reportprogress(100);
|
||||
if ($('#saveit').prop('checked'))
|
||||
{
|
||||
$('#save').trigger('click');
|
||||
$('#progressdiv')
|
||||
.delay(3000)
|
||||
.text('Cropping complete.');
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
$('#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');
|
||||
});
|
||||
});
|
||||
|
||||
$('#cropit').button().click(function() {
|
||||
$('#cropdiv').hide('slow');
|
||||
$('#progressdiv').show('slow');
|
||||
$('#back').hide();
|
||||
handle = setInterval("update()", 1000);
|
||||
$('#output').show().text('Please do not interrupt...')
|
||||
.load('execute.jim', {
|
||||
'file': $('#params').attr('file'),
|
||||
'invert': $('#invert').attr('invert')
|
||||
}, function() {
|
||||
clearInterval(handle);
|
||||
handle = 0;
|
||||
$('#back,#save').show();
|
||||
$('#cutplan').html('File cropping complete');
|
||||
$('#originalbookmarks').empty();
|
||||
$('#progressbar').reportprogress(100);
|
||||
if ($('#saveit').prop('checked'))
|
||||
{
|
||||
$('#save').trigger('click');
|
||||
$('#progressdiv')
|
||||
.delay(3000)
|
||||
.text('Cropping complete.');
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
$('#invert').button().on('click', function() {
|
||||
window.location = 'crop.jim?file=' +
|
||||
escapestring($('#params').attr('file')) +
|
||||
'&invert=' + ($(this).attr('invert') == '1' ? '0' : '1');
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
|
|
Loading…
Reference in New Issue