aboutsummaryrefslogtreecommitdiff
path: root/public/js/gogs.js
diff options
context:
space:
mode:
Diffstat (limited to 'public/js/gogs.js')
-rw-r--r--public/js/gogs.js24
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);