]> git.mxchange.org Git - quix0rs-gnu-social.git/blob - plugins/OStatus/js/ostatus.js
OStatus: sub/unsub notifications working again. Fixed up autodetection of feed info...
[quix0rs-gnu-social.git] / plugins / OStatus / js / ostatus.js
1 SN.U.DialogBox = {
2     Subscribe: function(a) {
3         var f = a.parent().find('#form_ostatus_connect');
4         if (f.length > 0) {
5             f.show();
6         }
7         else {
8             $.ajax({
9                 type: 'GET',
10                 dataType: 'xml',
11                 url: a[0].href+'&ajax=1',
12                 beforeSend: function(formData) {
13                     a.addClass('processing');
14                 },
15                 error: function (xhr, textStatus, errorThrown) {
16                     alert(errorThrown || textStatus);
17                 },
18                 success: function(data, textStatus, xhr) {
19                     if (typeof($('form', data)[0]) != 'undefined') {
20                         a.after(document._importNode($('form', data)[0], true));
21
22                         var form = a.parent().find('#form_ostatus_connect');
23
24                         form
25                             .addClass('dialogbox')
26                             .append('<button class="close">&#215;</button>');
27
28                         form
29                             .find('.submit')
30                                 .addClass('submit_dialogbox')
31                                 .removeClass('submit')
32                                 .bind('click', function() {
33                                     form.addClass('processing');
34                                 });
35
36                         form.find('button.close').click(function(){
37                             form.hide();
38
39                             return false;
40                         });
41
42                         form.find('#acct').focus();
43                     }
44
45                     a.removeClass('processing');
46                 }
47             });
48         }
49     }
50 };
51
52 SN.Init.Subscribe = function() {
53     $('.entity_subscribe a').live('click', function() { SN.U.DialogBox.Subscribe($(this)); return false; });
54 };
55
56 $(document).ready(function() {
57     if ($('.entity_subscribe .entity_remote_subscribe').length > 0) {
58         SN.Init.Subscribe();
59     }
60 });