PageSourceSearch

https://chainz.cryptoid.info/js/home.js?0

js cryptoid.info collected 2026-10-02 04:03:33 UTC 3,502 bytes, 108 lines download raw bytes

1var graveyard = '';
2function getUpdate() {
3   $.get('stats.dws', function(d) {
4      update(d);
5      if (graveyard === '') {
6         setTimeout(function () {
7            $('#show-graveyard').show();
8            graveyard = 0;
9         }, 750);
10      }
11   }).always(function () {
12      setTimeout(getUpdate, 10000);
13   });
14}
15
16function updateAges() {
17   setTimeout(updateAges, 5000);
18   for (var i=0; i<lastData.length-1; i++) {
19      var row = lastData[i];
20      $('#row-'+row[0]+' .block-age').text(ageString(row[3]));
21   }
22}
23
24var lastCol;
25var lastDir = 1;
26function sortCol(event,n) {
27   lastDir = (lastCol==n)?-lastDir:((n>3)?-1:1);
28   $("#chainz thead th").removeClass("sort-down").removeClass("sort-up");
29   $(event.currentTarget).addClass((lastDir>0)?"sort-up":"sort-down");
30   lastCol = n;
31   var rows = $('#chainz tbody tr').get();
32   rows.sort(function(a, b) {
33      var ca = indexedData[a.getAttribute('coin')][n] || '';
34      var cb = indexedData[b.getAttribute('coin')][n] || '';
35      return (ca<cb)?-lastDir:((ca>cb)?lastDir:0);
36   });
37   $.each(rows, function(index, row) {
38      $('#chainz').children('tbody').append(row);
39   });
40}
41
42var lastData = [], indexedData = {}, filter = '', lastFilter = '';
43function update(data) {
44   var lcFilter = filter.toLowerCase();
45   if (data[data.length-1].length == 0) { data.pop() }
46   if (lastData.length == 0) {
47      lastCol = 7;
48      data.sort(function (a,b) {
49         return b[7] - a[7];
50      });
51   }
52   var added = document.createDocumentFragment();
53   for (var i=0; i<data.length; i++) {
54      var row = data[i];
55      indexedData[row[0]] = row;
56      if (!(graveyard | row[8])) continue;
57      var tr = document.getElementById('row-'+row[0]);
58      if (!tr) {
59         tr = document.createElement('tr');
60         tr.setAttribute('id', 'row-'+row[0]);
61         tr.setAttribute('coin', row[0]);
62         tr.setAttribute('block-height', row[2]);
63         tr.onclick = function () {
64            window.location.href = '/' + this.getAttribute('coin') + '/';
65         };
66         added.appendChild(tr);
67      } else {
68         if (row[2] != tr.getAttribute('block-height')) {
69            tr.setAttribute('block-height', row[2]);
70            tr.className = 'row-flash';
71         }
72      }
73      if (lastFilter != filter) {
74         tr.style.display = (lcFilter != "") && ((row[0]+' '+row[1]).toLowerCase().indexOf(lcFilter) == -1) ? 'none' : '';
75      }
76      tr.innerHTML =
77           '<td style="background-image:url(/logo/40/' + row[0] + '.png)"><a href="/' + row[0] + '/">'
78               + row[1]
79         + '</a><td>' + row[2]
80         + '<td class="block-age">' + ageString(row[3])
81         + '<td>' + row[4]
82         + '<td>' + fmtDiff(row[5])
83         + '<td>' + fmtBTC(row[6])
84         + '<td>$&nbsp;' + fmtThousandths(Math.round(row[7]));
85   }
86   if (added.childElementCount > 0) {
87      document.querySelector('#chainz tbody').appendChild(added);
88      document.getElementById('chainz').style.opacity = 1;
89   }
90   lastFilter = filter;
91   lastData = data;
92   setTimeout( function(){ $("#chainz tr.row-flash").removeClass('row-flash') }, 500 );
93}
94
95function showGraveyard() {
96   graveyard = 1;
97   $('#show-graveyard').hide();
98   update(lastData);
99}
100
101getUpdate();
102setTimeout(updateAges, 5000);
103$('#filter').on('input', function () {
104  if ($(this).val() != filter) {
105     filter = $(this).val();
106     update(lastData);
107  }
108});

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.