source: extensions/Ajax_Thumbnailer/admin/js/thumbnailer.js @ 4549

Last change on this file since 4549 was 4549, checked in by Dsls, 14 years ago

Ajax_Thumbnailer 0.3

File size: 1.8 KB
Line 
1var waitingImage = '<img src="'+path+'/admin/img/progress.gif">';
2
3var queuedManager = $.manageAjax.create('queued', { 
4        queue: true, 
5        cacheResponse: false,
6        maxRequests: 5
7}); 
8
9
10function 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("&nbsp;");
53       
54});
55$('input#clear').click (function () {
56        $('tr.item:not(.nothumb)').remove();
57});
58});
Note: See TracBrowser for help on using the repository browser.