Last active
June 16, 2017 15:15
-
-
Save EntranceJew/1a8efdfaa9073d052513f9fa8d7e3bcc to your computer and use it in GitHub Desktop.
if you're on a page fulla emojis, lazyload them all and this will download them all [will take some time]
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
// WARNING: this will take some time, chrome might hiccup, you might be prompted in the URL bar to run unsafe scripts | |
function saveFile(url, filename) { | |
// Get file name from url. | |
var xhr = new XMLHttpRequest(); | |
xhr.responseType = 'blob'; | |
xhr.onload = function() { | |
var a = document.createElement('a'); | |
a.href = window.URL.createObjectURL(xhr.response); // xhr.response is a blob | |
a.download = filename; // Set the file name. | |
a.style.display = 'none'; | |
document.body.appendChild(a); | |
a.click(); | |
delete a; | |
}; | |
xhr.open('GET', "https://crossorigin.me/" + url); | |
xhr.send(); | |
} | |
var z = "", t = "", u = ""; | |
$("li > a > img").each( function( k, v ){ | |
u = $(v).attr("srcset").split(" ")[0]; | |
t = $(v).parent("a").attr("href").split("/"); | |
t.pop(); | |
saveFile(u, t.pop() + ".png"); | |
} ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment