From fc5ae79bf0e0fc2c43b9b748c4d00037077f21a6 Mon Sep 17 00:00:00 2001 From: Wugy Date: Sat, 19 Dec 2009 19:27:42 +0100 Subject: webinterface - activ Downloads List - Code completed --- module/web/templates/default/base.html | 30 +++++++++++++++++++++++++++--- 1 file changed, 27 insertions(+), 3 deletions(-) (limited to 'module/web/templates/default') 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(''+item.name+''+item.status+''+Math.round(item.speed*100)/100+'@'+SecToRightTime(item.eta)+''+item.size+' MB'+item.percent+'% / '+item.kbleft+' MB'); + $("#LinksAktiv").append(''+item.name+''+item.status+''+Math.round(item.speed*100)/100+'@'+SecToRightTime(item.eta)+''+HumanFileSize(item.size)+''+item.percent+'% / '+HumanFileSize(item.size-item.kbleft)+''); + //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 %}
{% endif %} -- cgit v1.2.3