Fixes, better code(?)
This commit is contained in:
parent
cff413769e
commit
af2589d0e2
2
LICENSE
2
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
|
||||
|
||||
@ -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,
|
||||
|
||||
BIN
builds/crx.crx
BIN
builds/crx.crx
Binary file not shown.
@ -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,
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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) ->
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user