Merge branch 'master' of github.com:diaspora/diaspora_rails

This commit is contained in:
ilya 2010-07-01 14:41:13 -04:00
commit 48dbea7198
2 changed files with 27 additions and 17 deletions

View file

@ -76,6 +76,8 @@ jQuery(function ($) {
$('form[data-remote]').live('submit', function (e) {
$(this).callRemote();
e.preventDefault();
$(this).clearForm();
$(this).focusout();
});
$('a[data-remote],input[data-remote]').live('click', function (e) {

View file

@ -14,6 +14,15 @@ $(document).ready(function(){
//theme_advanced_resizing : true //leave this out as there is an intermittent bug.
});
$('.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) + ")");
};
});
$('a').hover(function(){
$(this).fadeTo(60, 0.5);
}, function(){
@ -26,20 +35,6 @@ $(document).ready(function(){
$(this).fadeTo(80, 1);
});
$('#status_message_message').click(clearForm);
$('#bookmark_title').click(clearForm);
$('#bookmark_link').click(clearForm);
$('#debug_more').hide();
$(":text").click(clearForm);
function clearForm(){
var text = $(this).text()
$(this).val("");
}
$('#debug_info').click(function() {
$('#debug_more').toggle('fast', function() {
@ -59,7 +54,6 @@ $(document).ready(function(){
$(this).children(".destroy_link").fadeOut(0);
});
// in field label plugin
$(".show_post_comments").live('click', function(event) {
event.preventDefault();
@ -73,4 +67,18 @@ $(document).ready(function(){
$(this).toggleClass( "visible" );
});
//Called with $(selector).clearForm()
$.fn.clearForm = function() {
return this.each(function() {
var type = this.type, tag = this.tagName.toLowerCase();
if (tag == 'form')
return $(':input',this).clearForm();
if (type == 'text' || type == 'password' || tag == 'textarea')
this.value = '';
else if (type == 'checkbox' || type == 'radio')
this.checked = false;
else if (tag == 'select')
this.selectedIndex = -1;
});
};
});//end document ready