include the js form the internal dir and viewer now has tooltips on buttons, and all buttons work, call the right javascript, send jobs to the pa_job_manager, and make image go gray with throbber, and on job completion, hide throbber, redraw the image in color and with the newly transformed image
This commit is contained in:
29
internal/js/files_transform.js
Normal file
29
internal/js/files_transform.js
Normal file
@@ -0,0 +1,29 @@
|
||||
function CheckTransformJob(id,job_id)
|
||||
{
|
||||
$.ajax(
|
||||
{
|
||||
type: 'POST', data: '&job_id='+job_id, url: '/checktransformjob', success: function(data) {
|
||||
if( data.finished )
|
||||
{
|
||||
$('#s'+id).hide()
|
||||
$('#'+id).find('img.thumb').attr('style', 'filter: color(100%);' );
|
||||
$('#'+id).addClass('entry')
|
||||
$('#'+id).find('.thumb').attr('src', 'data:image/jpeg;base64,'+data.thumbnail)
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
setTimeout( function() { CheckTransformJob(id,job_id) }, 1000,id, job_id );
|
||||
}
|
||||
},
|
||||
} )
|
||||
}
|
||||
|
||||
function Transform(amt)
|
||||
{
|
||||
$('.highlight').each(function( id, e ) {
|
||||
post_data = '&amt='+amt+'&id='+e.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){ $('#'+e.id).find('img.thumb').attr('style', 'filter: grayscale(100%);' ); $('#'+e.id).removeClass('entry'); $('#s'+e.id).show(); CheckTransformJob(e.id,data.job_id); return false; } })
|
||||
} )
|
||||
}
|
||||
@@ -1,29 +0,0 @@
|
||||
function CheckRotateJob(id,job_id)
|
||||
{
|
||||
$.ajax(
|
||||
{
|
||||
type: 'POST', data: '&job_id='+job_id, url: '/checkrotatejob', success: function(data) {
|
||||
if( data.finished )
|
||||
{
|
||||
$('#s'+id).hide()
|
||||
$('#'+id).find('img.thumb').attr('style', 'filter: color(100%);' );
|
||||
$('#'+id).addClass('entry')
|
||||
$('#'+id).find('.thumb').attr('src', 'data:image/jpeg;base64,'+data.thumbnail)
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
setTimeout( function() { CheckRotateJob(id,job_id) }, 1000,id, job_id );
|
||||
}
|
||||
},
|
||||
} )
|
||||
}
|
||||
|
||||
function Rotate(amt)
|
||||
{
|
||||
$('.highlight').each(function( id, e ) {
|
||||
post_data = '&amt='+amt+'&id='+e.id
|
||||
{# send rotate for this image, grayscale the thumbmail, add color spinning wheel overlay, and start checking for job end #}
|
||||
$.ajax({ type: 'POST', data: post_data, url: '/rotate', success: function(data){ $('#'+e.id).find('img.thumb').attr('style', 'filter: grayscale(100%);' ); $('#'+e.id).removeClass('entry'); $('#s'+e.id).show(); CheckRotateJob(e.id,data.job_id); return false; } })
|
||||
} )
|
||||
}
|
||||
28
internal/js/view_transform.js
Normal file
28
internal/js/view_transform.js
Normal file
@@ -0,0 +1,28 @@
|
||||
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; } })
|
||||
}
|
||||
Reference in New Issue
Block a user