Skip to content

Instantly share code, notes, and snippets.

@michimani
Last active July 16, 2021 13:41
Show Gist options
  • Save michimani/ea17916546e4b2a8e0ad9536eb544431 to your computer and use it in GitHub Desktop.
Save michimani/ea17916546e4b2a8e0ad9536eb544431 to your computer and use it in GitHub Desktop.
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