| 1234567891011121314151617181920212223242526272829 |
- var
- /** @const @type {string} */
- GRID_LIST_ENDPOINT = '/api/list'
- ;
- document.addEventListener('DOMContentLoaded', function() {
- doGet(GRID_LIST_ENDPOINT, function(st, resp) {
- if (resp) {
- resp.sort(function(a, b) {
- if (a["date"] !== b["date"])
- return b["date"] -a["date"];
- // Same date, sort by difficulty
- if (a["level"] !== b["level"])
- return a["level"] -b["level"];
- // Same date & difficulty, sort by provider name
- return a["provider"].localeCompare(b["provider"]);
- });
- var frag = dFrag();
- resp.forEach(function(i) {
- frag.appendChild(makeGridListItem(i));
- });
- var gridList = dGet(R.id.gridList);
- gridList.textContent = "";
- gridList.appendChild(frag);
- }
- });
- });
|