parent
f08d421768
commit
2d1a7eceb0
@ -109,25 +109,34 @@ class Gatherer {
|
||||
}
|
||||
|
||||
*collectImagesInternal(img: HTMLImageElement) {
|
||||
const src = img.currentSrc || img.src;
|
||||
const item = this.makeItem(src, img);
|
||||
item.fileName = "";
|
||||
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);
|
||||
try {
|
||||
const src = img.currentSrc || img.src;
|
||||
const item = this.makeItem(src, img);
|
||||
if (item) {
|
||||
item.fileName = "";
|
||||
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) {
|
||||
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