Add resources download button + click to download picker in replay (#469)
Fixes #467 - Add a download button on the resource page for each entry to allow downloading each resource no matter what type. - Add a new 'click to download' image or media picker that allows highlighting + clicking on image/media to download on the page (to get around 'Save Image As...) not working. Also supports inline svgs + background images - should work better than Save Image As... - Location bar shows a popup indicating in 'click to download' mode, which can be canceled. Otherwise, mode remains until user downloads something. - Type fixes: Untangle Page and URLResource types for better type checking. - Deps: bump to wabac.js 2.25.1 for new download mode support --------- Co-authored-by: Tessa Walsh <tessa@bitarchivist.net>
This commit is contained in:
co-authored by
Tessa Walsh
parent
d2524ab26f
commit
916b154688
+6
-5
@@ -8,7 +8,7 @@ import "keyword-mark-element/lib/keyword-mark.js";
|
||||
import { getPageDateTS, getReplayLink } from "./pageutils";
|
||||
|
||||
import { wrapCss } from "./misc";
|
||||
import type { URLResource } from "./types";
|
||||
import type { Page, URLTsChange } from "./types";
|
||||
import {
|
||||
dateFormatter,
|
||||
dateTimeFormatter,
|
||||
@@ -24,7 +24,7 @@ class PageEntry extends LitElement {
|
||||
textSnippet: string | null = "";
|
||||
|
||||
@property({ type: Object })
|
||||
page: URLResource | null = null;
|
||||
page: Page | null = null;
|
||||
|
||||
@property({ type: String })
|
||||
replayPrefix = "";
|
||||
@@ -241,7 +241,7 @@ class PageEntry extends LitElement {
|
||||
href="${getReplayLink(
|
||||
"pages",
|
||||
this.page!.url,
|
||||
this.page!.timestamp!,
|
||||
this.page!.timestamp,
|
||||
this.page!.waczhash,
|
||||
)}"
|
||||
>
|
||||
@@ -294,7 +294,7 @@ class PageEntry extends LitElement {
|
||||
|
||||
private getReplayPrefix() {
|
||||
const waczhash = this.page!.waczhash ? `:${this.page!.waczhash}/` : "";
|
||||
const ts = this.page!.timestamp || "";
|
||||
const ts = this.page!.ts || "";
|
||||
return this.replayPrefix + "/" + waczhash + ts + "id_";
|
||||
}
|
||||
|
||||
@@ -370,11 +370,12 @@ class PageEntry extends LitElement {
|
||||
onReplay(event: Event, reload = false) {
|
||||
event.preventDefault();
|
||||
|
||||
const data = {
|
||||
const data: URLTsChange = {
|
||||
url: this.page!.url,
|
||||
ts: this.page!.timestamp,
|
||||
waczhash: this.page!.waczhash,
|
||||
};
|
||||
|
||||
this.sendChangeEvent(data, reload);
|
||||
return false;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user