summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xserver.js5
-rw-r--r--static/index.js2
2 files changed, 4 insertions, 3 deletions
diff --git a/server.js b/server.js
index da29e0a..b11a766 100755
--- a/server.js
+++ b/server.js
@@ -82,9 +82,10 @@ class Database {
#sort() {
this.#list.sort((a, b) => {
+ // ascending order would be "a - b"
if (a[0] != b[0]) return b[0] - a[0];
- if (a[1] < b[1]) return -1;
- if (a[1] > b[1]) return 1;
+ if (a[1].toLowerCase() < b[1].toLowerCase()) return -1;
+ if (a[1].toLowerCase() > b[1].toLowerCase()) return 1;
return 0;
});
}
diff --git a/static/index.js b/static/index.js
index 311afc7..ca76f1e 100644
--- a/static/index.js
+++ b/static/index.js
@@ -185,7 +185,7 @@ function insertItem(votes, string) {
var i;
for (i = 0; i < glist.length; i++) {
if (glist[i][0] > votes) continue;
- if (glist[i][0] < votes || glist[i][1] > string) break;
+ if (glist[i][0] < votes || glist[i][1].toLowerCase() > string.toLowerCase()) break;
}
var el = createItemElement(votes, string);
if (i == glist.length) {