From 2ecdb00eec5b97878cadb45a34fc615b00f46fc8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micka=C3=ABl=20V=C3=A9ril?= Date: Mon, 21 Sep 2020 11:13:36 +0200 Subject: [PATCH] Alphabetic order for selects --- content/dataset.html | 41 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) diff --git a/content/dataset.html b/content/dataset.html index ab1255ad..35b560e0 100644 --- a/content/dataset.html +++ b/content/dataset.html @@ -204,6 +204,47 @@ draft: false return v.indexOf(getSelectValue(d, k)) !== -1 }) }).map((d) => getSelectValue(d, name))) + if (name!="sets") { + vals = vals.sort((a,b)=>{ + a = textSelctor(a) + b = textSelctor(b) + if (a === b) { + return 0 + } + else { + switch (name) { + case "method": + if (a.startsWith("TBE") && b.startsWith("TBE")) { + return (a === "TBE" ? -1 : 1) + } + else if(a.startsWith("TBE")) { + return -1 + } + else if (b.startsWith("TBE")) { + return 1 + } + else { + return a.localeCompare(b) + } + break; + case "basis": + if (a === "aug-cc-pVTZ") { + return -1 + } + else if (b === "aug-cc-pVTZ") { + return -1 + } + else { + return a.localeCompare(b) + } + case "sets": + return 0 + default: + return a.localeCompare(b) + } + } + }) + } textSelctor = function (value) { switch (name) { case "sets":