1
0
mirror of https://github.com/morris/vanilla-todo.git synced 2025-08-21 13:21:29 +02:00

first commit

This commit is contained in:
Morris Brodersen
2020-10-20 17:27:16 +02:00
commit e36cdfeb11
39 changed files with 5914 additions and 0 deletions

24
public/scripts/AppIcon.js Normal file
View File

@@ -0,0 +1,24 @@
/* global VT */
window.VT = window.VT || {};
VT.AppIcon = function (el) {
if (el.children.length > 0) return;
var id = el.getAttribute('data-id');
var promise = VT.AppIcon.cache[id];
if (!promise) {
var url = VT.AppIcon.baseUrl + id + '.svg';
promise = VT.AppIcon.cache[id] = fetch(url).then(function (r) {
return r.text();
});
}
promise.then(function (svg) {
el.innerHTML = el.classList.contains('-double') ? svg + svg : svg;
});
};
VT.AppIcon.baseUrl =
'https://rawcdn.githack.com/primer/octicons/ff7f6eee63fa2f2d24d02e3aa76a87db48e4b6f6/icons/';
VT.AppIcon.cache = {};