Created
April 6, 2018 18:09
-
-
Save arbazsiddiqui/f552ba7cab78283a5d3dc74b90c3497c to your computer and use it in GitHub Desktop.
A function to view all the pictures in an open directory.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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(); | |
})() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.