Skip to content

Instantly share code, notes, and snippets.

@michimani
Last active Jul 16, 2021
Embed
What would you like to do?
This is a bookmarklet shows only images in a modelpress page, for example https://mdpr.jp/photo/detail/8869191.
function () {
const _d = document;
const imgElemList = _d.querySelectorAll('ol.pg-photo__webImageList a img');
if (imgElemList.length == 0) {
alert('Images not found.');
return;
}
imgElemList.forEach((e, i) => {
let imgSrc = e.getAttribute('src');
imgSrc = imgSrc.slice(0, imgSrc.indexOf('?'));
_d.write(`<img src="${imgSrc}">`);
});
_d.close();
}
javascript: (function () {
const _d = document;
const imgElemList = _d.querySelectorAll('ol.pg-photo__webImageList a img');
if (imgElemList.length == 0) {
alert('Images not found.');
return;
}
imgElemList.forEach((e, i) => {
let imgSrc = e.getAttribute('src');
imgSrc = imgSrc.slice(0, imgSrc.indexOf('?'));
_d.write(`<img src="${imgSrc}">`);
});
_d.close();
})()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment