From f04ce3b093c03fc343fce5b93e6ec6c7fd1ab214 Mon Sep 17 00:00:00 2001 From: friendica Date: Mon, 7 Jan 2013 13:40:58 -0800 Subject: more work on notification system, fix a couple of minor issues from smarty conversion --- js/main.js | 23 +++++++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-) (limited to 'js') diff --git a/js/main.js b/js/main.js index 356efcf79..18cf79ce8 100644 --- a/js/main.js +++ b/js/main.js @@ -163,14 +163,29 @@ last_popup_button = null; } } + + /* Turn elements with one of our special rel tags into popup menus */ $('a[rel^=#]').click(function(e){ + manage_popup_menu(this,e); + return false; + }); + + $('span[rel^=#]').click(function(e){ + manage_popup_menu(this,e); + return false; + }); + + + function manage_popup_menu(w,e) { close_last_popup_menu(); - menu = $( $(this).attr('rel') ); + menu = $( $(w).attr('rel') ); e.preventDefault(); e.stopPropagation(); if (menu.attr('popup')=="false") return false; - $(this).parent().toggleClass("selected"); + $(w).parent().toggleClass("selected"); + /* notification menus are loaded dynamically + * - here we find a rel tag to figure out what type of notification to load */ var loader_source = $(menu).attr('rel'); if(loader_source.length) { notify_popup_loader(loader_source); @@ -181,10 +196,10 @@ last_popup_button = null; } else { last_popup_menu = menu; - last_popup_button = $(this).parent(); + last_popup_button = $(w).parent(); } return false; - }); + } $('html').click(function() { close_last_popup_menu(); -- cgit v1.2.3