[PATCH 3/4] HTML: define decimal explicitly for parseInt()

Miika Turkia miika.turkia at gmail.com
Fri Jun 6 09:48:40 PDT 2014


Older browser assume octal radix on parseInt() when number starts with
0, thus declaring decimal notation explicitly.

Signed-off-by: Miika Turkia <miika.turkia at gmail.com>
---
 theme/list_lib.js | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/theme/list_lib.js b/theme/list_lib.js
index 9d02f06..acbe95d 100644
--- a/theme/list_lib.js
+++ b/theme/list_lib.js
@@ -136,7 +136,7 @@ function collapseAll(){
 
 function setNumberOfDives(e){
 	var value = e.options[e.selectedIndex].value;
-	sizeofpage=parseInt(value);
+	sizeofpage=parseInt(value,10);
 	var end = start + sizeofpage -1;
 	view_in_range(start,end);
 }
@@ -325,16 +325,16 @@ function cmpDateDes(j,iSmaller){
 	return items[j].date > items[iSmaller].date ;
 }
 function cmpAtempAsc(j,iSmaller){
-	return parseInt(items[j].temperature.air) < parseInt(items[iSmaller].temperature.air) ;
+	return parseInt(items[j].temperature.air,10) < parseInt(items[iSmaller].temperature.air,10) ;
 }
 function cmpAtempDes(j,iSmaller){
-	return parseInt(items[j].temperature.air) > parseInt(items[iSmaller].temperature.air) ;
+	return parseInt(items[j].temperature.air,10) > parseInt(items[iSmaller].temperature.air,10) ;
 }
 function cmpWtempAsc(j,iSmaller){
-	return parseInt(items[j].temperature.water) < parseInt(items[iSmaller].temperature.water) ;
+	return parseInt(items[j].temperature.water,10) < parseInt(items[iSmaller].temperature.water,10) ;
 }
 function cmpWtempDes(j,iSmaller){
-	return parseInt(items[j].temperature.water) > parseInt(items[iSmaller].temperature.water) ;
+	return parseInt(items[j].temperature.water,10) > parseInt(items[iSmaller].temperature.water,10) ;
 }
 
 function sort_it(sortOn,function_){
-- 
1.9.1



More information about the subsurface mailing list