+ $('.show-diff').click(function() {
+ var button = $(this);
+
+ if (button.attr('disabled') != 'disabled') {
+ button.attr('disabled', 'disabled');
+ var id = parseInt(button.attr('title'));
+ var docid = $('h2', button.parents('.pull-request')).html();
+ var revision = $('.pull-request-revision', button.parents('.pull-request')).html();
+
+ $('.diff').slideUp(function() { $(this).remove() });
+ $('<div class="diff"></div>')
+ .hide()
+ .appendTo($(this).parents('.pull-request'))
+ .slideDown('slow')
+ .load('/api/documents/' + docid + '/diff?revision=' + revision, null, function() {
+ button.attr('disabled', null);
+ });
+ }
+ });
+