Merge branch 'master' into getarchivedquotes

This commit is contained in:
Nicolas Stepien 2012-06-14 17:22:45 +02:00
commit 5d721e0839
2 changed files with 24 additions and 20 deletions

View File

@ -1737,7 +1737,9 @@
return; return;
} }
url = window.URL || window.webkitURL; url = window.URL || window.webkitURL;
url.revokeObjectURL(this.url); if (typeof url.revokeObjectURL === "function") {
url.revokeObjectURL(this.url);
}
fileUrl = url.createObjectURL(file); fileUrl = url.createObjectURL(file);
img = $.el('img'); img = $.el('img');
$.on(img, 'load', function() { $.on(img, 'load', function() {
@ -1769,12 +1771,13 @@
bb.append(ui8a.buffer); bb.append(ui8a.buffer);
_this.url = url.createObjectURL(bb.getBlob('image/png')); _this.url = url.createObjectURL(bb.getBlob('image/png'));
_this.el.style.backgroundImage = "url(" + _this.url + ")"; _this.el.style.backgroundImage = "url(" + _this.url + ")";
return url.revokeObjectURL(fileUrl); return typeof url.revokeObjectURL === "function" ? url.revokeObjectURL(fileUrl) : void 0;
}); });
return img.src = fileUrl; return img.src = fileUrl;
}; };
_Class.prototype.rmFile = function() { _Class.prototype.rmFile = function() {
var _base1;
QR.resetFileInput(); QR.resetFileInput();
delete this.file; delete this.file;
this.el.title = null; this.el.title = null;
@ -1782,7 +1785,7 @@
if (QR.spoiler) { if (QR.spoiler) {
$('label', this.el).hidden = true; $('label', this.el).hidden = true;
} }
return (window.URL || window.webkitURL).revokeObjectURL(this.url); return typeof (_base1 = window.URL || window.webkitURL).revokeObjectURL === "function" ? _base1.revokeObjectURL(this.url) : void 0;
}; };
_Class.prototype.select = function() { _Class.prototype.select = function() {
@ -1846,7 +1849,7 @@
}; };
_Class.prototype.rm = function() { _Class.prototype.rm = function() {
var index; var index, _base1;
QR.resetFileInput(); QR.resetFileInput();
$.rm(this.el); $.rm(this.el);
index = QR.replies.indexOf(this); index = QR.replies.indexOf(this);
@ -1856,7 +1859,9 @@
(QR.replies[index - 1] || QR.replies[index + 1]).select(); (QR.replies[index - 1] || QR.replies[index + 1]).select();
} }
QR.replies.splice(index, 1); QR.replies.splice(index, 1);
(window.URL || window.webkitURL).revokeObjectURL(this.url); if (typeof (_base1 = window.URL || window.webkitURL).revokeObjectURL === "function") {
_base1.revokeObjectURL(this.url);
}
return delete this; return delete this;
}; };
@ -3662,9 +3667,9 @@
return $.on(a, 'click', DeleteButton["delete"]); return $.on(a, 'click', DeleteButton["delete"]);
}, },
"delete": function() { "delete": function() {
var board, form, id, m, o, pwd, self; var board, form, id, m, pwd, self;
$.off(this, 'click', DeleteButton["delete"]); $.off(this, 'click', DeleteButton["delete"]);
this.textContent = 'Deleting...'; this.innerHTML = '[ Deleting... ]';
if (m = d.cookie.match(/4chan_pass=([^;]+)/)) { if (m = d.cookie.match(/4chan_pass=([^;]+)/)) {
pwd = decodeURIComponent(m[1]); pwd = decodeURIComponent(m[1]);
} else { } else {
@ -3673,12 +3678,11 @@
id = $.x('preceding-sibling::input', this).name; id = $.x('preceding-sibling::input', this).name;
board = $.x('preceding-sibling::span[1]/a', this).pathname.match(/\w+/)[0]; board = $.x('preceding-sibling::span[1]/a', this).pathname.match(/\w+/)[0];
self = this; self = this;
o = { form = {
mode: 'usrdel', mode: 'usrdel',
pwd: pwd pwd: pwd
}; };
o[id] = 'delete'; form[id] = 'delete';
form = $.formData(o);
return $.ajax("https://sys.4chan.org/" + board + "/imgboard.php", { return $.ajax("https://sys.4chan.org/" + board + "/imgboard.php", {
onload: function() { onload: function() {
return DeleteButton.load(self, this.response); return DeleteButton.load(self, this.response);
@ -3687,7 +3691,7 @@
return DeleteButton.error(self); return DeleteButton.error(self);
} }
}, { }, {
form: form form: $.formData(form)
}); });
}, },
load: function(self, html) { load: function(self, html) {

View File

@ -1320,7 +1320,8 @@ QR =
@el.style.backgroundImage = null @el.style.backgroundImage = null
return return
url = window.URL or window.webkitURL url = window.URL or window.webkitURL
url.revokeObjectURL @url # XXX Opera does not support window.URL.revokeObjectURL
url.revokeObjectURL? @url
# Create a redimensioned thumbnail. # Create a redimensioned thumbnail.
fileUrl = url.createObjectURL file fileUrl = url.createObjectURL file
@ -1359,7 +1360,7 @@ QR =
@url = url.createObjectURL bb.getBlob 'image/png' @url = url.createObjectURL bb.getBlob 'image/png'
@el.style.backgroundImage = "url(#{@url})" @el.style.backgroundImage = "url(#{@url})"
url.revokeObjectURL fileUrl url.revokeObjectURL? fileUrl
img.src = fileUrl img.src = fileUrl
rmFile: -> rmFile: ->
@ -1368,7 +1369,7 @@ QR =
@el.title = null @el.title = null
@el.style.backgroundImage = null @el.style.backgroundImage = null
$('label', @el).hidden = true if QR.spoiler $('label', @el).hidden = true if QR.spoiler
(window.URL or window.webkitURL).revokeObjectURL @url (window.URL or window.webkitURL).revokeObjectURL? @url
select: -> select: ->
QR.selected?.el.id = null QR.selected?.el.id = null
QR.selected = @ QR.selected = @
@ -1414,7 +1415,7 @@ QR =
else if @el.id is 'selected' else if @el.id is 'selected'
(QR.replies[index-1] or QR.replies[index+1]).select() (QR.replies[index-1] or QR.replies[index+1]).select()
QR.replies.splice index, 1 QR.replies.splice index, 1
(window.URL or window.webkitURL).revokeObjectURL @url (window.URL or window.webkitURL).revokeObjectURL? @url
delete @ delete @
captcha: captcha:
@ -2882,7 +2883,7 @@ DeleteButton =
$.on a, 'click', DeleteButton.delete $.on a, 'click', DeleteButton.delete
delete: -> delete: ->
$.off @, 'click', DeleteButton.delete $.off @, 'click', DeleteButton.delete
@textContent = 'Deleting...' @innerHTML = '[ Deleting... ]'
if m = d.cookie.match /4chan_pass=([^;]+)/ if m = d.cookie.match /4chan_pass=([^;]+)/
pwd = decodeURIComponent m[1] pwd = decodeURIComponent m[1]
@ -2892,17 +2893,16 @@ DeleteButton =
board = $.x('preceding-sibling::span[1]/a', @).pathname.match(/\w+/)[0] board = $.x('preceding-sibling::span[1]/a', @).pathname.match(/\w+/)[0]
self = this self = this
o = form =
mode: 'usrdel' mode: 'usrdel'
pwd: pwd pwd: pwd
o[id] = 'delete' form[id] = 'delete'
form = $.formData o
$.ajax "https://sys.4chan.org/#{board}/imgboard.php", { $.ajax "https://sys.4chan.org/#{board}/imgboard.php", {
onload: -> DeleteButton.load self, @response onload: -> DeleteButton.load self, @response
onerror: -> DeleteButton.error self onerror: -> DeleteButton.error self
}, { }, {
form: form form: $.formData form
} }
load: (self, html) -> load: (self, html) ->