Allow reverse sorting to appease the weebs
This commit is contained in:
1 parent
e3380f21f5
commit
90371b4673
1 file changed
+13
@@ -17,6 +17,8 @@
|
||||
{% endfor %}
|
||||
];
|
||||
|
||||
var Network_Sorting;
|
||||
|
||||
function swap_networks(index1, index2) {
|
||||
|
||||
var temp = Networks[index1];
|
||||
@@ -29,11 +31,22 @@
|
||||
table.rows[index2+1].innerHTML = temp_row;
|
||||
}
|
||||
|
||||
function invert_networks() {
|
||||
for (let i = 0; i * 2 != Networks.length; i++)
|
||||
swap_networks(i, Networks.length-i-1);
|
||||
}
|
||||
|
||||
function sort_networks(field) {
|
||||
|
||||
if (Network_Sorting == field)
|
||||
return invert_networks();
|
||||
|
||||
for (let i = 0; i != Networks.length; i++)
|
||||
for (let j = i + 1; j != Networks.length; j++)
|
||||
if (Networks[j][field] > Networks[i][field])
|
||||
swap_networks(i, j);
|
||||
|
||||
Network_Sorting = field;
|
||||
};
|
||||
|
||||
document.addEventListener('DOMContentLoaded', function () { sort_networks("default"); }, false);
|
||||
|
||||
Reference in new issue
Block a user