fix bugs introduced by reversion

please test on localhost! thx <3
https://i.imgur.com/Kb3V1Yb.png
pull/29/head
justcool393 2022-11-28 10:34:52 -06:00
parent a6d933333a
commit fc7069ca57
3 changed files with 15 additions and 6 deletions

View File

@ -7,15 +7,24 @@ function sort_table(n) {
for (let i = 1; i < rows.length; i++) { for (let i = 1; i < rows.length; i++) {
const ele = rows[i]; const ele = rows[i];
let x = rows[i].getElementsByTagName("TD")[n]; let x = rows[i].getElementsByTagName("TD")[n];
x = x.getElementsByTagName('a')[0] || x; if (!('sortKey' in x.dataset)) {
const attr = x.dataset.time ? parseInt(x.dataset.time) : parseInt(x.innerHTML.replace(/,/g, '')); x = x.getElementsByTagName('a')[0] || x;
}
var attr;
if ('sortKey' in x.dataset) {
attr = x.dataset.sortKey;
} else if ('time' in x.dataset) {
attr = parseInt(x.dataset.time);
} else {
attr = parseInt(x.innerHTML.replace(/,/g, ''));
}
items.push({ ele, attr }); items.push({ ele, attr });
} }
if (sortAscending[n]) { if (sortAscending[n]) {
items.sort((a, b) => a.attr - b.attr); items.sort((a, b) => a.attr > b.attr);
sortAscending[n] = false; sortAscending[n] = false;
} else { } else {
items.sort((a, b) => b.attr - a.attr); items.sort((a, b) => a.attr < b.attr);
sortAscending[n] = true; sortAscending[n] = true;
} }

View File

@ -23,7 +23,7 @@
<td>{{r[1]}}</td> <td>{{r[1]}}</td>
<td>{{r[2]}}</td> <td>{{r[2]}}</td>
{% set ratio = (r[1]/r[2])|string %} {% set ratio = (r[1]/r[2])|string %}
<td>{{ratio[:3]}}</td> <td data-sort-key="{{ratio[:3]}}">{{ratio[:3]}}</td>
<td>{{r[3]}}</td> <td>{{r[3]}}</td>
</tr> </tr>
{% endfor %} {% endfor %}

View File

@ -1,6 +1,6 @@
{%- include 'admin/shadowbanned_tooltip.html' -%} {%- include 'admin/shadowbanned_tooltip.html' -%}
{% if user and (not user.shadowbanned or v.can_see_shadowbanned) %} {% if user and (not user.shadowbanned or v.can_see_shadowbanned) %}
<a style="color:#{{user.name_color}};font-weight:bold" href="/@{{user.username}}"> <a data-sort-key="{{user.username.lower()}}" style="color:#{{user.name_color}};font-weight:bold" href="/@{{user.username}}">
<div class="profile-pic-20-wrapper mb-2"> <div class="profile-pic-20-wrapper mb-2">
<img loading="lazy" src="{{user.profile_url}}" class="pp20"> <img loading="lazy" src="{{user.profile_url}}" class="pp20">
{% if user.hat_active -%} {% if user.hat_active -%}