-/* Blerg is (C) 2011 The Dominion of Awesome, and is distributed under a
- * BSD-style license. Please see the COPYING file for details.
- */
-
-LoginStatus.prototype.post = function(msg) {
- if (!this.loggedIn) {
- alert("You are not logged in!");
- return;
- }
-
- new Ajax.Request(baseURL + '/put', {
- parameters: {
- username: this.username,
- data: msg
- },
- onSuccess: function(r) {
- var j = r.responseText.evalJSON();
- if (j && j.status == 'success') {
- $('post.content').value = '';
- if (location.hash != '#' + this.username) {
- qlink(this.username);
- } else {
- currentPager.itemCount++;
- currentPager.reload();
- }
- } else {
- alert('Post failed!');
- }
- }.bind(this),
- onFailure: function(r) {
- alert('Post failed!');
- }
- });
-}
-
-function passwd() {
- var old_password = $('passwd.old_password').value;
- var new_password = $('passwd.new_password').value;
-
- new Ajax.Request(baseURL + '/passwd', {
- parameters: {
- username: loginStatus.username,
- password: old_password,
- new_password: new_password
- },
- onSuccess: function(r) {
- if (r.responseJSON.status == 'success') {
- alert('Password changed');
- passwd_cancel();
- } else {
- alert('Password change failed. Your password has NOT been changed.');
- }
- },
- onFailure: function(r) {
- alert('Password change error');
- }
- });
-}
-
-function passwd_cancel() {
- $('passwd').hide();
- $('navigation').show();
- urlSwitch();
-}