Permalink
Browse files

Use warning emoji and set font

  • Loading branch information...
dsamarin committed May 23, 2018
1 parent 2d13bef commit f61faf3fa6aa88347e6a60bd7b8a5b94272d25fd
Showing with 14 additions and 12 deletions.
  1. +1 −1 ts/emoji-favicon-toolkit.ts
  2. +13 −11 ts/zerodrop.ts
@@ -82,7 +82,7 @@ export default function set_emoji_favicon(emoji: any, cacheWithServiceWorker?: a
// Canvas setup
canvas.width = canvas.height = size;
context.font = `normal normal normal ${size}px/${size}px sans-serif`;
context.font = `normal normal normal ${size}px/${size}px apple color emoji, segoe ui emoji, notocoloremoji, segoe ui symbol, android emoji, emojisymbols, emojione mozilla, sans-serif`;
context.textAlign = 'center';
context.textBaseline = 'middle';
@@ -9,18 +9,18 @@ import set_emoji_favicon from './emoji-favicon-toolkit';
function humanFileSize(bytes: number, si: boolean): string {
const thresh = si ? 1000 : 1024;
if(Math.abs(bytes) < thresh) {
if (Math.abs(bytes) < thresh) {
return bytes + ' B';
}
const units = si
? ['KB','MB','GB','TB','PB','EB','ZB','YB']
: ['KiB','MiB','GiB','TiB','PiB','EiB','ZiB','YiB'];
? ['KB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB']
: ['KiB', 'MiB', 'GiB', 'TiB', 'PiB', 'EiB', 'ZiB', 'YiB'];
let u = -1;
do {
bytes /= thresh;
++u;
} while(Math.abs(bytes) >= thresh && u < units.length - 1);
return bytes.toFixed(1)+' '+units[u];
} while (Math.abs(bytes) >= thresh && u < units.length - 1);
return bytes.toFixed(1) + ' ' + units[u];
}
$(() => {
@@ -32,26 +32,28 @@ $(() => {
return v.toString(16);
}));
});
// Custom file upload input
$('.zerodrop-file').change((event: JQuery.Event) => {
const element = $(event.currentTarget);
const file = (<FileList>element.prop('files'))[0];
$(element.data('name')).text(`${file.name} (${humanFileSize(file.size, true)})`);
$(element.data('mime')).val(file.type);
});
// New entry tabs
$('.zerodrop-nav').click((event: JQuery.Event) => {
const element = $(event.currentTarget);
element.find('input').prop('checked', true);
});
})
});
const emojis=['\uD83D\uDCA3', '\uD83D\uDD17']
const emojis = ['\u26a0\ufe0f', '\uD83D\uDD17']
let index = 0;
setInterval(() => {
function update_emoji() {
const emoji = emojis[index];
index = (index + 1) % emojis.length;
set_emoji_favicon(emoji);
}, 1333)
}
update_emoji();
setInterval(update_emoji, 1337)

0 comments on commit f61faf3

Please sign in to comment.