Skip to content

Instantly share code, notes, and snippets.

@darkhelmet
Created August 29, 2009 23:33
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save darkhelmet/177747 to your computer and use it in GitHub Desktop.
Save darkhelmet/177747 to your computer and use it in GitHub Desktop.
$.fn.setupRemoteInline = function() {
return this.each(function() {
$(this).click(function() {
var link = $(this);
link.unbind('click');
link.html('Loading...');
$.ajax({
url:this.href,
type:'GET',
success:function(data) {
var e = $(data).find('#posts-container').children();
var existing = link.closest('.content').prev();
var sidebar = $(e[0]);
sidebar.hide();
sidebar.addClass('new-elem');
$(existing).before(sidebar);
var con = $(e[1]);
con.addClass('new-elem');
// clean out disqus
con.find('.inline-comment-container').remove();
// need to do this to make chrome happy...weird
con.find('script').empty().remove();
// clean out sociable
con.find('.sociable').remove();
con.hide();
$(existing).before(con);
$('.new-elem').slideDown('slow');
link.parent().remove();
$('a.remote-inline').setupRemoteInline();
}});
return false;
});
});
};
$(document).ready(function() {
$('a.remote-inline').setupRemoteInline();
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment