fds
This commit is contained in:
parent
35b6d06c3c
commit
1ac54d0351
4 changed files with 42 additions and 5 deletions
|
@ -33,4 +33,41 @@ function sort_table(n) {
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function sort_table2(n) {
|
||||
var table, rows, switching, i, x, y, shouldSwitch, dir, switchcount = 0;
|
||||
table = document.getElementById("sortable_table");
|
||||
switching = true;
|
||||
dir = "asc";
|
||||
while (switching) {
|
||||
switching = false;
|
||||
rows = table.rows;
|
||||
for (i = 1; i < (rows.length - 1); i++) {
|
||||
shouldSwitch = false;
|
||||
x = rows[i].getElementsByTagName("TD")[n];
|
||||
y = rows[i + 1].getElementsByTagName("TD")[n];
|
||||
if (dir == "asc") {
|
||||
if (parseInt(x.innerHTML) > parseInt(y.innerHTML)) {
|
||||
shouldSwitch = true;
|
||||
break;
|
||||
}
|
||||
} else if (dir == "desc") {
|
||||
if (parseInt(x.innerHTML) < parseInt(y.innerHTML)) {
|
||||
shouldSwitch = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (shouldSwitch) {
|
||||
rows[i].parentNode.insertBefore(rows[i + 1], rows[i]);
|
||||
switching = true;
|
||||
switchcount ++;
|
||||
} else {
|
||||
if (switchcount == 0 && dir == "asc") {
|
||||
dir = "desc";
|
||||
switching = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -4,7 +4,7 @@
|
|||
|
||||
{% block content %}
|
||||
|
||||
<script src="/static/assets/js/sort_table.js?a=2"></script>
|
||||
<script src="/static/assets/js/sort_table.js?a=3"></script>
|
||||
|
||||
<pre class="d-none d-md-inline-block"></pre>
|
||||
<h5 style="font-weight:bold;">Admins</h5>
|
||||
|
@ -15,8 +15,8 @@
|
|||
<tr>
|
||||
<th style="font-weight:bold;">#</th>
|
||||
<th role="button" onclick="sort_table(1)" style="font-weight:bold;">Name</th>
|
||||
<th role="button" onclick="sort_table(2)" style="font-weight:bold; text-align:right;">Truescore</th>
|
||||
<th role="button" onclick="sort_table(3)" style="font-weight:bold; text-align:right;">Mod actions</th>
|
||||
<th role="button" onclick="sort_table2(2)" style="font-weight:bold; text-align:right;">Truescore</th>
|
||||
<th role="button" onclick="sort_table2(3)" style="font-weight:bold; text-align:right;">Mod actions</th>
|
||||
</tr>
|
||||
</thead>
|
||||
{% for user in admins %}
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
{% extends "settings2.html" %}
|
||||
|
||||
{% block content %}
|
||||
<script src="/static/assets/js/sort_table.js?a=2"></script>
|
||||
<script src="/static/assets/js/sort_table.js?a=3"></script>
|
||||
|
||||
<div class="overflow-x-auto">
|
||||
<table id="sortable_table" class="table table-striped mb-5 text-small-mobile">
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
{% extends "settings2.html" %}
|
||||
|
||||
{% block content %}
|
||||
<script src="/static/assets/js/sort_table.js?a=2"></script>
|
||||
<script src="/static/assets/js/sort_table.js?a=3"></script>
|
||||
|
||||
<div class="overflow-x-auto">
|
||||
<table id="sortable_table" class="table table-striped mb-5 text-small-mobile">
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue