parent
f08d421768
commit
2d1a7eceb0
@ -109,25 +109,34 @@ class Gatherer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
*collectImagesInternal(img: HTMLImageElement) {
|
*collectImagesInternal(img: HTMLImageElement) {
|
||||||
const src = img.currentSrc || img.src;
|
try {
|
||||||
const item = this.makeItem(src, img);
|
const src = img.currentSrc || img.src;
|
||||||
item.fileName = "";
|
const item = this.makeItem(src, img);
|
||||||
item.description = item.title;
|
|
||||||
yield item;
|
|
||||||
|
|
||||||
const {srcset} = img;
|
|
||||||
if (!srcset) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
const imgs = srcset.split(",").flatMap(e => {
|
|
||||||
const idx = e.lastIndexOf(" ");
|
|
||||||
return (idx > 0 ? e.slice(0, idx) : e).trim();
|
|
||||||
});
|
|
||||||
for (const i of imgs) {
|
|
||||||
const item = this.makeItem(i, img);
|
|
||||||
if (item) {
|
if (item) {
|
||||||
|
item.fileName = "";
|
||||||
|
item.description = item.title;
|
||||||
yield item;
|
yield item;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const {srcset} = img;
|
||||||
|
if (!srcset) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
const imgs = srcset.split(",").flatMap(e => {
|
||||||
|
const idx = e.lastIndexOf(" ");
|
||||||
|
return (idx > 0 ? e.slice(0, idx) : e).trim();
|
||||||
|
});
|
||||||
|
for (const i of imgs) {
|
||||||
|
const item = this.makeItem(i, img);
|
||||||
|
if (item) {
|
||||||
|
item.fileName = "";
|
||||||
|
item.description = item.title;
|
||||||
|
yield item;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (ex) {
|
||||||
|
console.error("oops image", ex.toString(), ex.stack, ex);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user