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

This commit is contained in:
ilya 2010-07-06 14:49:08 -04:00
commit 3974b01b29

View file

@ -12,35 +12,50 @@
var obj = jQuery.parseJSON(evt.data); var obj = jQuery.parseJSON(evt.data);
debug("got a " + obj['class']); debug("got a " + obj['class']);
function onPageOne() {
var c = document.location.search.charAt(document.location.search.length-1);
return ((c =='') || (c== '1'));
}
if (obj['class']=="retractions"){ if (obj['class']=="retractions"){
var post_id = obj['post_id']; processRetraction(obj['post_id']);
$('#' + post_id ).fadeOut(500, function(){
$(this).remove;
});
}else if (obj['class']=="comments"){ }else if (obj['class']=="comments"){
var post_id = obj['post_id'] processComment(obj['post_id'], obj['html'])
$('#'+ post_id + ' .comment_set li:last' ).before(
$(obj['html']).fadeIn("fast", function(){}) }else{
) processPost(obj['class'], obj['html'])
}else if(((location.href.indexOf(obj['class']) != -1 ) || (location.pathname == '/')) && onPageOne()) {
$("#stream").prepend(
$(obj['html']).fadeIn("fast", function(){
$("#stream label:first").inFieldLabels();
} }
)
);
};
}; };
ws.onclose = function() { debug("socket closed"); }; ws.onclose = function() { debug("socket closed"); };
ws.onopen = function() { ws.onopen = function() {
ws.send(location.pathname); ws.send(location.pathname);
debug("connected..."); debug("connected...");
};}); };
function processRetraction(post_id){
$('#' + post_id ).fadeOut(500, function(){
$(this).remove;
});
}
function processComment(post_id, html){
$('#'+ post_id + ' .comment_set li:last' ).before(
$(html).fadeIn("fast", function(){})
);
}
function processPost(className, html){
if(onPageForClass(className)){
$("#stream").prepend(
$(html).fadeIn("fast", function(){
$("#stream label:first").inFieldLabels();
})
);
}
}
function onPageForClass(className){
return ((location.href.indexOf(className) != -1 ) || (location.pathname == '/')) && onPageOne();
}
function onPageOne() {
var c = document.location.search.charAt(document.location.search.length-1);
return ((c =='') || (c== '1'));
}
});