diff --git a/LICENSE b/LICENSE index f337df97e..49b772f61 100755 --- a/LICENSE +++ b/LICENSE @@ -1,5 +1,5 @@ /* -* 4chan X - Version 1.3.5 - 2014-02-12 +* 4chan X - Version 1.3.5 - 2014-02-13 * * Licensed under the MIT license. * https://github.com/Spittie/4chan-x/blob/master/LICENSE diff --git a/builds/4chan-X.user.js b/builds/4chan-X.user.js index 89c098359..9a0ad4730 100644 --- a/builds/4chan-X.user.js +++ b/builds/4chan-X.user.js @@ -23,7 +23,7 @@ // ==/UserScript== /* -* 4chan X - Version 1.3.5 - 2014-02-12 +* 4chan X - Version 1.3.5 - 2014-02-13 * * Licensed under the MIT license. * https://github.com/Spittie/4chan-x/blob/master/LICENSE @@ -5663,6 +5663,16 @@ QR.handleFiles(files); return $.addClass(QR.nodes.el, 'dump'); }, + handleBlob: function(blob) { + var _ref; + if (blob.type === null) { + return QR.error("Unsupported file type."); + } + if (_ref = blob.type, __indexOf.call(QR.mimeTypes, _ref) < 0) { + return QR.error("Unsupported file type."); + } + return QR.handleFiles([blob]); + }, handleUrl: function() { var url; url = prompt("Insert an url:"); @@ -5674,7 +5684,7 @@ url: url, overrideMimeType: "text/plain; charset=x-user-defined", onload: function(xhr) { - var data, end, header, i, mime, r, start, urlBlob, _ref; + var data, end, header, i, mime, r, start, urlBlob; r = xhr.responseText; data = new Uint8Array(r.length); i = 0; @@ -5692,11 +5702,8 @@ urlBlob = new Blob([data], { type: mime }); - if (_ref = urlBlob.type, __indexOf.call(QR.mimeTypes, _ref) < 0) { - QR.error("Unsupported file type."); - } urlBlob.name = url.substr(url.lastIndexOf('/') + 1, url.length); - QR.handleFiles([urlBlob]); + QR.handleBlob(urlBlob); return; return { onerror: function(xhr) { @@ -6176,7 +6183,7 @@ placeholder: 'Focus to load reCAPTCHA', autocomplete: 'off', spellcheck: false, - tabIndex: 55 + tabIndex: 45 }); this.nodes = { img: imgContainer.firstChild, diff --git a/builds/crx.crx b/builds/crx.crx index 19eb5adc9..1f30beb5a 100644 Binary files a/builds/crx.crx and b/builds/crx.crx differ diff --git a/builds/crx/script.js b/builds/crx/script.js index f9c6f7091..f1ffc0f50 100644 --- a/builds/crx/script.js +++ b/builds/crx/script.js @@ -1,6 +1,6 @@ // Generated by CoffeeScript /* -* 4chan X - Version 1.3.5 - 2014-02-12 +* 4chan X - Version 1.3.5 - 2014-02-13 * * Licensed under the MIT license. * https://github.com/Spittie/4chan-x/blob/master/LICENSE @@ -5675,6 +5675,16 @@ QR.handleFiles(files); return $.addClass(QR.nodes.el, 'dump'); }, + handleBlob: function(blob) { + var _ref; + if (blob.type === null) { + return QR.error("Unsupported file type."); + } + if (_ref = blob.type, __indexOf.call(QR.mimeTypes, _ref) < 0) { + return QR.error("Unsupported file type."); + } + return QR.handleFiles([blob]); + }, handleUrl: function() { var url, xhr; url = prompt("Insert an url:"); @@ -5685,19 +5695,13 @@ xhr.open('GET', url, true); xhr.responseType = 'blob'; xhr.onload = function(e) { - var urlBlob, _ref; + var urlBlob; if (this.readyState === this.DONE && xhr.status === 200) { urlBlob = new Blob([this.response], { type: this.getResponseHeader('content-type') }); - if (urlBlob.type === null) { - return; - } - if (_ref = urlBlob.type, __indexOf.call(QR.mimeTypes, _ref) < 0) { - QR.error("Unsupported file type."); - } urlBlob.name = url.substr(url.lastIndexOf('/') + 1, url.length); - QR.handleFiles([urlBlob]); + QR.handleBlob(urlBlob); } else { QR.error("Can't load image."); } @@ -6166,7 +6170,7 @@ placeholder: 'Focus to load reCAPTCHA', autocomplete: 'off', spellcheck: false, - tabIndex: 55 + tabIndex: 45 }); this.nodes = { img: imgContainer.firstChild, diff --git a/src/Posting/QR.captcha.coffee b/src/Posting/QR.captcha.coffee index 8a54d4f88..e4d23caa1 100644 --- a/src/Posting/QR.captcha.coffee +++ b/src/Posting/QR.captcha.coffee @@ -17,7 +17,7 @@ QR.captcha = placeholder: 'Focus to load reCAPTCHA' autocomplete: 'off' spellcheck: false - tabIndex: 55 + tabIndex: 45 @nodes = img: imgContainer.firstChild input: input diff --git a/src/Posting/QR.coffee b/src/Posting/QR.coffee index d7cabe8d6..ca95ab1e2 100644 --- a/src/Posting/QR.coffee +++ b/src/Posting/QR.coffee @@ -267,6 +267,13 @@ QR = QR.open() QR.handleFiles files $.addClass QR.nodes.el, 'dump' + + handleBlob: (blob) -> + return if blob.type is null + QR.error "Unsupported file type." + return unless blob.type in QR.mimeTypes + QR.error "Unsupported file type." + QR.handleFiles([blob]) handleUrl: -> url = prompt("Insert an url:") @@ -278,11 +285,8 @@ QR = xhr.onload = (e) -> if @readyState is @DONE && xhr.status is 200 urlBlob = new Blob([@response], {type : @getResponseHeader('content-type')}) - return if urlBlob.type is null - unless urlBlob.type in QR.mimeTypes - QR.error "Unsupported file type." urlBlob.name = url.substr(url.lastIndexOf('/')+1, url.length) - QR.handleFiles([urlBlob]) + QR.handleBlob(urlBlob) return else QR.error "Can't load image." @@ -316,11 +320,9 @@ QR = return if mime is null urlBlob = new Blob([data], {type: mime}) - unless urlBlob.type in QR.mimeTypes - QR.error "Unsupported file type." urlBlob.name = url.substr(url.lastIndexOf('/')+1, url.length) - QR.handleFiles([urlBlob]) + QR.handleBlob(urlBlob) return onerror: (xhr) ->