From c9067da374d1f664f3634525df735f2f2c139e3b Mon Sep 17 00:00:00 2001 From: Alexander Machehin Date: Wed, 29 Feb 2012 12:40:21 +0600 Subject: [PATCH] [refs #233] fix users menu toggle --- app/assets/javascripts/all.js | 68 +++++++++++++++-------------------- 1 file changed, 29 insertions(+), 39 deletions(-) diff --git a/app/assets/javascripts/all.js b/app/assets/javascripts/all.js index f8b00c3e4..e62cb613e 100644 --- a/app/assets/javascripts/all.js +++ b/app/assets/javascripts/all.js @@ -1,44 +1,34 @@ +$(document).ready(function() { + var dropbox = $("#droplist"); -var droplist = function() { - $user_menu.slideToggle("slow"); -} + function loadMessages() { + $("#messages-new").fadeOut("slow"); + $("#new-messages").delay(700).fadeIn("slow"); + } -function loadMessages() { - $("#messages-new").fadeOut("slow"); - $("#new-messages").delay(700).fadeIn("slow"); -} -function loadOldMessages() { - $("#old-messages").fadeIn("slow"); -} + function loadOldMessages() { + $("#old-messages").fadeIn("slow"); + } -$(document).ready(function(){ - $user_menu = $('#droplist'); - $user_menu.die('click'); - - $('div.information > div.user').live('click', function() { - if ($user_menu.is(":hidden")) { - droplist(); - } - }); - - $('div.information > div.profile > a').live('click', function(e) { - e.preventDefault(); - }); - -}); - -$(document).click(function(e) { - if (!$user_menu.is(":hidden") && ($(e.target).parent().attr('id') != $user_menu.attr('id'))) { - droplist(); + $(document).click(function() { + var dl = dropbox.css("height"); + var dl2 = dropbox.css("display"); + if ((dl2 == "block")&&(dl == "91px")) { + dropbox.slideUp("slow"); } -}); + }); -function showActivity(elem) { - $("#activity-bottom"+elem).slideToggle("slow"); - var img = $("#expand" + elem).attr("src"); - if (img == "assets/expand-gray.png") { - $("#expand" + elem).attr("src","assets/expand-gray2.png"); - } else { - $("#expand" + elem).attr("src","assets/expand-gray.png"); - } -} + function showActivity(elem) { + $("#activity-bottom"+elem).slideToggle("slow"); + var img = document.getElementById("expand" + elem).className; + if (img == "expand-gray-down") { + document.getElementById("expand" + elem).className = "expand-gray-up"; + } else { + document.getElementById("expand" + elem).className = "expand-gray-down"; + } + } + + $('div.information > div.user').live('click', function() { + dropbox.slideToggle("slow"); + }); +});