From d591cb0dfb0fbd9572a3cbf600ef662ca5a99b05 Mon Sep 17 00:00:00 2001 From: Unknwon Date: Thu, 16 Mar 2017 22:05:53 -0400 Subject: dashboard/feeds: able to load more history (#2511) --- public/js/gogs.js | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) (limited to 'public/js') diff --git a/public/js/gogs.js b/public/js/gogs.js index 5c35cae0..9ea6f6f1 100644 --- a/public/js/gogs.js +++ b/public/js/gogs.js @@ -1339,6 +1339,30 @@ $(document).ready(function () { e.trigger.setAttribute('data-content', e.trigger.getAttribute('data-original')) }); + // AJAX load buttons + $('.ajax-load-button').click(function () { + var $this = $(this); + $this.addClass('disabled'); + + $.ajax({ + url: $this.data('url'), + headers: { + 'X-AJAX': "true" + } + }).success(function (data, status, request) { + $(data).insertBefore($this); + + // Update new URL or remove self if no more feeds + var url = request.getResponseHeader('X-AJAX-URL'); + if (url) { + $this.data('url', url); + $this.removeClass('disabled'); + } else { + $this.remove(); + } + }); + }); + // Helpers. $('.delete-button').click(function () { var $this = $(this); -- cgit v1.2.3