Another bit of JS cleanup

This commit is contained in:
Raphael Sofaer 2011-04-08 16:10:17 -07:00
parent 0b9575af5d
commit fa59be2353
3 changed files with 25 additions and 22 deletions

View file

@ -18,9 +18,9 @@ var AspectEdit = {
drop: AspectEdit.onDropMove
});
$("#manage_aspect_zones").find(".delete").live("click", AspectEdit.deletePerson);
$(".aspect h3").live('focus', AspectEdit.changeName);
$("#manage_aspect_zones").find(".delete").click(AspectEdit.deletePerson);
$(".aspect h3").focus(AspectEdit.changeName);
},
startDrag: function() {
@ -127,7 +127,7 @@ var AspectEdit = {
e.preventDefault();
$this.blur();
}
//length limit
if ($this.text().length >= 20) {
e.preventDefault();

View file

@ -5,7 +5,7 @@
$(document).ready(function(){
$('a.conversation').live('click', function(){
$('a.conversation').click(function(){
$.getScript(this.href);
history.pushState(null, "", this.href);
@ -59,13 +59,13 @@ $(document).ready(function(){
// kill scroll binding
$(window).unbind('.infscr');
// hook up the manual click guy.
$('a.next_page').click(function(){
$(document).trigger('retrieve.infscr');
return false;
});
// remove the paginator when we're done.
$(document).ajaxError(function(e,xhr,opt){
if (xhr.status == 404) $('a.next_page').remove();

View file

@ -51,21 +51,6 @@ var Stream = {
$(this).siblings('.dislikes_list').fadeToggle('fast');
});
$(".like_it, .dislike_it").live('ajax:loading', function(data, json, xhr) {
$(this).parent().fadeOut('fast');
});
$(".like_it, .dislike_it").live('ajax:success', function(data, json, xhr) {
$(this).parent().detach();
json = $.parseJSON(json);
WebSocketReceiver.processLike(json.post_id, json.html);
});
$('.like_it, .dislike_it').live('ajax:failure', function(data, html, xhr) {
Diaspora.widgets.alert.alert('Failed to like/dislike!');
$(this).parent().fadeIn('fast');
});
// reshare button action
$stream.delegate(".reshare_button", "click", function(evt) {
evt.preventDefault();
@ -123,6 +108,24 @@ var Stream = {
});
},
setUpLikes: function(){
var likes = $("#main_stream .like_it, #main_stream .dislike_it");
likes.live('ajax:loading', function(data, json, xhr) {
$(this).parent().fadeOut('fast');
});
likes.live('ajax:success', function(data, json, xhr) {
$(this).parent().detach();
json = $.parseJSON(json);
WebSocketReceiver.processLike(json.post_id, json.html);
});
likes.live('ajax:failure', function(data, html, xhr) {
Diaspora.widgets.alert.alert('Failed to like/dislike!');
$(this).parent().fadeIn('fast');
});
},
setUpAudioLinks: function(){
$(".stream a[target='_blank']").each(function(){