import Favico from 'favico.js'; import Cache from './cache.js'; import PageLayout from './page_layout.js'; import { $ngettext } from './gettext'; let stack = {}; let audio_notification = false; let directlydeleted = []; let favicon = null; function updateFavicon(text) { if (favicon === null) { const valid = $('head') .find('link[rel=icon]') .first(); $('head') .find('link[rel*=icon]') .not(valid) .remove(); favicon = new Favico({ bgColor: '#d60000', textColor: '#fff', fontStyle: 'normal', fontFamily: 'Lato', position: 'right', type: 'rectangle' }); } favicon.badge(text); } // Wrapper function that creates a desktop notification from given data function create_desktop_notification(data) { var notification = new Notification(STUDIP.STUDIP_SHORT_NAME, { body: data.text, icon: data.avatar, tag: data.id }); notification.addEventListener('click', () => { location.href = STUDIP.URLHelper.getURL(`dispatch.php/jsupdater/mark_notification_read/${notification.tag}`); }); } // Handler for all notifications received by an ajax request function process_notifications({ notifications }) { var cache = Cache.getInstance('desktop.notifications'); var ul = $('