summaryrefslogtreecommitdiff
path: root/plugins/OStatus/js/ostatus.js
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/OStatus/js/ostatus.js')
-rw-r--r--plugins/OStatus/js/ostatus.js58
1 files changed, 50 insertions, 8 deletions
diff --git a/plugins/OStatus/js/ostatus.js b/plugins/OStatus/js/ostatus.js
index 671795558..bd29b5c0c 100644
--- a/plugins/OStatus/js/ostatus.js
+++ b/plugins/OStatus/js/ostatus.js
@@ -1,6 +1,38 @@
+/*
+ * StatusNet - a distributed open-source microblogging tool
+ * Copyright (C) 2010, StatusNet, Inc.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ * @category OStatus UI interaction
+ * @package StatusNet
+ * @author Sarven Capadisli <csarven@status.net>
+ * @copyright 2010 StatusNet, Inc.
+ * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
+ * @link http://status.net/
+ * @note Everything in here should eventually migrate over to /js/util.js's SN.
+ */
+
+SN.Init.OStatusCookie = function() {
+ if (SN.U.StatusNetInstance.Get() === null) {
+ SN.U.StatusNetInstance.Set({RemoteProfile: null});
+ }
+};
+
SN.U.DialogBox = {
Subscribe: function(a) {
- var f = a.parent().find('#form_ostatus_connect');
+ var f = a.parent().find('.form_settings');
if (f.length > 0) {
f.show();
}
@@ -8,7 +40,7 @@ SN.U.DialogBox = {
$.ajax({
type: 'GET',
dataType: 'xml',
- url: a[0].href+'&ajax=1',
+ url: a[0].href + ((a[0].href.match(/[\\?]/) === null)?'?':'&') + 'ajax=1',
beforeSend: function(formData) {
a.addClass('processing');
},
@@ -19,7 +51,7 @@ SN.U.DialogBox = {
if (typeof($('form', data)[0]) != 'undefined') {
a.after(document._importNode($('form', data)[0], true));
- var form = a.parent().find('#form_ostatus_connect');
+ var form = a.parent().find('.form_settings');
form
.addClass('dialogbox')
@@ -39,7 +71,17 @@ SN.U.DialogBox = {
return false;
});
- form.find('#acct').focus();
+ form.find('#profile').focus();
+
+ if (form.attr('id') == 'form_ostatus_connect') {
+ SN.Init.OStatusCookie();
+ form.find('#profile').val(SN.U.StatusNetInstance.Get().RemoteProfile);
+
+ form.find("[type=submit]").bind('click', function() {
+ SN.U.StatusNetInstance.Set({RemoteProfile: form.find('#profile').val()});
+ return true;
+ });
+ }
}
a.removeClass('processing');
@@ -50,11 +92,11 @@ SN.U.DialogBox = {
};
SN.Init.Subscribe = function() {
- $('.entity_subscribe a').live('click', function() { SN.U.DialogBox.Subscribe($(this)); return false; });
+ $('.entity_subscribe .entity_remote_subscribe').live('click', function() { SN.U.DialogBox.Subscribe($(this)); return false; });
};
$(document).ready(function() {
- if ($('.entity_subscribe .entity_remote_subscribe').length > 0) {
- SN.Init.Subscribe();
- }
+ SN.Init.Subscribe();
+
+ $('.form_remote_authorize').bind('submit', function() { $(this).addClass(SN.C.S.Processing); return true; });
});