Browse Source

Merge pull request #1328 from glassez/webui-sort

Fix WebUI sort by size/speed (part 2)
adaptive-webui-19844
sledgehammer999 11 years ago
parent
commit
f5cd39cfba
  1. 7
      src/webui/scripts/dynamicTable.js

7
src/webui/scripts/dynamicTable.js

@ -79,8 +79,9 @@ var dynamicTable = new Class ({ @@ -79,8 +79,9 @@ var dynamicTable = new Class ({
case 8: // Down Speed
var sizeStrToFloat = function(mystr) {
var val1 = mystr.split(' ');
var val1num = val1[0].toFloat()
var unit = val1[1];
val1[0] = val1[0].replace(",", "."); // toFloat() cannot parse comma as decimal point
var val1num = val1[0].toFloat();
var unit = val1[1].split('/')[0]; // get an unit numerator only (to support speed values)
switch(unit) {
case '_(TiB)':
return val1num*1099511627776;
@ -111,9 +112,11 @@ var dynamicTable = new Class ({ @@ -111,9 +112,11 @@ var dynamicTable = new Class ({
return (tr2.getElements('td')[i].get('html').split(' ')[0].toInt() - tr1.getElements('td')[i].get('html').split(' ')[0].toInt());
default: // Ratio
var ratio1 = tr1.getElements('td')[i].get('html');
ratio1 = ratio1.replace(",", "."); // toFloat() cannot parse comma as decimal point
if(ratio1 == '∞')
ratio1 = '101.0';
var ratio2 = tr2.getElements('td')[i].get('html');
ratio2 = ratio2.replace(",", "."); // toFloat() cannot parse comma as decimal point
if(ratio2 == '∞')
ratio2 = '101.0';
if(!reverseSort)

Loading…
Cancel
Save