관리-도구
편집 파일: xstatus.js
<Script language="JavaScript"> var inline_pro=0; var doc = document; var interval = null; var uid,num,told10,tsize10; var totalsize=<TMPL_VAR data_total_dgt>; var dat = new Array(<TMPL_VAR nbars>); for(i=0;i<dat.length;i++)dat[i]=0; function fixFloat(x) { if(x==undefined||x==''){x=0;} str = x+''; ind = str.indexOf('.'); if(ind==-1)return str+".0"; return str.substring(0,ind+2); } function changeValue(id,value) { if(!id)return; if(inline_pro) { var obj = doc.getElementById('xp-'+id); } else { var obj = doc.getElementById(id); } if(obj) { obj.innerHTML = value; } } function S(percent,cursize,time,speed,files,left) { //var percent = parseInt(100*parseFloat(cursize)/parseFloat(totalsize)); if(doc.getElementById('upload_status'))doc.getElementById('upload_status').style.width = percent+'%'; changeValue('percent', percent+'%' ); changeValue('current',cursize); changeValue('speed',speed); changeValue('files',files); changeValue('time', convertSeconds(time) ); changeValue('left', convertSeconds(left) ); PB(speed*8); var d=new Date(); var ctime = d.getTime(); if(!told10){told10=ctime;tsize10=cursize;} if(ctime>=(told10+10000)) { if(tsize10==cursize){Message('Upload failed');stopUp(1);return;} told10=ctime; tsize10=cursize; } if(inline_pro && window.parent.SPI)window.parent.SPI(percent,cursize,time,speed,files,left); } function convertSeconds(seconds) { var secs = seconds % 60; var mins = ((seconds - secs) % 3600) / 60; var hours = ((seconds - secs - mins*60) % 86400) / 3600; if(hours>0) { return hours+' hours '+mins+' minutes'; } else if(mins>0) { return mins+' minutes '+secs+' seconds'; } else { return secs+' seconds'; } } function Message(msg) { if(!doc.getElementById('message'))return; doc.getElementById('message').innerHTML += msg+'<br>'; window.scrollBy(0,550); doc.getElementById('message').scrollTop+=50; } function ClosePopUp() { if(doc.getElementById('close_finished') && document.getElementById('close_finished').checked==true)self.close(); } function stopUp(no_close) { var op; if(window.parent.frames['xupload']){op=window.parent;} else {op=window.opener;} op.StopUpload(no_close); if(no_close)return; op.popupClose(); } function PB(val) { if(!doc.getElementById('curr_speed'))return; for(i=0;i<dat.length;i++) { dat[i] = dat[i+1]; } dat[dat.length-1] = val; if(doc.getElementById('curr_speed'))doc.getElementById('curr_speed').innerHTML = val; setBarValues(); } function setBarValues() { var bar_height = doc.getElementById('bar_table').style.height; bar_height = bar_height.replace(/px/,''); max_value=1; for(i=0;i<dat.length;i++){if(dat[i]>max_value)max_value=dat[i];} for(i=1;i<=dat.length;i++) { if(dat[i-1]=='' || !dat[i-1])dat[i-1]=0; newh = bar_height*(1 - dat[i-1]/max_value); doc.getElementById("b"+i).style.height = newh+'px'; } } function updateFileStatus(id,classname,text,size) { if(doc.getElementById('fs'+id)) { doc.getElementById('fs'+id).className=classname; doc.getElementById('fs'+id).innerHTML=text; doc.getElementById('fss'+id).innerHTML=size; } } function jahDone(url) { if (req.readyState == 4) { if (req.status == 200) { results = req.responseText; try {eval(results);} catch(err) {} } } } function jah() { url = 'upload_status.cgi?ajax2=1&uid='+uid+'&num='+num+'&rnd='+Math.random(); if (window.XMLHttpRequest) { req = new XMLHttpRequest(); req.onreadystatechange = function() {if(window.jahDone)jahDone(url);}; req.open("GET", url, true); req.send(null); } else if (window.ActiveXObject) { req = new ActiveXObject("Microsoft.XMLHTTP"); if (req) { req.onreadystatechange = function() {if(window.jahDone)jahDone(url);}; req.open("GET", url, true); req.send(); } } } </Script>