embed: support referencing specific pages by index into page list, eg. url="page:0" will load the first page

sorter: use defaultKey / defaultDesc for url-resources sorter
This commit is contained in:
Ilya Kreymer
2020-09-06 20:42:32 -07:00
parent a3214dc081
commit 3f5431b7d7
5 changed files with 92 additions and 83 deletions
+14 -1
View File
@@ -72,6 +72,19 @@ function tsToDate(ts) {
return new Date(datestr);
};
// ===========================================================================
function getPageDateTS(page) {
let date = null;
try {
date = new Date(page.ts || page.date);
} catch (e) {
}
const timestamp = (date && !isNaN(date)) ? getTS(date.toISOString()) : "";
return {date, timestamp};
}
// ===========================================================================
function getTS(iso) {
@@ -120,5 +133,5 @@ function parseURLSchemeHostPath(url) {
}
export { digestMessage, tsToDate, getTS, sourceToId, parseURLSchemeHostPath,
export { digestMessage, tsToDate, getTS, getPageDateTS, sourceToId, parseURLSchemeHostPath,
registerSW, initDBWorker };