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){ diff --git a/mod/settings.php b/mod/settings.php index 5ae30d7d36..67f8d69a2e 100644 --- a/mod/settings.php +++ b/mod/settings.php @@ -1187,6 +1187,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')), 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}}