Created
December 18, 2013 02:19
-
-
Save jonsgreen/8016317 to your computer and use it in GitHub Desktop.
fetch the sharing div
This file contains hidden or 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
/* | |
fetch | |
fetch the sharing div | |
*/ | |
fetch: function(element) { | |
if (sharing.debug) { $.d('Fetch'); $.d(element); } | |
var sharingDiv = $(element).siblings('.sharing').show(); | |
var id = $(element).attr('data-id'); | |
var type = $(element).attr('data-type'); | |
if (sharing.send_data) { | |
// Make the request | |
$.ajax({ | |
url: '/sharing/'+type+'/'+id, | |
dataType: 'html', | |
type: 'GET' | |
}) | |
// When the request is finished | |
.always(function(data){ | |
sharingDiv.html(data); | |
twttr.widgets.load(); | |
FB.XFBML.parse(sharingDiv[0]); | |
sharingDiv.find('.close').click(function(){ | |
if (sharing.debug) { $.d('CLICK Close'); } | |
sharingDiv.hide(); | |
}); | |
}); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment