29 lines
1.1 KiB
JavaScript
29 lines
1.1 KiB
JavaScript
function CheckTransformJob(id,job_id)
|
|
{
|
|
$.ajax(
|
|
{
|
|
type: 'POST', data: '&job_id='+job_id, url: '/checktransformjob', success: function(data) {
|
|
if( data.finished )
|
|
{
|
|
// stop throbber, remove grayscale & then force reload with timestamped version of im.src
|
|
grayscale=0
|
|
throbber=0
|
|
im.src=im.src + '?t=' + new Date().getTime();
|
|
return false;
|
|
}
|
|
else
|
|
{
|
|
setTimeout( function() { CheckTransformJob(id,job_id) }, 1000,id, job_id );
|
|
}
|
|
},
|
|
} )
|
|
}
|
|
|
|
function Transform(amt)
|
|
{
|
|
id=$('#current').val()
|
|
post_data = '&amt='+amt+'&id='+id
|
|
// send /transform for this image, grayscale the thumbmail, add color spinning wheel overlay, and start checking for job end
|
|
$.ajax({ type: 'POST', data: post_data, url: '/transform', success: function(data) { grayscale=1; throbber=1; DrawImg(); CheckTransformJob(id,data.job_id); return false; } })
|
|
}
|