mirror of
https://github.com/friendica/friendica
synced 2024-12-23 02:40:17 +00:00
Merge pull request #1460 from FlxAlbroscheit/develop
Issue 1163: Feature allowing desktop-notifications
This commit is contained in:
commit
106b0b5d23
3 changed files with 21 additions and 0 deletions
12
js/main.js
12
js/main.js
|
@ -182,6 +182,18 @@
|
|||
text = e.text().format("<span class='contactname'>"+e.attr('name')+"</span>");
|
||||
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){
|
||||
|
|
|
@ -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')),
|
||||
|
|
|
@ -133,6 +133,11 @@
|
|||
{{include file="field_intcheckbox.tpl" field=$notify8}}
|
||||
</div>
|
||||
|
||||
<div class="field">
|
||||
<button onclick="javascript:Notification.requestPermission(function(perm){if(perm === 'granted')alert('{{$desktop_notifications_success_message}}');});return false;">{{$desktop_notifications}}</button>
|
||||
<span class="field_help">{{$desktop_notifications_note}}</span>
|
||||
</div>
|
||||
|
||||
{{include file="field_checkbox.tpl" field=$email_textonly}}
|
||||
|
||||
</div>
|
||||
|
|
Loading…
Reference in a new issue