diff options
author | Unknwon <u@gogs.io> | 2017-03-16 22:05:53 -0400 |
---|---|---|
committer | Unknwon <u@gogs.io> | 2017-03-16 22:05:53 -0400 |
commit | d591cb0dfb0fbd9572a3cbf600ef662ca5a99b05 (patch) | |
tree | 1697afae2f6d6f7f793c68a5ac6b44586c7e601f /public/js | |
parent | 07a9cbe0a9ab8b25af079b8bd4d2c43f64cc0c03 (diff) |
dashboard/feeds: able to load more history (#2511)
Diffstat (limited to 'public/js')
-rw-r--r-- | public/js/gogs.js | 24 |
1 files changed, 24 insertions, 0 deletions
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); |