Re:A list of computer languages with release year and category
by droidist2 on Wednesday September 25, 2019 @02:16PM
(#21073539)
Wish it was sortable by date
[ Parent
| on HN ]
Re:A list of computer languages with release year and category
by ravenstine on Wednesday September 25, 2019 @02:52PM
(#21073944)
Closest I could get:
`Array.from(document.querySelectorAll('table tbody tr')).sort((a, b) => { const yearA = parseInt(a.querySelector('td:nth-child(3)').innerText) || 2019, yearB = parseInt(b.querySelector('td:nth-child(3)').innerText) || 2019; return yearB - yearA; }).forEach(tr => { tr.remove(); document.querySelector('table tbody').insertAdjacentElement('afterbegin', tr) });`
Re:A list of computer languages with release year and category
by codelani on Wednesday September 25, 2019 @04:48PM
(#21075261)
Just added. Hope it doesn't break anything as that's the first Javascript I've added to an otherwise static site. Please let me know if that works!
Re:A list of computer languages with release year and category
by bendiksolheim on Wednesday September 25, 2019 @02:48PM
(#21073894)
This is doable with some JavaScript. Paste the JavaScript from this gist [1] in your console while on the web page, and the table will be sorted descending by year. Swap `bValue - aValue` on line 4 with `aValue - bValue` to sort ascending.
[1] - https://gist.github.com/bendiksolheim/307a6af9aba2c4360c75b9...
Re:A list of computer languages with release year and category
by fireattack on Wednesday September 25, 2019 @02:51PM
(#21073937)
It breaks/stops at rows with blank "appeared".
Re:A list of computer languages with release year and category
by tuespetre on Wednesday September 25, 2019 @03:08PM
(#21074170)
Floop
document.querySelector('tbody').append(...Array.from(document.querySelector('tbody').rows).map(row => ({ row, year: parseInt(row.cells[2].textContent) || 9000 })).sort((a, b) => a.year < b.year ? -1 : a.year > b.year ? 1 : 0).map(x => x.row))
Re:A list of computer languages with release year and category
by stephen82 on Wednesday September 25, 2019 @03:03PM
(#21074103)
Yeah, I find it quite difficult to navigate without sorting them in chronological order...
Re:A list of computer languages with release year and category
by sim_card_map on Wednesday September 25, 2019 @02:51PM
(#21073930)
And by users.