From f8d63052d4ae1b3199e2a97cf5a4f10c87eb1e48 Mon Sep 17 00:00:00 2001 From: Raphael Date: Wed, 25 Aug 2010 13:52:59 -0700 Subject: [PATCH] Remove stream lives from ready block --- public/javascripts/stream.js | 81 ++++++++++++++++++------------------ 1 file changed, 41 insertions(+), 40 deletions(-) diff --git a/public/javascripts/stream.js b/public/javascripts/stream.js index 7eeb2ed5a..2ead970a4 100644 --- a/public/javascripts/stream.js +++ b/public/javascripts/stream.js @@ -3,46 +3,47 @@ $(document).ready(function(){ var $this = $(this); if($this.children().length > 1) { $this.parent().show(); - var show_comments_toggle = $(this).parent().prev().children(".show_post_comments"); - show_comments_toggle.html("hide comments ("+ ($(this).children().length - 1) + ")"); + var show_comments_toggle = $this.parent().prev().children(".show_post_comments"); + show_comments_toggle.html("hide comments ("+ ($this.children().length - 1) + ")"); }; }); - - $("#stream li").live('mouseover',function() { - $(this).children(".destroy_link").fadeIn(0); - }); - - $("#stream li").live('mouseout',function() { - $(this).children(".destroy_link").fadeOut(0); - }); - - $(".show_post_comments").live('click', function(event) { - event.preventDefault(); - if( $(this).hasClass( "visible")) { - $(this).html($(this).html().replace("hide", "show")); - $(this).closest("li").children(".content").children(".comments").fadeOut(100); - } else { - $(this).html($(this).html().replace("show", "hide")); - $(this).closest("li").children(".content").children(".comments").fadeIn(100); - } - $(this).toggleClass( "visible" ); - }); - - $(".comment_box").live('focus', function(evt){ - var $this = $(this); - $this.attr("rows", 2); - $this.parents("p").parents("form").children("p").children(".comment_submit").fadeIn(200); - }); - - $(".comment_box").live('blur', function(evt){ - var $this = $(this); - if( $this.val() == '' ) { - $this.parents("p").parents("form").children("p").children(".comment_submit").fadeOut(0); - $this.attr("rows", 1); - } - }); - - $(".comment_submit").live('click', function(evt){ - $this.parents("p").parents("form").children("p").children(".comment_box").attr("rows", 1); - }); });//end document ready + +$("#stream li").live('mouseover',function() { + $(this).children(".destroy_link").fadeIn(0); +}); + +$("#stream li").live('mouseout',function() { + $(this).children(".destroy_link").fadeOut(0); +}); + +$(".show_post_comments").live('click', function(event) { + event.preventDefault(); + if( $(this).hasClass( "visible")) { + $(this).html($(this).html().replace("hide", "show")); + $(this).closest("li").children(".content").children(".comments").fadeOut(100); + } else { + $(this).html($(this).html().replace("show", "hide")); + $(this).closest("li").children(".content").children(".comments").fadeIn(100); + } + $(this).toggleClass( "visible" ); +}); + +$(".comment_box").live('focus', function(evt){ + var $this = $(this); + $this.attr("rows", 2); + $this.parents("p").parents("form").children("p").children(".comment_submit").fadeIn(200); +}); + +$(".comment_box").live('blur', function(evt){ + var $this = $(this); + if( $this.val() == '' ) { + $this.parents("p").parents("form").children("p").children(".comment_submit").fadeOut(0); + $this.attr("rows", 1); + } +}); + +$(".comment_submit").live('click', function(evt){ + $this.parents("p").parents("form").children("p").children(".comment_box").attr("rows", 1); +}); +