PageSourceSearch

https://static.www.calottery.com/-/media/themes/calottery/pws/pws/…&hash=FF104A7074279ECF4FB7AC54E44A4FC9

js calottery.com collected 2026-09-24 09:18:02 UTC 5,039 bytes, 173 lines download raw bytes

1(function ($) {
2  function createSortableTable(tableGroup) {
3
4    var table = tableGroup.querySelector('table');
5    var headerGroup = table.querySelector('thead');
6    var headerRow = headerGroup.querySelector('tr');
7    var headers = headerRow.querySelectorAll('th');
8    var rowGroup = table.querySelector('tbody');
9    var rows = rowGroup.querySelectorAll('tr');
10    var captionElement = table.querySelector('caption');
11    var caption = captionElement.innerText;
12
13    var liveRegion = tableGroup.querySelector('#liveRegion');
14    var readCaptions = liveRegion.getAttribute('readCaptions');
15    if (readCaptions === null) {
16      readCaptions = false;
17    }
18    liveRegion.classList.add('deque-visuallyhidden');
19    liveRegion.notify = function (text) {
20      liveRegion.innerHTML = text;
21    };
22
23    var sortOrder = null;
24    var sortDirection = -1;
25
26    function getSortHeader() {
27      if (sortOrder === null) {
28        return null;
29      }
30      return headerRow.children[sortOrder];
31    }
32
33    function getSortLabel() {
34      var header = getSortHeader();
35      if (!header) {
36        return null;
37      }
38      return header.innerText;
39    }
40
41    function getSortDirection() {
42      return sortDirection > 0 ? 'ascending' : 'descending';
43    }
44
45    function getSortInfo() {
46      if (sortOrder === null) {
47        return 'unsorted';
48      }
49
50      return 'sorted by ' + getSortLabel() + ', ' + getSortDirection();
51    }
52
53    function renderSorting() {
54      updateCaption();
55      updateAriaSort();
56      updateLiveRegion();
57    }
58
59    function updateAriaSort() {
60      for (var i = 0; i < headerRow.children.length; i++) {
61        var child = headerRow.children[i];
62
63        if (sortOrder !== null && i === Math.abs(sortOrder)) {
64          var direction = getSortDirection();
65          child.setAttribute('aria-sort', direction);
66        } else {
67          child.removeAttribute('aria-sort');
68        }
69      }
70    }
71
72    function updateCaption() {
73      var captionText = caption + ', ' + getSortInfo();
74      captionElement.innerText = captionText;
75    }
76
77    function updateLiveRegion() {
78      if (readCaptions) {
79        var captionText = 'Table ' + caption + ' is now ' + getSortInfo();
80        liveRegion.notify(captionText);
81      }
82    }
83    rows = Array.prototype.slice.call(rows);
84    var isValid = rows.every(function (row) {
85      return row.children.length === headers.length;
86    });
87
88    if (!isValid) {
89      throw new Error('Each row must be the same length as the headers row.');
90    }
91
92    headers = Array.prototype.slice.call(headers);
93    headers.forEach(function (header, i) {
94      createHeaderCell(header, function (e) {
95        e.preventDefault();
96        rows = sortByIndex(rows, i);
97        table.renderData(rows);
98      });
99    });
100
101    table.renderData = function (rows) {
102      rowGroup.innerHTML = toHTML(rows);
103      renderSorting();
104    };
105
106    table.renderData(rows);
107
108    function sortByIndex(rows, index) {
109      if (sortOrder === index) {
110        sortDirection = -sortDirection;
111        return rows.reverse();
112      } else {
113        sortOrder = index;
114        return rows.sort(function (a, b) {
115          a = Array.prototype.slice.call(a.children);
116          b = Array.prototype.slice.call(b.children);
117          var aVal = a[index].innerText;
118          var bVal = b[index].innerText;
119
120          if (!isNaN(parseInt(aVal)) && !isNaN(parseInt(bVal))) {
121            if (parseInt(aVal) < parseInt(bVal)) {
122              return -1;
123            }
124            if (parseInt(aVal) > parseInt(bVal)) {
125              return 1;
126            }
127            return 0;
128          } else {
129            if (aVal < bVal) {
130              return -1;
131            }
132            if (aVal > bVal) {
133              return 1;
134            }
135            return 0;
136          }
137        });
138      }
139    }
140
141    var firstOne = table.querySelector('.sortableColumnLabel');
142    if (firstOne) {
143      firstOne.click();
144    } // give the table a default sort...
145  }
146
147  function createHeaderCell(header, handler) {
148    var button = header.querySelector('button');
149    button.setAttribute('tabindex', '0');
150
151    button.addEventListener('click', handler);
152  }
153
154  function toHTML(rows) {
155    return rows.map(function (row) {
156      row = Array.prototype.slice.call(row.children);
157      return '<tr role="row">\n    ' + row.map(function (item, index) {
158        if (index === 0) {
159          return '<th scope="row" role="rowheader">' + item.innerText + '</th>';
160        }
161        return '<td role="gridcell">' + item.innerText + '</td>';
162      }).join('') + '</tr>';
163    }).join('');
164  }
165
166  function activateAllSortableTables() {
167    var sortableTables = document.querySelectorAll('.deque-table-sortable-group');
168    for (var i = 0; i < sortableTables.length; i++) {
169      createSortableTable(sortableTables[i]);
170    }
171  }
172  activateAllSortableTables();
173})(jQuery);

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.