2 * StatusNet - a distributed open-source microblogging tool
3 * Copyright (C) 2010, StatusNet, Inc.
5 * This program is free software: you can redistribute it and/or modify
6 * it under the terms of the GNU Affero General Public License as published by
7 * the Free Software Foundation, either version 3 of the License, or
8 * (at your option) any later version.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU Affero General Public License for more details.
15 * You should have received a copy of the GNU Affero General Public License
16 * along with this program. If not, see <http://www.gnu.org/licenses/>.
18 * @category OStatus UI interaction
20 * @author Sarven Capadisli <csarven@status.net>
21 * @copyright 2010 StatusNet, Inc.
22 * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
23 * @link http://status.net/
24 * @note Everything in here should eventually migrate over to /js/util.js's SN.
28 Subscribe: function (a) {
29 var f = a.parent().find('.form_settings');
37 url: a[0].href + ((a[0].href.match(/[\\?]/) === null)?'?':'&') + 'ajax=1',
38 beforeSend: function (formData) {
39 a.addClass('processing');
41 error: function (xhr, textStatus, errorThrown) {
42 alert(errorThrown || textStatus);
44 success: function (data, textStatus, xhr) {
45 if (typeof($('form', data)[0]) != 'undefined') {
46 a.after(document._importNode($('form', data)[0], true));
48 var form = a.parent().find('.form_settings');
51 .addClass('dialogbox')
52 .append('<button class="close">×</button>');
56 .addClass('submit_dialogbox')
57 .removeClass('submit')
58 .bind('click', function () {
59 form.addClass('processing');
62 form.find('button.close').click(function (){
68 form.find('#profile').focus();
71 a.removeClass('processing');
78 SN.Init.Subscribe = function () {
79 $(document).on('click',
80 '.entity_subscribe .entity_remote_subscribe, .entity_tag .entity_remote_tag',
81 function () { SN.U.DialogBox.Subscribe($(this)); return false; });
84 $(document).ready(function () {
87 $('.form_remote_authorize').bind('submit', function () {
88 $(this).addClass(SN.C.S.Processing); return true;