From 87d118e87c7bc63a8820c374c6720d220d9df299 Mon Sep 17 00:00:00 2001 From: "Vladimir Golovnev (Glassez)" Date: Sun, 26 Jan 2014 22:57:52 +0400 Subject: [PATCH 1/2] Fix WebUI sort by size/speed for some locales (with comma as decimal point). --- src/webui/scripts/dynamicTable.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/webui/scripts/dynamicTable.js b/src/webui/scripts/dynamicTable.js index 46b4eb38b..8fa51130a 100644 --- a/src/webui/scripts/dynamicTable.js +++ b/src/webui/scripts/dynamicTable.js @@ -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; From c3942fb0b345fb1471a157e59dcdb230eb2d37ae Mon Sep 17 00:00:00 2001 From: "Vladimir Golovnev (Glassez)" Date: Mon, 27 Jan 2014 08:44:36 +0400 Subject: [PATCH 2/2] Fix WebUI sort by ratio for some locales (with comma as decimal point). --- src/webui/scripts/dynamicTable.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/webui/scripts/dynamicTable.js b/src/webui/scripts/dynamicTable.js index 8fa51130a..2b906b759 100644 --- a/src/webui/scripts/dynamicTable.js +++ b/src/webui/scripts/dynamicTable.js @@ -112,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)