diff --git a/download-emoji.js b/download-emoji.js new file mode 100644 index 0000000..487fc74 --- /dev/null +++ b/download-emoji.js @@ -0,0 +1,31 @@ +var $body = $('body'); +$('.emoji_row') + .filter( + function(i, selection) { + return $(selection).find('[headers="custom_emoji_name"]').html().match(/^:basketball/) ; + }) + .find('td[headers="custom_emoji_image"] span') + .map( + function(i, selection) { + return $(selection).data('original'); + }) + .each( + function(i, selection) { + var match = selection.match(/basketball_[^/]*/), + emojiName = match[0].replace('_', '-'), + emojiURI = selection; + fetch("https://crossorigin.me/" + emojiURI) + .then(res => res.blob()) + .then(blob => { + $("").attr({ + download: emojiName, + href: URL.createObjectURL(blob) + })[0].click(); + //$body.append($('download meeeeee').attr("download", emojiName + '.png').attr("href", emojiURI)); + }); + }); + +$('.js-download') + .each(function(i, selection) { + selection.click(); + });