From 1e56cd34ad971c82be44475d2d12c4cb012cd5ef Mon Sep 17 00:00:00 2001 From: MrOtherGuy Date: Sat, 6 Jun 2020 13:43:26 +0300 Subject: [PATCH] test alphabetical sorting again --- html_resources/main.css | 1 + html_resources/selector.js | 10 ++++++---- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/html_resources/main.css b/html_resources/main.css index 38aa378..23a4c09 100644 --- a/html_resources/main.css +++ b/html_resources/main.css @@ -15,6 +15,7 @@ a:visited{ color: rgb(150,100,200) } a:hover{ color: rgb(200,150,100) } pre:empty{ display: none } .category{ padding: 0.2em 1em; cursor: pointer } +.category::after{ content: " (" attr(data-value) ")"} .currentCategory, .category:hover{ background-color: grey } diff --git a/html_resources/selector.js b/html_resources/selector.js index ffa8613..25cd7a0 100644 --- a/html_resources/selector.js +++ b/html_resources/selector.js @@ -106,7 +106,8 @@ function createCategories(){ link.title = "See on Github"; link.target = "_blank"; }else{ - node.textContent = name; + node.textContent = name.name; + node.setAttribute("data-value",name.value); } return node; @@ -140,12 +141,13 @@ function createCategories(){ } } let map = ret.map((a,i)=>({name:a,value:ns[i]})) - - return map.sort((a,b)=>(a.value > b.value?-1:a.value < b.value ? 1:0)) + return map + //return map.sort((a,b)=>(a.value > b.value?-1:a.value < b.value ? 1:0)) })(); for(let cat of CAT_NAMES){ - CAT_PARENT.appendChild(createCategory(cat.name)) + // CAT_PARENT.appendChild(createCategory(cat.name)) + CAT_PARENT.appendChild(createNode(cat,"category")) } }