$(document).bind('keydown', 'alt+r', function() { $("#recentChangesDialog").dialog({ modal: true, width: 400, height: 700 }); $.ajax({ url: baseApiUrl + 'recent-changes/', type: 'GET', success: function (result) { const groupedByDate = {}; for (const row of result) { if (row.encryption > 0) { if (isEncryptionAvailable()) { row.note_title = decryptString(row.note_title); } else { row.note_title = "[encrypted]"; } } const dateDay = getDateFromTS(row.date_modified); dateDay.setHours(0); dateDay.setMinutes(0); dateDay.setSeconds(0); dateDay.setMilliseconds(0); // FIXME: we can use Map object instead to avoid this hack const dateDayTS = dateDay.getTime(); // we can't use dateDay as key because complex objects can't be keys if (!groupedByDate[dateDayTS]) { groupedByDate[dateDayTS] = []; } groupedByDate[dateDayTS].push(row); } const sortedDates = Object.keys(groupedByDate); sortedDates.sort(); sortedDates.reverse(); for (const dateDayTS of sortedDates) { const changesListEl = $('