Add the media downloader with hash storage and local file serving
This commit is contained in:
+4
-3
@@ -170,15 +170,16 @@
|
||||
function renderGrid() {
|
||||
grid.replaceChildren();
|
||||
for (const item of state.items) {
|
||||
const source = item.localUrl || item.url;
|
||||
const card = el("a", "vk-media-card");
|
||||
card.href = item.url;
|
||||
card.href = source;
|
||||
card.target = "_blank";
|
||||
card.rel = "noreferrer";
|
||||
|
||||
if ((item.kind === "image" || item.kind === "gif") && /^https?:/.test(item.url)) {
|
||||
if ((item.kind === "image" || item.kind === "gif") && /^(https?:|\/)/.test(source)) {
|
||||
const img = document.createElement("img");
|
||||
img.loading = "lazy";
|
||||
img.src = item.url;
|
||||
img.src = source;
|
||||
img.alt = item.kind;
|
||||
card.append(img);
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user