diff --git a/4chan_x.user.js b/4chan_x.user.js index daec9e850..990534c32 100644 --- a/4chan_x.user.js +++ b/4chan_x.user.js @@ -1737,7 +1737,9 @@ return; } url = window.URL || window.webkitURL; - url.revokeObjectURL(this.url); + if (typeof url.revokeObjectURL === "function") { + url.revokeObjectURL(this.url); + } fileUrl = url.createObjectURL(file); img = $.el('img'); $.on(img, 'load', function() { @@ -1769,12 +1771,13 @@ bb.append(ui8a.buffer); _this.url = url.createObjectURL(bb.getBlob('image/png')); _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; }; _Class.prototype.rmFile = function() { + var _base1; QR.resetFileInput(); delete this.file; this.el.title = null; @@ -1782,7 +1785,7 @@ if (QR.spoiler) { $('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() { @@ -1846,7 +1849,7 @@ }; _Class.prototype.rm = function() { - var index; + var index, _base1; QR.resetFileInput(); $.rm(this.el); index = QR.replies.indexOf(this); @@ -1856,7 +1859,9 @@ (QR.replies[index - 1] || QR.replies[index + 1]).select(); } 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; }; @@ -3662,9 +3667,9 @@ return $.on(a, 'click', DeleteButton["delete"]); }, "delete": function() { - var board, form, id, m, o, pwd, self; + var board, form, id, m, pwd, self; $.off(this, 'click', DeleteButton["delete"]); - this.textContent = 'Deleting...'; + this.innerHTML = '[ Deleting... ]'; if (m = d.cookie.match(/4chan_pass=([^;]+)/)) { pwd = decodeURIComponent(m[1]); } else { @@ -3673,12 +3678,11 @@ id = $.x('preceding-sibling::input', this).name; board = $.x('preceding-sibling::span[1]/a', this).pathname.match(/\w+/)[0]; self = this; - o = { + form = { mode: 'usrdel', pwd: pwd }; - o[id] = 'delete'; - form = $.formData(o); + form[id] = 'delete'; return $.ajax("https://sys.4chan.org/" + board + "/imgboard.php", { onload: function() { return DeleteButton.load(self, this.response); @@ -3687,7 +3691,7 @@ return DeleteButton.error(self); } }, { - form: form + form: $.formData(form) }); }, load: function(self, html) { diff --git a/script.coffee b/script.coffee index 39e616102..119675e9e 100644 --- a/script.coffee +++ b/script.coffee @@ -1320,7 +1320,8 @@ QR = @el.style.backgroundImage = null return url = window.URL or window.webkitURL - url.revokeObjectURL @url + # XXX Opera does not support window.URL.revokeObjectURL + url.revokeObjectURL? @url # Create a redimensioned thumbnail. fileUrl = url.createObjectURL file @@ -1359,7 +1360,7 @@ QR = @url = url.createObjectURL bb.getBlob 'image/png' @el.style.backgroundImage = "url(#{@url})" - url.revokeObjectURL fileUrl + url.revokeObjectURL? fileUrl img.src = fileUrl rmFile: -> @@ -1368,7 +1369,7 @@ QR = @el.title = null @el.style.backgroundImage = null $('label', @el).hidden = true if QR.spoiler - (window.URL or window.webkitURL).revokeObjectURL @url + (window.URL or window.webkitURL).revokeObjectURL? @url select: -> QR.selected?.el.id = null QR.selected = @ @@ -1414,7 +1415,7 @@ QR = else if @el.id is 'selected' (QR.replies[index-1] or QR.replies[index+1]).select() QR.replies.splice index, 1 - (window.URL or window.webkitURL).revokeObjectURL @url + (window.URL or window.webkitURL).revokeObjectURL? @url delete @ captcha: @@ -2882,7 +2883,7 @@ DeleteButton = $.on a, 'click', DeleteButton.delete delete: -> $.off @, 'click', DeleteButton.delete - @textContent = 'Deleting...' + @innerHTML = '[ Deleting... ]' if m = d.cookie.match /4chan_pass=([^;]+)/ pwd = decodeURIComponent m[1] @@ -2892,17 +2893,16 @@ DeleteButton = board = $.x('preceding-sibling::span[1]/a', @).pathname.match(/\w+/)[0] self = this - o = + form = mode: 'usrdel' pwd: pwd - o[id] = 'delete' - form = $.formData o + form[id] = 'delete' $.ajax "https://sys.4chan.org/#{board}/imgboard.php", { onload: -> DeleteButton.load self, @response onerror: -> DeleteButton.error self }, { - form: form + form: $.formData form } load: (self, html) ->