diff options
| author | 2009-12-19 19:27:42 +0100 | |
|---|---|---|
| committer | 2009-12-19 19:27:42 +0100 | |
| commit | fc5ae79bf0e0fc2c43b9b748c4d00037077f21a6 (patch) | |
| tree | 24425ca8a6ddcef90d398ed4168481fb20c57d05 | |
| parent | Fixed Netload, no Premium (diff) | |
| download | pyload-fc5ae79bf0e0fc2c43b9b748c4d00037077f21a6.tar.xz | |
webinterface - activ Downloads List - Code completed
| -rw-r--r-- | module/web/templates/default/base.html | 30 | ||||
| -rwxr-xr-x | pyLoadCore.py | 2 | 
2 files changed, 28 insertions, 4 deletions
| diff --git a/module/web/templates/default/base.html b/module/web/templates/default/base.html index f9ea8c3a2..73846b0d6 100644 --- a/module/web/templates/default/base.html +++ b/module/web/templates/default/base.html @@ -132,8 +132,25 @@ sprintfWrapper = {  		}
  	}
  }
 - 
  sprintf = sprintfWrapper.init;
 +
 +//var SetInver = new Array();
 +
 +function HumanFileSize(size)
 +{
 +	var filesizename = new Array("KB", "MB", "GB", "TB", "PB", "EB", "ZB", "YB");
 +	var loga = Math.log(size)/Math.log(1024);
 +	var i = Math.floor(loga);
 +	var a = Math.pow(1024, i);
 +	return Math.round( size / a , 2) + " " + filesizename[i];
 +}
 +
 +/*function UpdateLinks( SetInver, index )
 +{
 +	$("#aktiv_percent").text(parseInt($("#aktiv_percent").text)+1)
 +	setTimeout( UpdateLinks( SetInver, index+1 ), SetInver[index]*1000);
 +}*/
 +
  function LoadJsonToContent(data)
  {
  	JSONDATA = data;
 @@ -161,8 +178,15 @@ function LinksToContent(data)  	$("#LinksAktiv").text('');
  	$.each(data, function(i,item)
  	{
 -		$("#LinksAktiv").append('<tr><td>'+item.name+'</td><td>'+item.status+'</td><td>'+Math.round(item.speed*100)/100+'@'+SecToRightTime(item.eta)+'</td><td>'+item.size+' MB</td><td>'+item.percent+'% / '+item.kbleft+' MB</td></tr>');
 +		$("#LinksAktiv").append('<tr id="link_'+item.id+'"><td>'+item.name+'</td><td>'+item.status+'</td><td>'+Math.round(item.speed*100)/100+'@'+SecToRightTime(item.eta)+'</td><td>'+HumanFileSize(item.size)+'</td><td><font id="aktiv_percent">'+item.percent+'</font>% / '+HumanFileSize(item.size-item.kbleft)+'</td></tr>');
 +		//SetInver[i] = (item.size / 100 ) / item.speed ;
 +		//window.setInterval( $("#aktiv_percent").text(parseInt($("#aktiv_percent").text)+1), ((item.size / 100 ) / item.speed)*100);
  	});
 +	//UpdateLinks(SetInver, 0);
 +	setTimeout(function()
 +   {
 +    $.getJSON('/json/links', LinksToContent );
 +   }, 4000);
  }
  function SecToRightTime(sek)
 @@ -248,7 +272,7 @@ $(document).ready(function(){  {% if perms.pyload.can_see_dl %}
  <ul id="page-actions">
  	<li><a href=""  class="action backlink" accesskey="o" rel="nofollow">Speed: <b id="speed">{{ status.speed }}</b> kb/s</a></li>
 -    <li><a href=""  class="action cog" accesskey="o" rel="nofollow">Aktiv: <b id="aktiv">{{ status.queue }}</b> / <b id="aktiv_from">{{ status.total }}</b></a></li>
 +    <li><a href=""  class="action cog" accesskey="o" rel="nofollow">Active: <b id="aktiv">{{ status.queue }}</b> / <b id="aktiv_from">{{ status.total }}</b></a></li>
      <li><a href=""  class="action revisions" accesskey="o" rel="nofollow">Reload page</a></li>
  </ul><br />
  {% endif %}
 diff --git a/pyLoadCore.py b/pyLoadCore.py index 3e6662d17..1951d6db1 100755 --- a/pyLoadCore.py +++ b/pyLoadCore.py @@ -351,7 +351,7 @@ class ServerMethods():              download['speed'] = pyfile.status.get_speed()
              download['eta'] = pyfile.status.get_ETA()
              download['kbleft'] = pyfile.status.kB_left()
 -            download['size'] = pyfile.status.size() / 1000
 +            download['size'] = pyfile.status.size()
              download['percent'] = pyfile.status.percent()
              download['status'] = pyfile.status.type
              download['wait_until'] = pyfile.status.waituntil
 | 
