preview for long actions

This commit is contained in:
ishadurin 2016-05-31 23:37:32 +03:00
parent b9cce7e429
commit a3b1cd87cd
3 changed files with 22 additions and 4 deletions

View file

@ -110,9 +110,7 @@ function onUploadingComplete(uri) {
}
function handleFiles(files) {
jQuery('#preview-modal').modal({
fadeDuration: 250
});
showModal('Uploading photos..');
uploadFile(files, 0, "");
}

View file

@ -22,7 +22,7 @@
<body>
<div id="preview-modal" style="display:none; text-align: center">
<p>Uploading photos..</p>
<p id="action-text"></p>
<img style="text-align: center; padding-top: 20px" src="throbber.gif" id="currentPreview">
</div>

View file

@ -59,6 +59,18 @@ var idle; // idle timer
var clayout; // current layout
var csr; // current scaling ratio
function showModal(text, previewImageUrl) {
if (!previewImageUrl) {
previewImageUrl = 'throbber.gif';
}
jQuery('#currentPreview').attr('src', previewImageUrl);
jQuery('#action-text').text(text);
jQuery('#preview-modal').modal({
fadeDuration: 250
});
}
function resize()
{
// best layout
@ -278,6 +290,7 @@ function deleteImg() {
var fname = imgs.data[eidx].img[0];
imgs.data.splice(eidx, 1);
showModal('Delete photo..', fname);
// construct an HTTP request
var xhr = new XMLHttpRequest();
@ -302,6 +315,13 @@ function deleteImg() {
function moveUpDown(off) {
var me = imgs.data[eidx];
console.log(me.thumb[0]);
var moveText = 'Moving down..';
if (off > 0) {
moveText = 'Moving up..';
}
showModal(moveText, me.thumb[0]);
imgs.data[eidx] = imgs.data[eidx + off];
imgs.data[eidx + off] = me;
var xhr = new XMLHttpRequest();