Merge pull request #1692 from fabrixxm/desktopnotifications
Desktop notifications
This commit is contained in:
commit
6eebfb2e13
14 changed files with 237 additions and 174 deletions
|
@ -262,10 +262,12 @@ function relative_date($posted_date,$format = null) {
|
||||||
return t('less than a second ago');
|
return t('less than a second ago');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
$time_append = '';
|
$time_append = '';
|
||||||
if ($etime >= 86400) {
|
if ($etime >= 86400) {
|
||||||
$time_append = ' ('.$localtime.')';
|
$time_append = ' ('.$localtime.')';
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
$a = array( 12 * 30 * 24 * 60 * 60 => array( t('year'), t('years')),
|
$a = array( 12 * 30 * 24 * 60 * 60 => array( t('year'), t('years')),
|
||||||
30 * 24 * 60 * 60 => array( t('month'), t('months')),
|
30 * 24 * 60 * 60 => array( t('month'), t('months')),
|
||||||
|
@ -283,7 +285,7 @@ function relative_date($posted_date,$format = null) {
|
||||||
// translators - e.g. 22 hours ago, 1 minute ago
|
// translators - e.g. 22 hours ago, 1 minute ago
|
||||||
if(! $format)
|
if(! $format)
|
||||||
$format = t('%1$d %2$s ago');
|
$format = t('%1$d %2$s ago');
|
||||||
return sprintf( $format,$r, (($r == 1) ? $str[0] : $str[1])).$time_append;
|
return sprintf( $format,$r, (($r == 1) ? $str[0] : $str[1]));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}}
|
}}
|
||||||
|
|
54
js/main.js
54
js/main.js
|
@ -181,24 +181,41 @@
|
||||||
nnm = $("#nav-notifications-menu");
|
nnm = $("#nav-notifications-menu");
|
||||||
nnm.html(notifications_all + notifications_mark);
|
nnm.html(notifications_all + notifications_mark);
|
||||||
//nnm.attr('popup','true');
|
//nnm.attr('popup','true');
|
||||||
|
|
||||||
|
var notification_lastitem = parseInt(localStorage.getItem("notification-lastitem"));
|
||||||
|
var notification_id = 0;
|
||||||
eNotif.children("note").each(function(){
|
eNotif.children("note").each(function(){
|
||||||
e = $(this);
|
e = $(this);
|
||||||
text = e.text().format("<span class='contactname'>"+e.attr('name')+"</span>");
|
var 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'));
|
var seenclass = (e.attr('seen')==1)?"notify-seen":"notify-unseen";
|
||||||
|
var html = notifications_tpl.format(e.attr('href'),
|
||||||
|
e.attr('photo'), // {0}
|
||||||
|
text, // {1}
|
||||||
|
e.attr('date'), // {2}
|
||||||
|
seenclass, // {3}
|
||||||
|
new Date(e.attr('timestamp')*1000) // {4}
|
||||||
|
);
|
||||||
nnm.append(html);
|
nnm.append(html);
|
||||||
|
});
|
||||||
if(e.text().search('→') == 0) {
|
$(eNotif.children("note").get().reverse()).each(function(){
|
||||||
|
e = $(this);
|
||||||
|
notification_id = parseInt(e.attr('timestamp'));
|
||||||
|
if (notification_lastitem!== null && notification_id > notification_lastitem) {
|
||||||
|
if (getNotificationPermission()==="granted") {
|
||||||
var notification = new Notification(document.title, {
|
var notification = new Notification(document.title, {
|
||||||
body: e.text().replace('→ ',''),
|
body: e.text().replace('→ ','').format(e.attr('name')),
|
||||||
icon: e.attr('photo')
|
icon: e.attr('photo'),
|
||||||
|
});
|
||||||
|
notification['url'] = e.attr('href');
|
||||||
|
notification.addEventListener("click", function(ev){
|
||||||
|
window.location = ev.target.url;
|
||||||
});
|
});
|
||||||
|
|
||||||
// TODO (yet unsupported by most browsers):
|
|
||||||
// Implement notification.onclick()
|
|
||||||
|
|
||||||
// notifyMarkAll();
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
|
notification_lastitem = notification_id;
|
||||||
|
localStorage.setItem("notification-lastitem", notification_lastitem)
|
||||||
|
|
||||||
$("img[data-src]", nnm).each(function(i, el){
|
$("img[data-src]", nnm).each(function(i, el){
|
||||||
// Add src attribute for images with a data-src attribute
|
// Add src attribute for images with a data-src attribute
|
||||||
|
@ -762,3 +779,18 @@ function previewTheme(elm) {
|
||||||
});
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// notification permission settings in localstorage
|
||||||
|
// set by settings page
|
||||||
|
function getNotificationPermission() {
|
||||||
|
if (window["Notification"] === undefined) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
if (Notification.permission === 'granted') {
|
||||||
|
var val = localStorage.getItem('notification-permissions');
|
||||||
|
if (val === null) return 'denied';
|
||||||
|
return val;
|
||||||
|
} else {
|
||||||
|
return Notification.permission;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
178
mod/ping.php
178
mod/ping.php
|
@ -1,7 +1,7 @@
|
||||||
<?php
|
<?php
|
||||||
require_once("include/datetime.php");
|
require_once("include/datetime.php");
|
||||||
require_once('include/bbcode.php');
|
require_once('include/bbcode.php');
|
||||||
|
require_once("mod/proxy.php");
|
||||||
|
|
||||||
function ping_init(&$a) {
|
function ping_init(&$a) {
|
||||||
|
|
||||||
|
@ -21,9 +21,7 @@ function ping_init(&$a) {
|
||||||
killme();
|
killme();
|
||||||
}
|
}
|
||||||
|
|
||||||
$firehose = intval(get_pconfig(local_user(),'system','notify_full'));
|
$notifs = ping_get_notifications(local_user());
|
||||||
|
|
||||||
$z = ping_get_notifications(local_user());
|
|
||||||
$sysnotify = 0; // we will update this in a moment
|
$sysnotify = 0; // we will update this in a moment
|
||||||
|
|
||||||
$tags = array();
|
$tags = array();
|
||||||
|
@ -162,13 +160,23 @@ function ping_init(&$a) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* return xml from notification array
|
||||||
|
*
|
||||||
|
* @param array $n Notification array:
|
||||||
|
* 'href' => notification link
|
||||||
|
* 'name' => subject name
|
||||||
|
* 'url' => subject url
|
||||||
|
* 'photo' => subject photo
|
||||||
|
* 'date' => notification date
|
||||||
|
* 'seen' => bool true/false
|
||||||
|
* 'message' => notification message. "{0}" will be replaced by subject name
|
||||||
|
**/
|
||||||
|
function xmlize($n){
|
||||||
|
$n['photo'] = proxy_url($n['photo']);
|
||||||
|
|
||||||
function xmlize($href, $name, $url, $photo, $date, $seen, $message){
|
$n['message'] = html_entity_decode($n['message'], ENT_COMPAT | ENT_HTML401, "UTF-8");
|
||||||
require_once("mod/proxy.php");
|
$n['name'] = html_entity_decode($n['name'], ENT_COMPAT | ENT_HTML401, "UTF-8");
|
||||||
$photo = proxy_url($photo);
|
|
||||||
|
|
||||||
$message = html_entity_decode($message, ENT_COMPAT | ENT_HTML401, "UTF-8");
|
|
||||||
$name = html_entity_decode($name, ENT_COMPAT | ENT_HTML401, "UTF-8");
|
|
||||||
|
|
||||||
// Are the nofications calles from the regular process or via the friendica app?
|
// Are the nofications calles from the regular process or via the friendica app?
|
||||||
$regularnotifications = (intval($_GET['uid']) AND intval($_GET['_']));
|
$regularnotifications = (intval($_GET['uid']) AND intval($_GET['_']));
|
||||||
|
@ -176,13 +184,16 @@ function ping_init(&$a) {
|
||||||
$a = get_app();
|
$a = get_app();
|
||||||
|
|
||||||
if ($a->is_friendica_app() OR !$regularnotifications)
|
if ($a->is_friendica_app() OR !$regularnotifications)
|
||||||
$message = str_replace("{0}", $name, $message);
|
$n['message'] = str_replace("{0}", $n['name'], $n['message']);
|
||||||
|
|
||||||
$data = array('href' => &$href, 'name' => &$name, 'url'=>&$url, 'photo'=>&$photo, 'date'=>&$date, 'seen'=>&$seen, 'messsage'=>&$message);
|
$local_time = datetime_convert('UTC',date_default_timezone_get(),$n['date']);
|
||||||
call_hooks('ping_xmlize', $data);
|
|
||||||
$notsxml = '<note href="%s" name="%s" url="%s" photo="%s" date="%s" seen="%s" >%s</note>'."\n";
|
call_hooks('ping_xmlize', $n);
|
||||||
|
$notsxml = '<note href="%s" name="%s" url="%s" photo="%s" date="%s" seen="%s" timestamp="%s" >%s</note>'."\n";
|
||||||
return sprintf ( $notsxml,
|
return sprintf ( $notsxml,
|
||||||
xmlify($href), xmlify($name), xmlify($url), xmlify($photo), xmlify($date), xmlify($seen), xmlify($message)
|
xmlify($n['href']), xmlify($n['name']), xmlify($n['url']), xmlify($n['photo']),
|
||||||
|
xmlify(relative_date($n['date'])), xmlify($n['seen']), xmlify(strtotime($local_time)),
|
||||||
|
xmlify($n['message'])
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -199,14 +210,9 @@ function ping_init(&$a) {
|
||||||
<birthdays>$birthdays</birthdays>
|
<birthdays>$birthdays</birthdays>
|
||||||
<birthdays-today>$birthdays_today</birthdays-today>\r\n";
|
<birthdays-today>$birthdays_today</birthdays-today>\r\n";
|
||||||
|
|
||||||
$tot = $mail+$intro+$register+count($comments)+count($likes)+count($dislikes)+count($friends)+count($posts)+count($tags);
|
|
||||||
|
|
||||||
if($firehose) {
|
if(count($notifs) && (! $sysnotify)) {
|
||||||
echo ' <notif count="'.$tot.'">';
|
foreach($notifs as $zz) {
|
||||||
}
|
|
||||||
else {
|
|
||||||
if(count($z) && (! $sysnotify)) {
|
|
||||||
foreach($z as $zz) {
|
|
||||||
if($zz['seen'] == 0)
|
if($zz['seen'] == 0)
|
||||||
$sysnotify ++;
|
$sysnotify ++;
|
||||||
}
|
}
|
||||||
|
@ -214,83 +220,68 @@ function ping_init(&$a) {
|
||||||
|
|
||||||
echo ' <notif count="'. ($sysnotify + $intro + $mail + $register) .'">';
|
echo ' <notif count="'. ($sysnotify + $intro + $mail + $register) .'">';
|
||||||
|
|
||||||
|
// merge all notification types in one array
|
||||||
if ($intro>0){
|
if ($intro>0){
|
||||||
foreach ($intros as $i) {
|
foreach ($intros as $i) {
|
||||||
echo xmlize($a->get_baseurl().'/notifications/intros/'.$i['id'], $i['name'], $i['url'], $i['photo'], relative_date($i['datetime']), 'notify-unseen', "→ ".t("{0} wants to be your friend"));
|
$n = array(
|
||||||
};
|
'href' => $a->get_baseurl().'/notifications/intros/'.$i['id'],
|
||||||
|
'name' => $i['name'],
|
||||||
|
'url' => $i['url'],
|
||||||
|
'photo' => $i['photo'],
|
||||||
|
'date' => $i['datetime'],
|
||||||
|
'seen' => false,
|
||||||
|
'message' => t("{0} wants to be your friend"),
|
||||||
|
);
|
||||||
|
$notifs[] = $n;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if ($mail>0){
|
if ($mail>0){
|
||||||
foreach ($mails as $i) {
|
foreach ($mails as $i) {
|
||||||
echo xmlize($a->get_baseurl().'/message/'.$i['id'], $i['from-name'], $i['from-url'], $i['from-photo'], relative_date($i['created']), 'notify-unseen',"→ ".t("{0} sent you a message"));
|
$n = array(
|
||||||
};
|
'href' => $a->get_baseurl().'/message/'.$i['id'],
|
||||||
|
'name' => $i['from-name'],
|
||||||
|
'url' => $i['from-url'],
|
||||||
|
'photo' => $i['from-photo'],
|
||||||
|
'date' => $i['created'],
|
||||||
|
'seen' => false,
|
||||||
|
'message' => t("{0} sent you a message"),
|
||||||
|
);
|
||||||
|
$notifs[] = $n;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if ($register>0){
|
if ($register>0){
|
||||||
foreach ($regs as $i) {
|
foreach ($regs as $i) {
|
||||||
echo xmlize($a->get_baseurl().'/admin/users/', $i['name'], $i['url'], $i['micro'], relative_date($i['created']), 'notify-unseen', "→ ".t("{0} requested registration"));
|
$n = array(
|
||||||
|
'href' => $a->get_baseurl().'/admin/users/',
|
||||||
|
'name' => $i['name'],
|
||||||
|
'url' => $i['url'],
|
||||||
|
'photo' => $i['micro'],
|
||||||
|
'date' => $i['created'],
|
||||||
|
'seen' => false,
|
||||||
|
'message' => t("{0} requested registration"),
|
||||||
|
);
|
||||||
|
$notifs[] = $n;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// sort notifications by $[]['date']
|
||||||
|
$sort_function = function($a, $b) {
|
||||||
|
$adate = date($a['date']);
|
||||||
|
$bdate = date($b['date']);
|
||||||
|
if ($adate == $bdate) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
return ($adate < $bdate) ? 1 : -1;
|
||||||
};
|
};
|
||||||
}
|
usort($notifs, $sort_function);
|
||||||
|
|
||||||
if(count($z)) {
|
if(count($notifs)) {
|
||||||
foreach($z as $zz) {
|
foreach($notifs as $n) {
|
||||||
echo xmlize($a->get_baseurl() . '/notify/view/' . $zz['id'], $zz['name'],$zz['url'],$zz['photo'],relative_date($zz['date']), ($zz['seen'] ? 'notify-seen' : 'notify-unseen'), ($zz['seen'] ? '' : '→ ') .strip_tags(bbcode($zz['msg'])));
|
echo xmlize($n);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if($firehose) {
|
|
||||||
if ($intro>0){
|
|
||||||
foreach ($intros as $i) {
|
|
||||||
echo xmlize( $a->get_baseurl().'/notifications/intros/'.$i['id'], $i['name'], $i['url'], $i['photo'], relative_date($i['datetime']), 'notify-unseen',t("{0} wants to be your friend") );
|
|
||||||
};
|
|
||||||
}
|
|
||||||
if ($mail>0){
|
|
||||||
foreach ($mails as $i) {
|
|
||||||
echo xmlize( $a->get_baseurl().'/message/'.$i['id'], $i['from-name'], $i['from-url'], $i['from-photo'], relative_date($i['created']), 'notify-unseen',t("{0} sent you a message") );
|
|
||||||
};
|
|
||||||
}
|
|
||||||
if ($register>0){
|
|
||||||
foreach ($regs as $i) {
|
|
||||||
echo xmlize( $a->get_baseurl().'/admin/users/', $i['name'], $i['url'], $i['micro'], relative_date($i['created']), 'notify-unseen',t("{0} requested registration") );
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
if (count($comments)){
|
|
||||||
foreach ($comments as $i) {
|
|
||||||
echo xmlize( $a->get_baseurl().'/display/'.$a->user['nickname']."/".$i['parent'], $i['author-name'], $i['author-link'], $i['author-avatar'], relative_date($i['created']), 'notify-unseen',sprintf( t("{0} commented %s's post"), $i['pname'] ) );
|
|
||||||
};
|
|
||||||
}
|
|
||||||
if (count($likes)){
|
|
||||||
foreach ($likes as $i) {
|
|
||||||
echo xmlize( $a->get_baseurl().'/display/'.$a->user['nickname']."/".$i['parent'], $i['author-name'], $i['author-link'], $i['author-avatar'], relative_date($i['created']), 'notify-unseen',sprintf( t("{0} liked %s's post"), $i['pname'] ) );
|
|
||||||
};
|
|
||||||
}
|
|
||||||
if (count($dislikes)){
|
|
||||||
foreach ($dislikes as $i) {
|
|
||||||
echo xmlize( $a->get_baseurl().'/display/'.$a->user['nickname']."/".$i['parent'], $i['author-name'], $i['author-link'], $i['author-avatar'], relative_date($i['created']), 'notify-unseen',sprintf( t("{0} disliked %s's post"), $i['pname'] ) );
|
|
||||||
};
|
|
||||||
}
|
|
||||||
if (count($friends)){
|
|
||||||
foreach ($friends as $i) {
|
|
||||||
echo xmlize($a->get_baseurl().'/display/'.$a->user['nickname']."/".$i['parent'],$i['author-name'],$i['author-link'], $i['author-avatar'], relative_date($i['created']), 'notify-unseen',sprintf( t("{0} is now friends with %s"), $i['fname'] ) );
|
|
||||||
};
|
|
||||||
}
|
|
||||||
if (count($posts)){
|
|
||||||
foreach ($posts as $i) {
|
|
||||||
echo xmlize( $a->get_baseurl().'/display/'.$a->user['nickname']."/".$i['parent'], $i['author-name'], $i['author-link'], $i['author-avatar'], relative_date($i['created']), 'notify-unseen',sprintf( t("{0} posted") ) );
|
|
||||||
};
|
|
||||||
}
|
|
||||||
if (count($tags)){
|
|
||||||
foreach ($tags as $i) {
|
|
||||||
echo xmlize( $a->get_baseurl().'/display/'.$a->user['nickname']."/".$i['parent'], $i['author-name'], $i['author-link'], $i['author-avatar'], relative_date($i['created']), 'notify-unseen',sprintf( t("{0} tagged %s's post with #%s"), $i['pname'], $i['tname'] ) );
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
if (count($cit)){
|
|
||||||
foreach ($cit as $i) {
|
|
||||||
echo xmlize( $a->get_baseurl().'/display/'.$a->user['nickname']."/".$i['parent'], $i['author-name'], $i['author-link'], $i['author-avatar'], relative_date($i['created']), 'notify-unseen',t("{0} mentioned you in a post") );
|
|
||||||
};
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
echo " </notif>";
|
echo " </notif>";
|
||||||
}
|
}
|
||||||
|
@ -322,7 +313,7 @@ function ping_get_notifications($uid) {
|
||||||
$offset = 0;
|
$offset = 0;
|
||||||
$seen = false;
|
$seen = false;
|
||||||
$seensql = "NOT";
|
$seensql = "NOT";
|
||||||
$order = "";
|
$order = "DESC";
|
||||||
$quit = false;
|
$quit = false;
|
||||||
|
|
||||||
$a = get_app();
|
$a = get_app();
|
||||||
|
@ -349,6 +340,7 @@ function ping_get_notifications($uid) {
|
||||||
else
|
else
|
||||||
$offset += 50;
|
$offset += 50;
|
||||||
|
|
||||||
|
|
||||||
foreach ($r AS $notification) {
|
foreach ($r AS $notification) {
|
||||||
if (is_null($notification["visible"]))
|
if (is_null($notification["visible"]))
|
||||||
$notification["visible"] = true;
|
$notification["visible"] = true;
|
||||||
|
@ -359,22 +351,26 @@ function ping_get_notifications($uid) {
|
||||||
if (is_null($notification["deleted"]))
|
if (is_null($notification["deleted"]))
|
||||||
$notification["deleted"] = 0;
|
$notification["deleted"] = 0;
|
||||||
|
|
||||||
$notification["msg"] = strip_tags(bbcode($notification["msg"]));
|
$notification["message"] = strip_tags(bbcode($notification["msg"]));
|
||||||
$notification["name"] = strip_tags(bbcode($notification["name"]));
|
$notification["name"] = strip_tags(bbcode($notification["name"]));
|
||||||
|
|
||||||
// Replace the name with {0} but ensure to make that only once
|
// Replace the name with {0} but ensure to make that only once
|
||||||
// The {0} is used later and prints the name in bold.
|
// The {0} is used later and prints the name in bold.
|
||||||
|
|
||||||
$pos = strpos($notification["msg"],$notification['name']);
|
$pos = strpos($notification["message"],$notification['name']);
|
||||||
if ($pos !== false)
|
if ($pos !== false)
|
||||||
$notification["msg"] = substr_replace($notification["msg"],"{0}",$pos,strlen($notification["name"]));
|
$notification["message"] = substr_replace($notification["message"],"{0}",$pos,strlen($notification["name"]));
|
||||||
|
|
||||||
|
$notification['href'] = $a->get_baseurl() . '/notify/view/' . $notification['id'];
|
||||||
|
|
||||||
if ($notification["visible"] AND !$notification["spam"] AND
|
if ($notification["visible"] AND !$notification["spam"] AND
|
||||||
!$notification["deleted"] AND !is_array($result[$notification["parent"]]))
|
!$notification["deleted"] AND !is_array($result[$notification["parent"]])) {
|
||||||
$result[$notification["parent"]] = $notification;
|
$result[$notification["parent"]] = $notification;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
} while ((count($result) < 50) AND !$quit);
|
} while ((count($result) < 50) AND !$quit);
|
||||||
|
|
||||||
|
|
||||||
return($result);
|
return($result);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1207,9 +1207,7 @@ function settings_content(&$a) {
|
||||||
'$notify7' => array('notify7', t('You are tagged in a post'), ($notify & NOTIFY_TAGSELF), NOTIFY_TAGSELF, ''),
|
'$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, ''),
|
'$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' => array('desktop_notifications', t('Activate desktop notifications') , false, t('Show desktop popup on new 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'),
|
'$email_textonly' => array('email_textonly', t('Text-only notification emails'),
|
||||||
get_pconfig(local_user(),'system','email_textonly'),
|
get_pconfig(local_user(),'system','email_textonly'),
|
||||||
|
|
|
@ -169,3 +169,11 @@ h6 {
|
||||||
span.oembed, h4 {
|
span.oembed, h4 {
|
||||||
margin: 0px 0px 0px 0px;
|
margin: 0px 0px 0px 0px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* fields help text */
|
||||||
|
.field .field_help {
|
||||||
|
clear: left;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* notifications unseen */
|
||||||
|
.notify-unseen { background-color: #cceeFF; }
|
|
@ -65,5 +65,5 @@
|
||||||
</nav>
|
</nav>
|
||||||
|
|
||||||
<ul id="nav-notifications-template" style="display:none;" rel="template">
|
<ul id="nav-notifications-template" style="display:none;" rel="template">
|
||||||
<li class="{4}"><a href="{0}"><img data-src="{1}" height="24" width="24" alt="" />{2} <span class="notif-when">{3}</span></a></li>
|
<li class="{4}"><a href="{0}" title="{5}"><img data-src="{1}" height="24" width="24" alt="" />{2} <span class="notif-when">{3}</span></a></li>
|
||||||
</ul>
|
</ul>
|
||||||
|
|
|
@ -133,12 +133,61 @@
|
||||||
{{include file="field_intcheckbox.tpl" field=$notify8}}
|
{{include file="field_intcheckbox.tpl" field=$notify8}}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
{{include file="field_checkbox.tpl" field=$email_textonly}}
|
||||||
|
|
||||||
|
|
||||||
|
<!--
|
||||||
<div class="field">
|
<div class="field">
|
||||||
<button onclick="javascript:Notification.requestPermission(function(perm){if(perm === 'granted')alert('{{$desktop_notifications_success_message}}');});return false;">{{$desktop_notifications}}</button>
|
<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>
|
<span class="field_help">{{$desktop_notifications_note}}</span>
|
||||||
</div>
|
</div>
|
||||||
|
-->
|
||||||
|
{{include file="field_yesno.tpl" field=$desktop_notifications}}
|
||||||
|
<script>
|
||||||
|
(function(){
|
||||||
|
var elm = $("#id_{{$desktop_notifications.0}}_onoff");
|
||||||
|
var ckbox = $("#id_{{$desktop_notifications.0}}");
|
||||||
|
|
||||||
{{include file="field_checkbox.tpl" field=$email_textonly}}
|
if (getNotificationPermission() === 'granted') {
|
||||||
|
ckbox.val(1);
|
||||||
|
elm.find(".off").addClass("hidden");
|
||||||
|
elm.find(".on").removeClass("hidden");
|
||||||
|
}
|
||||||
|
if (getNotificationPermission() === null) {
|
||||||
|
elm.parent(".field.yesno").hide();
|
||||||
|
}
|
||||||
|
|
||||||
|
$("#id_{{$desktop_notifications.0}}_onoff").on("click", function(e){
|
||||||
|
|
||||||
|
if (Notification.permission === 'granted') {
|
||||||
|
localStorage.setItem('notification-permissions', ckbox.val()==1 ? 'granted' : 'denied');
|
||||||
|
} else if (Notification.permission === 'denied') {
|
||||||
|
localStorage.setItem('notification-permissions', 'denied');
|
||||||
|
|
||||||
|
ckbox.val(0);
|
||||||
|
elm.find(".on").addClass("hidden");
|
||||||
|
elm.find(".off").removeClass("hidden");
|
||||||
|
|
||||||
|
} else if (Notification.permission === 'default') {
|
||||||
|
Notification.requestPermission(function(choice) {
|
||||||
|
if (choice === 'granted') {
|
||||||
|
localStorage.setItem('notification-permissions', ckbox.val()==1 ? 'granted' : 'denied');
|
||||||
|
|
||||||
|
} else {
|
||||||
|
localStorage.setItem('notification-permissions', 'denied');
|
||||||
|
ckbox.val(0);
|
||||||
|
elm.find(".on").addClass("hidden");
|
||||||
|
elm.find(".off").removeClass("hidden");
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
//console.log(getNotificationPermission());
|
||||||
|
|
||||||
|
|
||||||
|
})
|
||||||
|
})();
|
||||||
|
</script>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
|
@ -67,5 +67,5 @@
|
||||||
</nav>
|
</nav>
|
||||||
|
|
||||||
<ul id="nav-notifications-template" style="display:none;" rel="template">
|
<ul id="nav-notifications-template" style="display:none;" rel="template">
|
||||||
<li class="{4}"><a href="{0}"><img data-src="{1}" height="24" width="24" alt="" />{2} <span class="notif-when">{3}</span></a></li>
|
<li class="{4}"><a href="{0}" title="{5}"><img data-src="{1}" height="24" width="24" alt="" />{2} <span class="notif-when">{3}</span></a></li>
|
||||||
</ul>
|
</ul>
|
||||||
|
|
|
@ -514,6 +514,7 @@ header {
|
||||||
margin: 0px;
|
margin: 0px;
|
||||||
padding: 0px;
|
padding: 0px;
|
||||||
/*width: 100%; height: 12px; */
|
/*width: 100%; height: 12px; */
|
||||||
|
|
||||||
z-index: 110;
|
z-index: 110;
|
||||||
color: #ffffff;
|
color: #ffffff;
|
||||||
}
|
}
|
||||||
|
@ -846,6 +847,7 @@ aside .posted-date-selector-months {
|
||||||
overflow: auto;
|
overflow: auto;
|
||||||
height: auto;
|
height: auto;
|
||||||
/*.contact-block-div { width:60px; height: 60px; }*/
|
/*.contact-block-div { width:60px; height: 60px; }*/
|
||||||
|
|
||||||
}
|
}
|
||||||
#contact-block .contact-block-h4 {
|
#contact-block .contact-block-h4 {
|
||||||
float: left;
|
float: left;
|
||||||
|
@ -927,6 +929,7 @@ aside .posted-date-selector-months {
|
||||||
margin-bottom: 2em;
|
margin-bottom: 2em;
|
||||||
/*.action .s10 { width: 10px; overflow: hidden; padding: 0px;}
|
/*.action .s10 { width: 10px; overflow: hidden; padding: 0px;}
|
||||||
.action .s16 { width: 16px; overflow: hidden; padding: 0px;}*/
|
.action .s16 { width: 16px; overflow: hidden; padding: 0px;}*/
|
||||||
|
|
||||||
}
|
}
|
||||||
.widget h3 {
|
.widget h3 {
|
||||||
padding: 0px;
|
padding: 0px;
|
||||||
|
@ -1208,6 +1211,7 @@ section {
|
||||||
height: 32px;
|
height: 32px;
|
||||||
margin-left: 16px;
|
margin-left: 16px;
|
||||||
/*background: url(../../../images/icons/22/user.png) no-repeat center center;*/
|
/*background: url(../../../images/icons/22/user.png) no-repeat center center;*/
|
||||||
|
|
||||||
}
|
}
|
||||||
.comment-edit-preview .contact-photo-menu-button {
|
.comment-edit-preview .contact-photo-menu-button {
|
||||||
top: 15px !important;
|
top: 15px !important;
|
||||||
|
@ -2077,6 +2081,7 @@ ul.tabs li .active {
|
||||||
min-height: 22px;
|
min-height: 22px;
|
||||||
padding-top: 6px;
|
padding-top: 6px;
|
||||||
/* a { display: block;}*/
|
/* a { display: block;}*/
|
||||||
|
|
||||||
}
|
}
|
||||||
#photo-caption {
|
#photo-caption {
|
||||||
display: block;
|
display: block;
|
||||||
|
|
|
@ -514,6 +514,7 @@ header {
|
||||||
margin: 0px;
|
margin: 0px;
|
||||||
padding: 0px;
|
padding: 0px;
|
||||||
/*width: 100%; height: 12px; */
|
/*width: 100%; height: 12px; */
|
||||||
|
|
||||||
z-index: 110;
|
z-index: 110;
|
||||||
color: #ffffff;
|
color: #ffffff;
|
||||||
}
|
}
|
||||||
|
@ -846,6 +847,7 @@ aside .posted-date-selector-months {
|
||||||
overflow: auto;
|
overflow: auto;
|
||||||
height: auto;
|
height: auto;
|
||||||
/*.contact-block-div { width:60px; height: 60px; }*/
|
/*.contact-block-div { width:60px; height: 60px; }*/
|
||||||
|
|
||||||
}
|
}
|
||||||
#contact-block .contact-block-h4 {
|
#contact-block .contact-block-h4 {
|
||||||
float: left;
|
float: left;
|
||||||
|
@ -927,6 +929,7 @@ aside .posted-date-selector-months {
|
||||||
margin-bottom: 2em;
|
margin-bottom: 2em;
|
||||||
/*.action .s10 { width: 10px; overflow: hidden; padding: 0px;}
|
/*.action .s10 { width: 10px; overflow: hidden; padding: 0px;}
|
||||||
.action .s16 { width: 16px; overflow: hidden; padding: 0px;}*/
|
.action .s16 { width: 16px; overflow: hidden; padding: 0px;}*/
|
||||||
|
|
||||||
}
|
}
|
||||||
.widget h3 {
|
.widget h3 {
|
||||||
padding: 0px;
|
padding: 0px;
|
||||||
|
@ -1208,6 +1211,7 @@ section {
|
||||||
height: 32px;
|
height: 32px;
|
||||||
margin-left: 16px;
|
margin-left: 16px;
|
||||||
/*background: url(../../../images/icons/22/user.png) no-repeat center center;*/
|
/*background: url(../../../images/icons/22/user.png) no-repeat center center;*/
|
||||||
|
|
||||||
}
|
}
|
||||||
.comment-edit-preview .contact-photo-menu-button {
|
.comment-edit-preview .contact-photo-menu-button {
|
||||||
top: 15px !important;
|
top: 15px !important;
|
||||||
|
@ -2077,6 +2081,7 @@ ul.tabs li .active {
|
||||||
min-height: 22px;
|
min-height: 22px;
|
||||||
padding-top: 6px;
|
padding-top: 6px;
|
||||||
/* a { display: block;}*/
|
/* a { display: block;}*/
|
||||||
|
|
||||||
}
|
}
|
||||||
#photo-caption {
|
#photo-caption {
|
||||||
display: block;
|
display: block;
|
||||||
|
|
|
@ -514,6 +514,7 @@ header {
|
||||||
margin: 0px;
|
margin: 0px;
|
||||||
padding: 0px;
|
padding: 0px;
|
||||||
/*width: 100%; height: 12px; */
|
/*width: 100%; height: 12px; */
|
||||||
|
|
||||||
z-index: 110;
|
z-index: 110;
|
||||||
color: #ffffff;
|
color: #ffffff;
|
||||||
}
|
}
|
||||||
|
@ -846,6 +847,7 @@ aside .posted-date-selector-months {
|
||||||
overflow: auto;
|
overflow: auto;
|
||||||
height: auto;
|
height: auto;
|
||||||
/*.contact-block-div { width:60px; height: 60px; }*/
|
/*.contact-block-div { width:60px; height: 60px; }*/
|
||||||
|
|
||||||
}
|
}
|
||||||
#contact-block .contact-block-h4 {
|
#contact-block .contact-block-h4 {
|
||||||
float: left;
|
float: left;
|
||||||
|
@ -927,6 +929,7 @@ aside .posted-date-selector-months {
|
||||||
margin-bottom: 2em;
|
margin-bottom: 2em;
|
||||||
/*.action .s10 { width: 10px; overflow: hidden; padding: 0px;}
|
/*.action .s10 { width: 10px; overflow: hidden; padding: 0px;}
|
||||||
.action .s16 { width: 16px; overflow: hidden; padding: 0px;}*/
|
.action .s16 { width: 16px; overflow: hidden; padding: 0px;}*/
|
||||||
|
|
||||||
}
|
}
|
||||||
.widget h3 {
|
.widget h3 {
|
||||||
padding: 0px;
|
padding: 0px;
|
||||||
|
@ -1208,6 +1211,7 @@ section {
|
||||||
height: 32px;
|
height: 32px;
|
||||||
margin-left: 16px;
|
margin-left: 16px;
|
||||||
/*background: url(../../../images/icons/22/user.png) no-repeat center center;*/
|
/*background: url(../../../images/icons/22/user.png) no-repeat center center;*/
|
||||||
|
|
||||||
}
|
}
|
||||||
.comment-edit-preview .contact-photo-menu-button {
|
.comment-edit-preview .contact-photo-menu-button {
|
||||||
top: 15px !important;
|
top: 15px !important;
|
||||||
|
@ -2077,6 +2081,7 @@ ul.tabs li .active {
|
||||||
min-height: 22px;
|
min-height: 22px;
|
||||||
padding-top: 6px;
|
padding-top: 6px;
|
||||||
/* a { display: block;}*/
|
/* a { display: block;}*/
|
||||||
|
|
||||||
}
|
}
|
||||||
#photo-caption {
|
#photo-caption {
|
||||||
display: block;
|
display: block;
|
||||||
|
|
|
@ -1197,7 +1197,6 @@ ul.tabs {
|
||||||
display: block;
|
display: block;
|
||||||
margin-left: 200px;
|
margin-left: 200px;
|
||||||
color: @FieldHelpColor;
|
color: @FieldHelpColor;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -109,7 +109,7 @@
|
||||||
|
|
||||||
</nav>
|
</nav>
|
||||||
<ul id="nav-notifications-template" style="display:none;" rel="template">
|
<ul id="nav-notifications-template" style="display:none;" rel="template">
|
||||||
<li><a href="{0}"><img data-src="{1}">{2} <span class="notif-when">{3}</span></a></li>
|
<li class="{4}"><a href="{0}" title="{5}"><img data-src="{1}">{2} <span class="notif-when">{3}</span></a></li>
|
||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
<div style="position: fixed; top: 3px; left: 5px; z-index:9999">{{$langselector}}</div>
|
<div style="position: fixed; top: 3px; left: 5px; z-index:9999">{{$langselector}}</div>
|
||||||
|
|
|
@ -97,44 +97,8 @@
|
||||||
|
|
||||||
</nav>
|
</nav>
|
||||||
<ul id="nav-notifications-template" style="display:none;" rel="template">
|
<ul id="nav-notifications-template" style="display:none;" rel="template">
|
||||||
<li><a href="{0}"><img data-src="{1}">{2} <span class="notif-when">{3}</span></a></li>
|
<li class="{4}"><a href="{0}" title="{5}"><img data-src="{1}">{2} <span class="notif-when">{3}</span></a></li>
|
||||||
</ul>
|
</ul>
|
||||||
<!--
|
<!--
|
||||||
<div class="icon-flag" style="position: fixed; bottom: 10px; left: 20px; z-index:9;">{{$langselector}}</div>
|
<div class="icon-flag" style="position: fixed; bottom: 10px; left: 20px; z-index:9;">{{$langselector}}</div>
|
||||||
-->
|
-->
|
||||||
{{*
|
|
||||||
|
|
||||||
{{if $nav.logout}}<a id="nav-logout-link" class="nav-link {{$nav.logout.2}}" href="{{$nav.logout.0}}" title="{{$nav.logout.3}}" >{{$nav.logout.1}}</a> {{/if}}
|
|
||||||
{{if $nav.login}}<a id="nav-login-link" class="nav-login-link {{$nav.login.2}}" href="{{$nav.login.0}}" title="{{$nav.login.3}}" >{{$nav.login.1}}</a> {{/if}}
|
|
||||||
|
|
||||||
<span id="nav-link-wrapper" >
|
|
||||||
|
|
||||||
{{if $nav.register}}<a id="nav-register-link" class="nav-commlink {{$nav.register.2}}" href="{{$nav.register.0}}" title="{{$nav.register.3}}" >{{$nav.register.1}}</a>{{/if}}
|
|
||||||
|
|
||||||
<a id="nav-help-link" class="nav-link {{$nav.help.2}}" target="friendica-help" href="{{$nav.help.0}}" title="{{$nav.help.3}}" >{{$nav.help.1}}</a>
|
|
||||||
|
|
||||||
{{if $nav.apps}}<a id="nav-apps-link" class="nav-link {{$nav.apps.2}}" href="{{$nav.apps.0}}" title="{{$nav.apps.3}}" >{{$nav.apps.1}}</a>{{/if}}
|
|
||||||
|
|
||||||
<a id="nav-search-link" class="nav-link {{$nav.search.2}}" href="{{$nav.search.0}}" title="{{$nav.search.3}}" >{{$nav.search.1}}</a>
|
|
||||||
<a id="nav-directory-link" class="nav-link {{$nav.directory.2}}" href="{{$nav.directory.0}}" title="{{$nav.directory.3}}" >{{$nav.directory.1}}</a>
|
|
||||||
|
|
||||||
{{if $nav.admin}}<a id="nav-admin-link" class="nav-link {{$nav.admin.2}}" href="{{$nav.admin.0}}" title="{{$nav.admin.3}}" >{{$nav.admin.1}}</a>{{/if}}
|
|
||||||
|
|
||||||
{{if $nav.notifications}}
|
|
||||||
<a id="nav-notify-link" class="nav-commlink {{$nav.notifications.2}}" href="{{$nav.notifications.0}}" title="{{$nav.notifications.3}}" >{{$nav.notifications.1}}</a>
|
|
||||||
<span id="notify-update" class="nav-ajax-left"></span>
|
|
||||||
{{/if}}
|
|
||||||
{{if $nav.messages}}
|
|
||||||
<a id="nav-messages-link" class="nav-commlink {{$nav.messages.2}}" href="{{$nav.messages.0}}" title="{{$nav.messages.3}}" >{{$nav.messages.1}}</a>
|
|
||||||
<span id="mail-update" class="nav-ajax-left"></span>
|
|
||||||
{{/if}}
|
|
||||||
|
|
||||||
{{if $nav.manage}}<a id="nav-manage-link" class="nav-commlink {{$nav.manage.2}}" href="{{$nav.manage.0}}" title="{{$nav.manage.3}}">{{$nav.manage.1}}</a>{{/if}}
|
|
||||||
{{if $nav.settings}}<a id="nav-settings-link" class="nav-link {{$nav.settings.2}}" href="{{$nav.settings.0}}" title="{{$nav.settings.3}}">{{$nav.settings.1}}</a>{{/if}}
|
|
||||||
{{if $nav.profiles}}<a id="nav-profiles-link" class="nav-link {{$nav.profiles.2}}" href="{{$nav.profiles.0}}" title="{{$nav.profiles.3}}" >{{$nav.profiles.1}}</a>{{/if}}
|
|
||||||
|
|
||||||
|
|
||||||
</span>
|
|
||||||
<span id="nav-end"></span>
|
|
||||||
<span id="banner">{{$banner}}</span>
|
|
||||||
*}}
|
|
||||||
|
|
Loading…
Reference in a new issue