From 6b6d0bf9f1881d18959a2ee5241a94559ef2765a Mon Sep 17 00:00:00 2001 From: ben Date: Fri, 27 Jun 2008 10:33:28 +0000 Subject: Initial inclusion of profile icon navigation git-svn-id: https://code.elgg.org/elgg/trunk@1163 36083f99-b078-4883-b0ff-0f9b5a30f544 --- mod/profile/javascript.php | 18 +++++ mod/profile/profile.js | 77 ------------------- mod/profile/views/default/profile/icon.php | 20 ++++- mod/profile/views/default/profile/javascript.php | 95 ++++++++++++++++++++++++ mod/profile/views/default/profile/metatags.php | 8 +- views/default/navigation/topmenu.php | 2 - 6 files changed, 133 insertions(+), 87 deletions(-) create mode 100644 mod/profile/javascript.php delete mode 100644 mod/profile/profile.js create mode 100644 mod/profile/views/default/profile/javascript.php diff --git a/mod/profile/javascript.php b/mod/profile/javascript.php new file mode 100644 index 000000000..f5af590bf --- /dev/null +++ b/mod/profile/javascript.php @@ -0,0 +1,18 @@ + + * @copyright Curverider Ltd 2008 + * @link http://elgg.com/ + */ + + // Get engine + require_once(dirname(dirname(dirname(__FILE__))) . "/engine/start.php"); + + echo elgg_view('profile/javascript'); + +?> \ No newline at end of file diff --git a/mod/profile/profile.js b/mod/profile/profile.js deleted file mode 100644 index 6043fea98..000000000 --- a/mod/profile/profile.js +++ /dev/null @@ -1,77 +0,0 @@ -$(document).ready(function() { - - // avatar image menu link - $("div.usericon img").mouseover(function() { - // find nested avatar_menu_button and show - $(this.parentNode.parentNode).children("[class=avatar_menu_button]").show(); - }) - .mouseout(function() { - if($(this).parent().parent().find("div.sub_menu").css('display')!="block"){ - $(this.parentNode.parentNode).children("[class=avatar_menu_button]").hide(); - } - else { - $(this.parentNode.parentNode).children("[class=avatar_menu_button]").show(); - } - }); - - - // avatar contextual menu - $(".avatar_menu_button img.arrow").click(function(e) { - - var submenu = $(this).parent().parent().find("div.sub_menu"); - - // close submenu if arrow is clicked & menu already open - if(submenu.css('display') == "block") { - submenu.hide(); - $(this).attr('src','_graphics/avatar_menu_arrow_hover.gif'); - } - else { - // get avatar dimensions - var avatar = $(this).parent().parent().parent().find("div.usericon"); - //alert( "avatarWidth: " + avatar.width() + ", avatarHeight: " + avatar.height() ); - - // move submenu position so it aligns with arrow graphic - if (e.pageX < 840) { // popup menu to left of arrow if we're at edge of page - submenu.css("top",(avatar.height()) + "px") - .css("left",(avatar.width()-15) + "px") - .fadeIn('normal'); - } - else { - submenu.css("top",(avatar.height()) + "px") - .css("left",(avatar.width()-166) + "px") - .fadeIn('normal'); - } - // change arrow to 'on' state - $(this).attr('src','_graphics/avatar_menu_arrow_open.gif'); - } - - // hide any other open submenus and reset arrows - $("div.sub_menu:visible").not(submenu).hide(); - $(".usericon img.arrow").not(this).attr('src','_graphics/avatar_menu_arrow.gif'); - $(".avatar_menu_button").not(this).hide(); - }) - // hover arrow each time mouseover enters arrow graphic (eg. when menu is already shown) - .mouseover(function() { $(this).attr('src','_graphics/avatar_menu_arrow_hover.gif'); }) - // if menu not shown revert arrow, else show 'menu open' arrow - .mouseout(function() { - if($(this).parent().parent().find("div.sub_menu").css('display')!="block"){ - $(this).attr('src','_graphics/avatar_menu_arrow.gif'); - } - else { - $(this).attr('src','_graphics/avatar_menu_arrow_open.gif'); - } - }); - - // hide avatar menu if click occurs outside of menu - // and hide arrow button - $(document).click(function(event) { - var target = $(event.target); - if (target.parents(".usericon").length == 0) { - $(".usericon div.sub_menu").fadeOut(); - $(".usericon img.arrow").attr('src','_graphics/avatar_menu_arrow.gif'); - $(".avatar_menu_button").hide(); - } - }); - - -}); diff --git a/mod/profile/views/default/profile/icon.php b/mod/profile/views/default/profile/icon.php index b98445981..c477a4cb0 100644 --- a/mod/profile/views/default/profile/icon.php +++ b/mod/profile/views/default/profile/icon.php @@ -46,4 +46,22 @@ ?> - title="" /> \ No newline at end of file +
+
+ + + title="" /> +
\ No newline at end of file diff --git a/mod/profile/views/default/profile/javascript.php b/mod/profile/views/default/profile/javascript.php new file mode 100644 index 000000000..b7770de05 --- /dev/null +++ b/mod/profile/views/default/profile/javascript.php @@ -0,0 +1,95 @@ + + * @copyright Curverider Ltd 2008 + * @link http://elgg.com/ + * + * @uses $vars['entity'] The user entity + */ + + header("Content-type: text/javascript"); + +?> + +$(document).ready(function() { + + // avatar image menu link + $("div.usericon img").mouseover(function() { + // find nested avatar_menu_button and show + $(this.parentNode.parentNode).children("[class=avatar_menu_button]").show(); + }) + .mouseout(function() { + if($(this).parent().parent().find("div.sub_menu").css('display')!="block"){ + $(this.parentNode.parentNode).children("[class=avatar_menu_button]").hide(); + } + else { + $(this.parentNode.parentNode).children("[class=avatar_menu_button]").show(); + } + }); + + + // avatar contextual menu + $(".avatar_menu_button img.arrow").click(function(e) { + + var submenu = $(this).parent().parent().find("div.sub_menu"); + + // close submenu if arrow is clicked & menu already open + if(submenu.css('display') == "block") { + submenu.hide(); + $(this).attr('src','_graphics/avatar_menu_arrow_hover.gif'); + } + else { + // get avatar dimensions + var avatar = $(this).parent().parent().parent().find("div.usericon"); + //alert( "avatarWidth: " + avatar.width() + ", avatarHeight: " + avatar.height() ); + + // move submenu position so it aligns with arrow graphic + if (e.pageX < 840) { // popup menu to left of arrow if we're at edge of page + submenu.css("top",(avatar.height()) + "px") + .css("left",(avatar.width()-15) + "px") + .fadeIn('normal'); + } + else { + submenu.css("top",(avatar.height()) + "px") + .css("left",(avatar.width()-166) + "px") + .fadeIn('normal'); + } + // change arrow to 'on' state + $(this).attr('src','_graphics/avatar_menu_arrow_open.gif'); + } + + // hide any other open submenus and reset arrows + $("div.sub_menu:visible").not(submenu).hide(); + $(".usericon img.arrow").not(this).attr('src','_graphics/avatar_menu_arrow.gif'); + $(".avatar_menu_button").not(this).hide(); + }) + // hover arrow each time mouseover enters arrow graphic (eg. when menu is already shown) + .mouseover(function() { $(this).attr('src','_graphics/avatar_menu_arrow_hover.gif'); }) + // if menu not shown revert arrow, else show 'menu open' arrow + .mouseout(function() { + if($(this).parent().parent().find("div.sub_menu").css('display')!="block"){ + $(this).attr('src','_graphics/avatar_menu_arrow.gif'); + } + else { + $(this).attr('src','_graphics/avatar_menu_arrow_open.gif'); + } + }); + + // hide avatar menu if click occurs outside of menu + // and hide arrow button + $(document).click(function(event) { + var target = $(event.target); + if (target.parents(".usericon").length == 0) { + $(".usericon div.sub_menu").fadeOut(); + $(".usericon img.arrow").attr('src','_graphics/avatar_menu_arrow.gif'); + $(".avatar_menu_button").hide(); + } + }); + + +}); diff --git a/mod/profile/views/default/profile/metatags.php b/mod/profile/views/default/profile/metatags.php index 1be959c5a..77b5544e4 100644 --- a/mod/profile/views/default/profile/metatags.php +++ b/mod/profile/views/default/profile/metatags.php @@ -13,10 +13,4 @@ ?> - \ No newline at end of file + diff --git a/views/default/navigation/topmenu.php b/views/default/navigation/topmenu.php index e0e10bfb9..40793c546 100644 --- a/views/default/navigation/topmenu.php +++ b/views/default/navigation/topmenu.php @@ -19,11 +19,9 @@ if (isloggedin()) { ?>
-
$vars['user'], 'size' => 'small')); ?> -