Skip to content

Commit

Permalink
ad-hoc bulk downloader for all emoji beginning with 'basketball_'
Browse files Browse the repository at this point in the history
maybe to be expanded later and maybe made less silly
  • Loading branch information
Matt Hughes committed Mar 18, 2017
1 parent bd38bc6 commit 3150abf
Showing 1 changed file with 31 additions and 0 deletions.
31 changes: 31 additions & 0 deletions download-emoji.js
Original file line number Diff line number Diff line change
@@ -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 => {
$("<a>").attr({
download: emojiName,
href: URL.createObjectURL(blob)
})[0].click();
//$body.append($('<a class="js-download">download meeeeee</a>').attr("download", emojiName + '.png').attr("href", emojiURI));
});
});

$('.js-download')
.each(function(i, selection) {
selection.click();
});

0 comments on commit 3150abf

Please sign in to comment.