Skip to content

Instantly share code, notes, and snippets.

@michimani
Last active July 16, 2021 13:41
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
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