INNER CODE UNIT · Python
setupFavicons
gurkenlabs/litiengine · config/javadoc/generate_js.py:66
function setupFavicons() {
const r = getRoot();
const head = document.head || document.getElementsByTagName('head')[0];
if (!head || document.querySelector('link[rel*="icon"]')) return;
const faviconTypes = [
{ rel: 'icon', type: 'image/png', sizes: '32x32', href: r + 'assets/favicon-32x32.png' },
{ rel: 'icon', type: 'image/png', sizes: '16x16', href: r + 'assets/favicon-16x16.png' },
{ rel: 'shortcut icon', href: r + 'assets/favicon.ico' },
{ rel: 'apple-touch-icon', sizes: '48x48', href: r + 'assets/favicon-48x48.png' }
];
faviconTypes.forEach(fav => {
const link = document.createElement('link');
link.rel = fav.rel;
if (fav.type) link.type = fav.type;
if (fav.sizes) link.sizes = fav.sizes;
link.href = fav.href;