aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--include/bbcode.php2
-rw-r--r--js/main.js82
-rw-r--r--mod/ping.php2
-rw-r--r--view/theme/duepuntozero/nav.tpl20
-rw-r--r--view/theme/duepuntozero/theme.php2
-rw-r--r--view/theme/slackr/theme.php1
6 files changed, 59 insertions, 50 deletions
diff --git a/include/bbcode.php b/include/bbcode.php
index 63dd9695e..96f0f93c5 100644
--- a/include/bbcode.php
+++ b/include/bbcode.php
@@ -387,6 +387,8 @@ function bbcode($Text,$preserve_nl = false, $tryoembed = true) {
// fix any escaped ampersands that may have been converted into links
$Text = preg_replace("/\<(.*?)(src|href)=(.*?)\&amp\;(.*?)\>/ism",'<$1$2=$3&$4>',$Text);
+ $Text = preg_replace("/\<(.*?)(src|href)=\"[^hfm](.*?)\>/ism",'<$1$2="">',$Text);
+
if($saved_image)
$Text = bb_replace_images($Text, $saved_image);
diff --git a/js/main.js b/js/main.js
index 8b5d650bd..c9e57619b 100644
--- a/js/main.js
+++ b/js/main.js
@@ -109,43 +109,7 @@
});
- /* notifications template */
- var notifications_tpl= unescape($("#nav-notifications-template[rel=template]").html());
- var notifications_all = unescape($('<div>').append( $("#nav-notifications-see-all").clone() ).html()); //outerHtml hack
- var notifications_mark = unescape($('<div>').append( $("#nav-notifications-mark-all").clone() ).html()); //outerHtml hack
- var notifications_empty = unescape($("#nav-notifications-menu").html());
-
- /* nav update event */
- $('nav').bind('nav-update', function(e,data) {
-
- var eNotif = $(data).find('notif')
- if (eNotif.children("note").length==0){
- $("#nav-notifications-menu").html(notifications_empty);
- } else {
- nnm = $("#nav-notifications-menu");
- nnm.html(notifications_all + notifications_mark);
- //nnm.attr('popup','true');
- eNotif.children("note").each(function(){
- e = $(this);
- 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);
- });
- }
- notif = eNotif.attr('count');
- if (notif>0){
- $("#nav-notifications-linkmenu").addClass("on");
- } else {
- $("#nav-notifications-linkmenu").removeClass("on");
- }
- if(notif == 0) { notif = ''; $('#notify-update').removeClass('show') } else { $('#notify-update').addClass('show') }
- $('#notify-update').html(notif);
-
-
- });
-
-
NavUpdate();
// Allow folks to stop the ajax page updates with the pause/break key
$(document).keydown(function(event) {
@@ -341,6 +305,51 @@
$(node).removeClass("drop").addClass("drophide");
}
+ function notify_popup() {
+
+ if($("#nav-notifications-menu").is(":visible")) {
+ $("#nav-notifications-menu").hide();
+ return;
+ }
+
+ /* notifications template */
+ var notifications_tpl= unescape($("#nav-notifications-template[rel=template]").html());
+ var notifications_all = unescape($('<div>').append( $("#nav-notifications-see-all").clone() ).html()); //outerHtml hack
+ var notifications_mark = unescape($('<div>').append( $("#nav-notifications-mark-all").clone() ).html()); //outerHtml hack
+ var notifications_empty = unescape($("#nav-notifications-menu").html());
+
+ var notify_menu = $("#nav-notifications-menu");
+
+ var pingExCmd = 'ping/notify' + ((localUser != 0) ? '?f=&uid=' + localUser : '');
+ $.get(pingExCmd,function(data) {
+
+ if(data.invalid == 1) {
+ window.location.href=window.location.href
+ }
+
+
+ if(data.notify.length==0){
+ $("#nav-notifications-menu").html(notifications_empty);
+
+ } else {
+ $("#nav-notifications-menu").html(notifications_all + notifications_mark);
+
+
+ $(data.notify).each(function() {
+ text = "<span class='contactname'>"+this.name+"</span>" + ' ' + this.message;
+ html = notifications_tpl.format(this.notify_link,this.photo,text,this.when,this.class);
+ $("#nav-notifications-menu").append(html);
+ });
+
+ }
+ });
+
+ $("#nav-notifications-menu").show();
+
+
+ }
+
+
// Since our ajax calls are asynchronous, we will give a few
// seconds for the first ajax call (setting like/dislike), then
// run the updater to pick up any changes and display on the page.
@@ -351,6 +360,7 @@
// trickery. This still could cause confusion if the "like" ajax call
// is delayed and NavUpdate runs before it completes.
+
function dolike(ident,verb) {
unpause();
$('#like-rotator-' + ident.toString()).show();
diff --git a/mod/ping.php b/mod/ping.php
index 2d7163c54..da9de09b6 100644
--- a/mod/ping.php
+++ b/mod/ping.php
@@ -71,7 +71,7 @@ function ping_init(&$a) {
'url' => $zz['url'],
'photo' => $zz['photo'],
'when' => relative_date($zz['date']),
- 'classs' => (($zz['seen']) ? 'notify-seen' : 'notify-unseen'),
+ 'class' => (($zz['seen']) ? 'notify-seen' : 'notify-unseen'),
'message' => strip_tags(bbcode($zz['msg']))
);
}
diff --git a/view/theme/duepuntozero/nav.tpl b/view/theme/duepuntozero/nav.tpl
index 257822df4..20b4e923a 100644
--- a/view/theme/duepuntozero/nav.tpl
+++ b/view/theme/duepuntozero/nav.tpl
@@ -43,15 +43,15 @@
- {{ if $nav.notifications }}
- <a id="nav-notifications-linkmenu" class="nav-commlink" href="$nav.notifications.0" rel="#nav-notifications-menu" title="$nav.notifications.1">$nav.notifications.1</a>
- <span id="notify-update" class="nav-ajax-left"></span>
- <ul id="nav-notifications-menu" class="menu-popup">
- <li id="nav-notifications-see-all"><a href="$nav.notifications.all.0">$nav.notifications.all.1</a></li>
- <li id="nav-notifications-mark-all"><a href="#" onclick="notifyMarkAll(); return false;">$nav.notifications.mark.1</a></li>
- <li class="empty">$emptynotifications</li>
- </ul>
- {{ endif }}
+ {{ if $nav.notifications }}
+ <a id="nav-notifications-linkmenu" class="nav-commlink" onclick="notify_popup(); return false;" title="$nav.notifications.1">$nav.notifications.1</a>
+ <span id="notify-update" class="nav-ajax-left"></span>
+ <ul id="nav-notifications-menu" class="menu-popup">
+ <li id="nav-notifications-see-all"><a href="$nav.notifications.all.0">$nav.notifications.all.1</a></li>
+ <li id="nav-notifications-mark-all"><a href="#" onclick="notifyMarkAll(); return false;">$nav.notifications.mark.1</a></li>
+ <li class="empty">$emptynotifications</li>
+ </ul>
+ {{ endif }}
{{ 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>{{ endif }}
{{ 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>{{ endif }}
@@ -65,6 +65,6 @@
<span id="banner">$banner</span>
</nav>
-<ul id="nav-notifications-template" style="display:none;" rel="template">
+<ul id="nav-notifications-template" rel="template" style="display:none;">
<li class="{4}"><a href="{0}"><img src="{1}" height="24" width="24" alt="" />{2} <span class="notif-when">{3}</span></a></li>
</ul>
diff --git a/view/theme/duepuntozero/theme.php b/view/theme/duepuntozero/theme.php
index 2498852f9..e42c2b7b4 100644
--- a/view/theme/duepuntozero/theme.php
+++ b/view/theme/duepuntozero/theme.php
@@ -42,8 +42,6 @@ function cmtBbClose(comment, id) {
}
$(document).ready(function() {
-$('html').click(function() { $("#nav-notifications-menu" ).hide(); });
-
$('.group-edit-icon').hover(
function() {
$(this).addClass('icon'); $(this).removeClass('iconspacer');},
diff --git a/view/theme/slackr/theme.php b/view/theme/slackr/theme.php
index 988700860..7e03886df 100644
--- a/view/theme/slackr/theme.php
+++ b/view/theme/slackr/theme.php
@@ -54,7 +54,6 @@ $(document).ready(function() {
$("#profile-jot-text").focus(hidecal);
$("#profile-jot-text").click(hidecal);
-$('html').click(function() { $("#nav-notifications-menu" ).hide(); });
$('.group-edit-icon').hover(
function() {