all repos — Private-Trackers-Spreadsheet @ 0d1bc8c864cc07031858621e6be452197ce52d4c

A spreadsheet providing detailed information about private trackers

assets/js/app.js (view raw)

 1
 2
 3
 4
 5
 6
 7
 8
 9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
 100
 101
 102
 103
 104
 105
 106
 107
 108
 109
 110
 111
 112
 113
 114
 115
 116
 117
 118
 119
 120
 121
 122
 123
 124
 125
 126
 127
 128
 129
 130
 131
 132
$(document).ready( function () {
    const options = {
        ajax: {
            url: './trackers.json',
            dataSrc: 'trackers'
        },
        columns: [
            { data: 'Name' },
            { data: 'Abbreviation' },
            { data: 'Type' },
            { data: 'Codebase' },
            { data: 'Observatory Grade' },
            { data: 'Users' },
            { data: 'Torrents' },
            { data: 'Peers' },
            { data: 'Ratio' },
            { data: 'Ratio Diff' },
            { data: 'Freeleech' },
            { data: 'Points' },
            { data: 'Hit & Run' },
            { data: 'Birthdate' },
            { data: 'Join' },
            { data: 'Join Diff' },
            { data: 'Updated' },
        ],
        columnDefs: [
            {
                targets: [4, 8, 9, 10, 11, 12, 15],
                render: function (data) {

                    const styleMap = {
                        'N/A': {
                            labelType: 'default',
                            style: 'color: #9b9b9b;'
                        },
                        'Easy': {
                            labelType: 'default',
                            style: 'color: #0FB492;'
                        },
                        'Medium': {
                            labelType: 'default',
                            style: 'color: #EE7E2A;'
                        },
                        'Hard': {
                            labelType: 'default',
                            style: 'color: #E64141;'
                        },
                        'Impossible': {
                            labelType: 'default',
                            style: 'color: #720f0f;'
                        },
                        'Yes': {
                            labelType: 'default',
                            style: 'color: #50992a;'
                        },
                        'No': {
                            labelType: 'default',
                            style: 'color: #a05262;'
                        },
                        'A +': {
                            labelType: 'success',
                            style: 'border: #0FB492 .5px solid; color: #9b9b9b;'
                        },
                        'A': {
                            labelType: 'success',
                            style: 'border: #0FB492 .5px solid; color: #9b9b9b;'
                        },
                        'A -': {
                            labelType: 'success',
                            style: 'border: #0FB492 .5px solid; color: #9b9b9b;'
                        },
                        'B +': {
                            labelType: 'primary',
                            style: 'border: #00AEC8 .5px solid; color: #9b9b9b;'
                        },
                        'B': {
                            labelType: 'primary',
                            style: 'border: #00AEC8 .5px solid; color: #9b9b9b;'
                        },
                        'B -': {
                            labelType: 'primary',
                            style: 'border: #00AEC8 .5px solid; color: #9b9b9b;'
                        },
                        'C +': {
                            labelType: 'warning',
                            style: 'border: #81519C .5px solid; color: #9b9b9b;'
                        },
                        'C': {
                            labelType: 'warning',
                            style: 'border: #81519C .5px solid; color: #9b9b9b;'
                        },
                        'C -': {
                            labelType: 'warning',
                            style: 'border: #81519C .5px solid; color: #9b9b9b;'
                        },
                        'D +': {
                            labelType: 'info',
                            style: 'border: #EE7E2A .5px solid; color: #9b9b9b;'
                        },
                        'D': {
                            labelType: 'info',
                            style: 'border: #EE7E2A .5px solid; color: #9b9b9b;'
                        },
                        'D -': {
                            labelType: 'info',
                            style: 'border: #EE7E2A .5px solid; color: #9b9b9b;'
                        },
                        'F': {
                            labelType: 'danger',
                            style: 'border: #E64141 .5px solid; color: #9b9b9b;'
                        }
                    };

                    const styles = styleMap[data];

                    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 data;
                }
            }
        ],
        paging: false,
        responsive: true,
        fixedHeader: true,
        order: [[ 0, "asc" ]]
    };
    const table = $('#table').DataTable(options);
} );