Nejdříve javascriptový soubor: soubor /usr/local/lib/enigma2/python/Plugins/Extensions/WebInterface/web-d
ata/objects.js
var free = hdd.getElementsByTagName('e2free').item(0).firstChild.data;
var IntFree = parseInt(free.replace(" GB",""));
var IntCapacity = parseInt(capacity.replace(" GB",""));
var pfree = Math.floor(((100 / IntCapacity)
* IntFree)*10)/10;
var pUsed = 100 - pfree;
this.hdds[i] =
{
'model'
: model,
'capacity'
: capacity,
'free' :
free,
'pfree'
: pfree,
'pUsed'
: pUsed
};
ata/tpl/default/tplDeviceInfo.htm
<tr>
<td class="aboutElementLeft">Free:</td>
<td class="aboutElementRight">${hdd.free}</td>
</tr>
<tr>
<td colspan="2" style="padding-right: 3px;">
<div style="width:100%; position:relative; border:1px solid #999999">
<div style="background-color:#CCCCCC; width: ${hdd.pUsed}%; height:15px">
<div style="position:absolute; left:0; top:0; text-align:center; width:100%%;
color:#000000">
<small>Free: ${hdd.free} / ${hdd.capacity} (Free:
${hdd.pfree} %)</small>
</div>
</div>
</div>
</td>
</tr>
ata/objects.js, pokud je název HDD stejný jako předchozí, pak se tento nezobrazí.
var hddnodes = xml.getElementsByTagName('e2hdd');
var PreviousHdd = "";
for( var i = 0; i < hddnodes.length;
i++){
try{
var hdd = hddnodes.item(i);
var model = hdd.getElementsByTagName('e2model').item(0).firstChild.data;
if (PreviousHdd !=
model)
{
var capacity = hdd.getElementsByTagName('e2capacity').item(0).firstChild.data;
var free = hdd.getElementsByTagName('e2free').item(0).firstChild.data;
var IntFree = parseInt(free.replace(" GB",""));
var IntCapacity = parseInt(capacity.replace(" GB",""));
var pfree = Math.floor(((100 / IntCapacity)
* IntFree)*10)/10;
var pUsed = 100 - pfree;
this.hdds[i] =
{
'model'
: model,
'capacity'
: capacity,
'free' :
free,
'pfree'
: pfree,
'pUsed' : pUsed
};
}
PreviousHdd
= model;
}
catch(e){
notify("Error parsing HDD
data: " + e, false);
}
}
Žádné komentáře:
Okomentovat