1 | var waitingImage = '<img src="'+path+'/admin/img/progress.gif">'; |
---|
2 | |
---|
3 | var queuedManager = $.manageAjax.create('queued', { |
---|
4 | queue: true, |
---|
5 | cacheResponse: false, |
---|
6 | maxRequests: 5 |
---|
7 | }); |
---|
8 | |
---|
9 | |
---|
10 | function processThumbs(width,height,gd_version) { |
---|
11 | $('tr.nothumb').each(function() { |
---|
12 | var file=$(this).find('td.filepath').text(); |
---|
13 | $(this).find('td.thumbpic').html(waitingImage); |
---|
14 | var td=this; |
---|
15 | queuedManager.add({ |
---|
16 | type: 'GET', |
---|
17 | url: 'ws.php', |
---|
18 | data: {method: 'pwg.thumbnail.create',picture:file,format:'json',width: width,height: height, gd_version: gd_version}, |
---|
19 | dataType: 'json', |
---|
20 | success: (function(row) { return function(data) { |
---|
21 | if (data.stat =='ok') { |
---|
22 | $(row).find('td.thumbpic').html('<img src="'+data.result.tn_file+'"/>'); |
---|
23 | $(row).find('td.thumbdim').html(""+data.result.tn_width+"X"+data.result.tn_height); |
---|
24 | $(row).find('td.thumbgentime').html(""+data.result.tn_time); |
---|
25 | $(row).find('td.thumbsize').html(""+data.result.tn_size); |
---|
26 | $(row).removeClass("nothumb"); |
---|
27 | } else { |
---|
28 | $(row).find('td.thumbpic').html('#ERR#'+data.err+"# : "+data.message); |
---|
29 | $(row).removeClass("nothumb"); |
---|
30 | $(row).addClass("error"); |
---|
31 | } |
---|
32 | };})(td) |
---|
33 | }); |
---|
34 | }); |
---|
35 | } |
---|
36 | |
---|
37 | $(document).ready(function(){ |
---|
38 | $('input#proceed').click (function () { |
---|
39 | var width = $('#width')[0].value; |
---|
40 | var height = $('#height')[0].value; |
---|
41 | var gd_version=$("input[@name='gd']:checked").val(); |
---|
42 | $("input:not(.nodisable)").attr("disabled",true); |
---|
43 | |
---|
44 | |
---|
45 | processThumbs(width,height,gd_version); |
---|
46 | }); |
---|
47 | |
---|
48 | $('input#cancel').click (function () { |
---|
49 | queuedManager.clear(); |
---|
50 | queuedManager.abort(); |
---|
51 | $("input:not(.nodisable)").attr("disabled",false); |
---|
52 | $('tr.nothumb td.thumbpic').html(" "); |
---|
53 | |
---|
54 | }); |
---|
55 | $('input#clear').click (function () { |
---|
56 | $('tr.item:not(.nothumb)').remove(); |
---|
57 | }); |
---|
58 | }); |
---|