View modifications, refactored stream javascript to another file
This commit is contained in:
parent
c3b75703ac
commit
17636f4fd2
5 changed files with 67 additions and 55 deletions
|
|
@ -17,7 +17,7 @@
|
||||||
|
|
||||||
= javascript_include_tag 'fancybox/jquery.fancybox-1.3.1.pack'
|
= 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'
|
= render 'js/websocket_js'
|
||||||
|
|
||||||
= csrf_meta_tag
|
= csrf_meta_tag
|
||||||
|
|
|
||||||
48
public/javascripts/stream.js
Normal file
48
public/javascripts/stream.js
Normal 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
|
||||||
|
|
@ -1,12 +1,5 @@
|
||||||
$(document).ready(function(){
|
$(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_info').click(function() {
|
||||||
$('#debug_more').toggle('fast', function() {
|
$('#debug_more').toggle('fast', function() {
|
||||||
|
|
@ -18,26 +11,6 @@ $(document).ready(function(){
|
||||||
|
|
||||||
$('#flash_notice, #flash_error, #flash_alert').delay(2500).slideUp(130);
|
$('#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()
|
//Called with $(selector).clearForm()
|
||||||
$.fn.clearForm = function() {
|
$.fn.clearForm = function() {
|
||||||
return this.each(function() {
|
return this.each(function() {
|
||||||
|
|
@ -61,27 +34,6 @@ $(document).ready(function(){
|
||||||
speed: 3000
|
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//////
|
//buttons//////
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -109,9 +61,7 @@ $(document).ready(function(){
|
||||||
$(this).fadeIn("slow");
|
$(this).fadeIn("slow");
|
||||||
});
|
});
|
||||||
|
|
||||||
$(".delete").hover(function(){
|
|
||||||
$(this).toggleClass("button");
|
|
||||||
});
|
|
||||||
|
|
||||||
});//end document ready
|
});//end document ready
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -138,6 +138,8 @@ li.message {
|
||||||
li.message .avatar {
|
li.message .avatar {
|
||||||
float: left;
|
float: left;
|
||||||
margin-right: 15px; }
|
margin-right: 15px; }
|
||||||
|
li.message .delete:hover {
|
||||||
|
background: #eeeeee; }
|
||||||
li.message .content span.from {
|
li.message .content span.from {
|
||||||
color: black;
|
color: black;
|
||||||
font-weight: normal;
|
font-weight: normal;
|
||||||
|
|
@ -465,6 +467,8 @@ h1.big_text {
|
||||||
padding-right: 0.3em; }
|
padding-right: 0.3em; }
|
||||||
#group_nav ul > li:hover {
|
#group_nav ul > li:hover {
|
||||||
background-color: #333333; }
|
background-color: #333333; }
|
||||||
|
#group_nav ul > li:hover a {
|
||||||
|
color: #999999; }
|
||||||
#group_nav ul > li a {
|
#group_nav ul > li a {
|
||||||
color: #999999; }
|
color: #999999; }
|
||||||
#group_nav ul > li a:hover {
|
#group_nav ul > li a:hover {
|
||||||
|
|
@ -472,12 +476,14 @@ h1.big_text {
|
||||||
#group_nav ul .⚙ {
|
#group_nav ul .⚙ {
|
||||||
margin-left: 4px; }
|
margin-left: 4px; }
|
||||||
#group_nav ul .⚙ a {
|
#group_nav ul .⚙ a {
|
||||||
color: #333333; }
|
color: black; }
|
||||||
#group_nav ul .selected {
|
#group_nav ul .selected {
|
||||||
background-color: white;
|
background-color: white;
|
||||||
color: black; }
|
color: black; }
|
||||||
#group_nav ul .selected:hover {
|
#group_nav ul .selected:hover {
|
||||||
background-color: #eeeeee; }
|
background-color: #eeeeee; }
|
||||||
|
#group_nav ul .selected .⚙ a {
|
||||||
|
color: #333333; }
|
||||||
|
|
||||||
#add_photo_loader {
|
#add_photo_loader {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
|
|
|
||||||
|
|
@ -160,6 +160,8 @@ li.message
|
||||||
:margin
|
:margin
|
||||||
:right 15px
|
:right 15px
|
||||||
|
|
||||||
|
.delete:hover
|
||||||
|
:background #eee
|
||||||
|
|
||||||
.content
|
.content
|
||||||
span.from
|
span.from
|
||||||
|
|
@ -591,6 +593,9 @@ h1.big_text
|
||||||
&:hover
|
&:hover
|
||||||
:background
|
:background
|
||||||
:color #333
|
:color #333
|
||||||
|
a
|
||||||
|
:color #999
|
||||||
|
|
||||||
|
|
||||||
a
|
a
|
||||||
:color #999
|
:color #999
|
||||||
|
|
@ -601,7 +606,7 @@ h1.big_text
|
||||||
:margin
|
:margin
|
||||||
:left 4px
|
:left 4px
|
||||||
a
|
a
|
||||||
:color #333
|
:color #000
|
||||||
|
|
||||||
.selected
|
.selected
|
||||||
:background
|
:background
|
||||||
|
|
@ -610,6 +615,9 @@ h1.big_text
|
||||||
&:hover
|
&:hover
|
||||||
:background
|
:background
|
||||||
:color #eee
|
:color #eee
|
||||||
|
.⚙
|
||||||
|
a
|
||||||
|
:color #333
|
||||||
|
|
||||||
|
|
||||||
#add_photo_loader
|
#add_photo_loader
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue