all repos — Private-Trackers-Spreadsheet @ 84d897810cfd3478881f0faff2d04bd24308e846

A spreadsheet providing detailed information about private trackers

Merge pull request #87 from tracker-user/defaults

Improve sorting: push empty cells to bottom, sort by desc first
HDVinnie hdinnovations@protonmail.com
Tue, 06 Apr 2021 17:38:11 -0400
commit

84d897810cfd3478881f0faff2d04bd24308e846

parent

74cdfdfeb59d502dc1a6386abba54d7c9a907a27

2 files changed, 24 insertions(+), 1 deletions(-)

jump to
M assets/js/app.jsassets/js/app.js

@@ -1,4 +1,13 @@

$(document).ready( function () { + // Push empty '-' cells to bottom when sorting + const namesType = $.fn.dataTable.absoluteOrder( [ + { value: '-', position: 'bottom' } + ] ); + + const numbersType = $.fn.dataTable.absoluteOrderNumber( [ + { value: '-', position: 'bottom' } + ] ); + const options = { ajax: { url: './trackers.json',

@@ -116,11 +125,24 @@

if (styles){ const labelType = styles.labelType || 'default'; const style = styles.style || ''; - return `<span class="label label-${labelType}" style="background-color: rgba(26, 26, 26, 1); ${style}"> ${data} </span>`; + return `<span class="label label-${labelType}" style="background-color: rgba(26, 26, 26, 1); ${style}"> ${data} </span>`; } return data; } + }, + { + // Sort by descending first for Users, Torrents, Peers and Updated + targets: [5, 6, 7, 16], + orderSequence: [ "desc", "asc" ] + }, + { + targets: [5, 6, 7], + type: numbersType + }, + { + targets: [1, 3, 4, 8, 9, 10, 11, 12, 13, 14, 15], + type: namesType } ], paging: false,
M index.htmlindex.html

@@ -18,6 +18,7 @@

<!-- jQuery & Datatables --> <script src="https://code.jquery.com/jquery-3.4.1.min.js" integrity="sha256-CSXorXvZcTkaix6Yvo6HppcZGetbYMGWSFlBw8HfCJo=" crossorigin="anonymous"></script> <script type="text/javascript" src="https://cdn.datatables.net/v/dt/dt-1.10.20/fh-3.1.6/r-2.2.3/sl-1.3.1/datatables.min.js"></script> + <script type="text/javascript" src="https://cdn.datatables.net/plug-ins/1.10.20/sorting/absolute.js"></script> <script type="text/javascript" charset="UTF-8" src="assets/js/app.js"></script> <!-- #FONT-AWESOME -->