From d2261397d942e7a957363b3ef0f970bfaf8fd910 Mon Sep 17 00:00:00 2001 From: FlxAlbroscheit Date: Tue, 31 Mar 2015 02:10:36 +0200 Subject: [PATCH] Feature for desktop-notifications --- js/main.js | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/js/main.js b/js/main.js index 5f4b56f4d8..53608024c9 100644 --- a/js/main.js +++ b/js/main.js @@ -182,6 +182,18 @@ text = e.text().format(""+e.attr('name')+""); html = notifications_tpl.format(e.attr('href'),e.attr('photo'), text, e.attr('date'), e.attr('seen')); nnm.append(html); + + if(e.text().search('→') == 0) { + var notification = new Notification(document.title, { + body: e.text().replace('→ ',''), + icon: e.attr('photo') + }); + + // TODO (yet unsupported by most browsers): + // Implement notification.onclick() + + notifyMarkAll(); + } }); $("img[data-src]", nnm).each(function(i, el){ -- 2.39.5