View modifications, refactored stream javascript to another file

This commit is contained in:
Raphael 2010-08-25 13:51:16 -07:00
parent c3b75703ac
commit 17636f4fd2
5 changed files with 67 additions and 55 deletions

View file

@ -17,7 +17,7 @@
= javascript_include_tag 'fancybox/jquery.fancybox-1.3.1.pack'
= javascript_include_tag 'view', 'image_picker', 'group_nav'
= javascript_include_tag 'view', 'image_picker', 'group_nav', 'stream'
= render 'js/websocket_js'
= csrf_meta_tag

View file

@ -0,0 +1,48 @@
$(document).ready(function(){
$('.comment_set').each(function(index) {
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) + ")");
};
});
$("#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

View file

@ -1,12 +1,5 @@
$(document).ready(function(){
$('.comment_set').each(function(index) {
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) + ")");
};
});
$('#debug_info').click(function() {
$('#debug_more').toggle('fast', function() {
@ -18,26 +11,6 @@ $(document).ready(function(){
$('#flash_notice, #flash_error, #flash_alert').delay(2500).slideUp(130);
$("#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" );
});
//Called with $(selector).clearForm()
$.fn.clearForm = function() {
return this.each(function() {
@ -61,27 +34,6 @@ $(document).ready(function(){
speed: 3000
});
//comments/////
$(".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);
});
//buttons//////
@ -109,9 +61,7 @@ $(document).ready(function(){
$(this).fadeIn("slow");
});
$(".delete").hover(function(){
$(this).toggleClass("button");
});
});//end document ready

View file

@ -138,6 +138,8 @@ li.message {
li.message .avatar {
float: left;
margin-right: 15px; }
li.message .delete:hover {
background: #eeeeee; }
li.message .content span.from {
color: black;
font-weight: normal;
@ -465,6 +467,8 @@ h1.big_text {
padding-right: 0.3em; }
#group_nav ul > li:hover {
background-color: #333333; }
#group_nav ul > li:hover a {
color: #999999; }
#group_nav ul > li a {
color: #999999; }
#group_nav ul > li a:hover {
@ -472,12 +476,14 @@ h1.big_text {
#group_nav ul . {
margin-left: 4px; }
#group_nav ul . a {
color: #333333; }
color: black; }
#group_nav ul .selected {
background-color: white;
color: black; }
#group_nav ul .selected:hover {
background-color: #eeeeee; }
#group_nav ul .selected . a {
color: #333333; }
#add_photo_loader {
position: absolute;

View file

@ -160,7 +160,9 @@ li.message
:margin
:right 15px
.delete:hover
:background #eee
.content
span.from
:color #000
@ -591,6 +593,9 @@ h1.big_text
&:hover
:background
:color #333
a
:color #999
a
:color #999
@ -601,7 +606,7 @@ h1.big_text
:margin
:left 4px
a
:color #333
:color #000
.selected
:background
@ -610,6 +615,9 @@ h1.big_text
&:hover
:background
:color #eee
.
a
:color #333
#add_photo_loader