Changeset 18731 for extensions/Autosize/js/autosize_ajax.js
- Timestamp:
- Oct 24, 2012, 5:29:52 PM (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
extensions/Autosize/js/autosize_ajax.js
r18724 r18731 18 18 function progress(success,data) { 19 19 if (success) { 20 20 21 jQuery("#theMainImage").trigger("ON", [{ nb: derivatives.total - derivatives.done, total: derivatives.total, done: derivatives.done,status:"ok",src:data.url}]); 21 22 } else { 22 jQuery("#theMainImage").trigger("ON", [{ nb: derivatives.total - derivatives.done, total: derivatives.total, done: derivatives.done, status: "Nok"}]); 23 24 if (data.statusText == "OK") { 25 26 } else { 27 jQuery("#theMainImage").trigger("ON", [{ nb: derivatives.total - derivatives.done, total: derivatives.total, done: derivatives.done, status: "Nok", responseText: data.responseText}]); 28 } 23 29 } 24 30 … … 35 41 function getDerivativeUrls(nofile) { 36 42 params.max_urls = nofile.length; 37 popup = jQuery(".infos");38 if (popup.length == 0) {39 // jQuery("#theImage").append("<div class='infos'></div>");40 }41 42 43 jQuery(nofile).each(function (i, t) { 43 44 if (typeof t.file != "undefined") { 44 45 nbsrc = params.src.length; 46 t.file= t.file.replace("/","",1); 45 47 if (nbsrc == 0) { 46 48 params.ids.push(t.id); 47 49 params.types.push(t.type); 48 50 params.src.push(t.file); 49 } else if (~jQuery.inArray( t.file,params.src)) {51 } else if (~jQuery.inArray(t.file, params.src)) { 50 52 jQuery.noop(); 51 53 } else { … … 53 55 params.types.push(t.type); 54 56 params.src.push(t.file); 55 56 57 } 57 58 } 58 59 }); 60 59 61 if(derivatives.elements.length==0) 60 derivatives.elements = params.ids; 62 derivatives.elements = params.ids; 63 derivatives.total += params.src.length; 64 65 66 Set_images = function (dataUrls) { 67 if (typeof jQuery.manageAjax != "undefined") { 68 for (var i = 0; i < dataUrls.length; i++) { 69 jQuery.manageAjax.add("queued", { 70 type: 'GET', 71 url: 'i.php?' + dataUrls[i] + "&ajaxload=true", 72 dataType: 'json', 73 success: (function (data) { 74 derivatives.done++; 75 progress(true, data); 76 }), 77 error: (function (data) { 78 derivatives.done++; 79 progress(data.statusText == "NOK", data); 80 }), 81 fail: (function (data) { 82 a = data.statusText; 83 }), 84 progress: (function (data) { 85 a = data.statusText; 86 }), 87 88 complete: (function (data) { 89 progress(false, data); 90 }), 91 isRejected: (function (data) { 92 a = data.responseText; 93 }) 94 95 }); 96 } 97 98 } 99 } 61 100 62 101 63 jQuery.ajax({ 64 type: "POST", 65 url: 'ws.php?format=json&method=pwg.getMissingDerivatives', 66 data: params, 67 dataType: "json", 68 success: function (data) { 69 if (!data.stat || data.stat != "ok") { 70 return; 71 } 72 derivatives.total += data.result.urls.length; 73 if (typeof jQuery.manageAjax != "undefined") { 74 for (var i = 0; i < data.result.urls.length; i++) { 75 76 jQuery.manageAjax.add("queued", { 77 type: 'GET', 78 url: data.result.urls[i] + "&ajaxload=true", 79 dataType: 'json', 80 success: (function (data) { 81 derivatives.done++; 82 progress(true, data); 83 }), 84 error: (function (data) { 85 derivatives.done++; 86 progress(false, data); 87 }) 88 }); 89 } 90 if (derivatives.elements.length) { 91 if(derivatives.total - derivatives.done > 0 ) 92 setTimeout("getDerivativeUrls(nofile)", 100 * (derivatives.total - derivatives.done)); 93 } 94 } 95 }, 96 error: function (data) { 97 progress(false); 98 } 99 }); 100 } 102 if (derivatives.elements.length) { 103 if (derivatives.total - derivatives.done > 0) 104 setTimeout("Set_images(params.src)", 500 * (derivatives.total - derivatives.done)); 105 } 106 107 108 109 } //ready 101 110 //===============================================================
Note: See TracChangeset
for help on using the changeset viewer.