Skip to content

Instantly share code, notes, and snippets.

@arbazsiddiqui
Created April 6, 2018 18:09
Show Gist options
  • Save arbazsiddiqui/f552ba7cab78283a5d3dc74b90c3497c to your computer and use it in GitHub Desktop.
Save arbazsiddiqui/f552ba7cab78283a5d3dc74b90c3497c to your computer and use it in GitHub Desktop.
A function to view all the pictures in an open directory.
javascript:(function () {
function I(u) {
var t = u.split('.'), e = t[t.length - 1].toLowerCase();
return {gif: 1, jpg: 1, jpeg: 1, png: 1, mng: 1}[e]
}
function hE(s) {
return s.replace(/&/g, '&').replace(/>/g, '>').replace(/</g, '<').replace(/"/g, '"');
}
var q, h, i, z = open().document;
z.write('<p>Images linked to by ' + hE(location.href) + ':</p><hr>');
for (i = 0; q = document.links[i]; ++i) {
h = q.href;
if (h && I(h)) z.write('<p>' + q.innerHTML + ' (' + hE(h) + ')<br><img src="' + hE(h) + '">');
}
z.close();
})()
@arbazsiddiqui
Copy link
Author

arbazsiddiqui commented Apr 6, 2018

Usage :
Go to your OD link with images like this.
Paste the code in console.
OR
If you find it useful enough, add it as bookmark, with where url is this function.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment