This commit is contained in:
James Campos 2012-06-12 10:29:25 -07:00
parent 91efc92fe1
commit 82743a39dc
2 changed files with 11 additions and 12 deletions

View File

@ -3442,20 +3442,21 @@
this.textContent = 'Error: no password found'; this.textContent = 'Error: no password found';
return; return;
} }
DeleteButton.el = this;
$.off(this, 'click', DeleteButton["delete"]); $.off(this, 'click', DeleteButton["delete"]);
this.textContent = 'Deleting...'; this.textContent = 'Deleting...';
self = this;
id = $.x('preceding-sibling::input', this).name; id = $.x('preceding-sibling::input', this).name;
data = new FormData(); data = new FormData();
data.append(id, 'delete'); data.append(id, 'delete');
data.append('mode', 'usrdel'); data.append('mode', 'usrdel');
data.append('pwd', pwd); data.append('pwd', pwd);
self = this;
return $.ajax("https://sys.4chan.org/" + g.BOARD + "/imgboard.php", { return $.ajax("https://sys.4chan.org/" + g.BOARD + "/imgboard.php", {
onload: function() { onload: function() {
return DeleteButton.load(self); return DeleteButton.load(self);
}, },
onerror: DeleteButton.error onerror: function() {
return DeleteButton.error(self);
}
}, { }, {
type: 'post', type: 'post',
form: data form: data
@ -3474,8 +3475,8 @@
} }
return self.textContent = tc; return self.textContent = tc;
}, },
error: function() { error: function(self) {
return DeleteButton.el.textContent = 'Error'; return self.textContent = 'Error';
} }
}; };

View File

@ -2625,20 +2625,18 @@ DeleteButton =
@textContent = 'Error: no password found' @textContent = 'Error: no password found'
return return
DeleteButton.el = @
$.off @, 'click', DeleteButton.delete $.off @, 'click', DeleteButton.delete
@textContent = 'Deleting...' @textContent = 'Deleting...'
self = this
id = $.x('preceding-sibling::input', @).name id = $.x('preceding-sibling::input', @).name
data = new FormData() data = new FormData()
data.append id, 'delete' data.append id, 'delete'
data.append 'mode', 'usrdel' data.append 'mode', 'usrdel'
data.append 'pwd', pwd data.append 'pwd', pwd
self = this
$.ajax "https://sys.4chan.org/#{g.BOARD}/imgboard.php", { $.ajax "https://sys.4chan.org/#{g.BOARD}/imgboard.php", {
onload: -> DeleteButton.load self onload: -> DeleteButton.load self
onerror: DeleteButton.error onerror: -> DeleteButton.error self
}, { }, {
type: 'post' type: 'post'
form: data form: data
@ -2653,8 +2651,8 @@ DeleteButton =
else else
tc = 'Deleted' tc = 'Deleted'
self.textContent = tc self.textContent = tc
error: -> error: (self) ->
DeleteButton.el.textContent = 'Error' self.textContent = 'Error'
ReportButton = ReportButton =
init: -> init: ->