From 001e940c6c3a7c8c93f8529450646b7edc23b74f Mon Sep 17 00:00:00 2001 From: FlxAlbroscheit Date: Tue, 31 Mar 2015 02:06:07 +0200 Subject: [PATCH 1/3] Feature for desktop-notifications see issue #1163 --- mod/settings.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/mod/settings.php b/mod/settings.php index b01c4fabde..93109fc0cf 100644 --- a/mod/settings.php +++ b/mod/settings.php @@ -1182,6 +1182,10 @@ function settings_content(&$a) { '$notify7' => array('notify7', t('You are tagged in a post'), ($notify & NOTIFY_TAGSELF), NOTIFY_TAGSELF, ''), '$notify8' => array('notify8', t('You are poked/prodded/etc. in a post'), ($notify & NOTIFY_POKE), NOTIFY_POKE, ''), + '$desktop_notifications' => t('Activate desktop notifications'), + '$desktop_notifications_note' => t('Note: This is an experimental feature, as being not supported by each browser'), + '$desktop_notifications_success_message' => t('You will now receive desktop notifications!'), + '$email_textonly' => array('email_textonly', t('Text-only notification emails'), get_pconfig(local_user(),'system','email_textonly'), t('Send text only notification emails, without the html part')), From d2261397d942e7a957363b3ef0f970bfaf8fd910 Mon Sep 17 00:00:00 2001 From: FlxAlbroscheit Date: Tue, 31 Mar 2015 02:10:36 +0200 Subject: [PATCH 2/3] 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){ From f054dbfc8d5aca226fd4f04140e47f60915e4595 Mon Sep 17 00:00:00 2001 From: FlxAlbroscheit Date: Tue, 31 Mar 2015 02:11:46 +0200 Subject: [PATCH 3/3] Feature for desktop-notifications --- view/templates/settings.tpl | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/view/templates/settings.tpl b/view/templates/settings.tpl index 323b614ef6..95ee0f6fbc 100644 --- a/view/templates/settings.tpl +++ b/view/templates/settings.tpl @@ -133,6 +133,11 @@ {{include file="field_intcheckbox.tpl" field=$notify8}} +
+ + {{$desktop_notifications_note}} +
+ {{include file="field_checkbox.tpl" field=$email_textonly}}