var $,exports,request_json;$=jQuery;exports=this;exports.run=should_run;request_json=function(){var row;row='<tr><td>{{message_id}}</td><td>{{from_address}}</td><td>{{to_address}}</td>'+'<td><img src="{{img}}" alt="{{alt}} />"</td><td>{{error}}</td></tr>';return $.ajax(location.pathname+'.json',{type:'GET',cache:false,dataType:'json',error:function(XHR,textStatus,errorThrown){var html;html=$.mustache(exports.errmsgbox,{msg:errorThrown||gettext('An unknown error occured')});if($('#alertmsg').length){$('#alertmsg').empty();$('#alertmsg').remove();}$('#stateupdates').empty().html('&nbsp;');$('#progbar').empty();$('#heading').after(html);return exports.run=false;},success:function(data,textStatus,XHR){var replacement,rows;if($('#alertmsg').length){$('#alertmsg').empty();$('#alertmsg').remove();}if($('.notice').length)$('.notice').remove();if(data.finished){exports.run=false;rows=[];$.each(data.results,function(i,n){var alt,eimg,erows,error,html,_i,_len,_ref;if(n.errors.length){eimg='failed.png';alt=gettext('FAILED');erows=[];_ref=n.errors;for(_i=0,_len=_ref.length;_i<_len;_i++){error=_ref[_i];erows.push(""+error[0]+" : "+error[1]);}n.error=erows.join('<br/>');}else{eimg='passed.png';alt=gettext('PASSED');}n.img=""+exports.media_url+"imgs/"+eimg;n.alt=""+alt;html=$.mustache(row,n);return rows.push(html);});replacement=rows.join('');$('tbody').empty().append(replacement);}else{$('#status').text(data.status);$('#percent').text(data.completed);$("#progressbar").reportprogress(data.completed);}return 1;},complete:function(XHR,textStatus){if(exports.run)exports.auto_refresh=setTimeout(request_json,5000);else $('#shield').hide();return 1;}});};$(document).ready(function(){if(exports.run){$('#stateupdates').empty().html("&nbsp;");if(!$('#shield').length)$('#wrap').after(exports.loading);else $('#shield').show();exports.auto_refresh=setTimeout(request_json,5000);}return 1;});