summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorChristopher Baines <cb15g11@soton.ac.uk>2014-10-01 09:03:48 +0100
committerChristopher Baines <cb15g11@soton.ac.uk>2014-10-01 09:06:06 +0100
commit120cfe1e9ef04942091058eadf49281f41aafecd (patch)
tree1db3eb96bfd749761b0b9661eb2c8f5c06d4ef94 /src
parent3919a6a104bbc4f0d0704b6b720553c3ac54e892 (diff)
downloadleaflet-soton-120cfe1e9ef04942091058eadf49281f41aafecd.tar
leaflet-soton-120cfe1e9ef04942091058eadf49281f41aafecd.tar.gz
Improve floor sorting
Now works for level 10, and 11 in the Maths building.
Diffstat (limited to 'src')
-rw-r--r--src/leaflet-soton.js16
1 files changed, 14 insertions, 2 deletions
diff --git a/src/leaflet-soton.js b/src/leaflet-soton.js
index 2a52b16..36650e4 100644
--- a/src/leaflet-soton.js
+++ b/src/leaflet-soton.js
@@ -1435,8 +1435,20 @@ SELECT * WHERE {\
}
}
- var floor_ids = Object.keys( floors );
- floor_ids.sort();
+ var floor_ids = Object.keys(floors);
+
+ floor_ids.sort(function(a, b) {
+ if (a === "Unknown") return 1;
+ if (b === "Unknown") return -1;
+
+ a = parseInt(a, 10);
+ b = parseInt(b, 10);
+
+ if (a < b) {
+ return -1;
+ }
+ return 1;
+ });
floor_ids.forEach(function(floor_id) {
var h4 = document.createElement( "h4" );