Created
August 29, 2009 23:33
-
-
Save darkhelmet/177747 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$.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