Release 4chan X v1.7.25.
This commit is contained in:
parent
667b8dd0a2
commit
f7554f3a05
@ -1,3 +1,6 @@
|
|||||||
|
### v1.7.25
|
||||||
|
*2014-05-01*
|
||||||
|
|
||||||
**ccd0**
|
**ccd0**
|
||||||
- For single files, file errors are reported but no longer stop you from attempting to post. Files with errors are still removed when posting multiple files.
|
- For single files, file errors are reported but no longer stop you from attempting to post. Files with errors are still removed when posting multiple files.
|
||||||
- Fix small bugs in file checking, uploading from URLs.
|
- Fix small bugs in file checking, uploading from URLs.
|
||||||
|
|||||||
2
LICENSE
2
LICENSE
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* 4chan X - Version 1.7.24 - 2014-04-30
|
* 4chan X - Version 1.7.25 - 2014-05-01
|
||||||
*
|
*
|
||||||
* Licensed under the MIT license.
|
* Licensed under the MIT license.
|
||||||
* https://github.com/ccd0/4chan-x/blob/master/LICENSE
|
* https://github.com/ccd0/4chan-x/blob/master/LICENSE
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
// ==UserScript==
|
// ==UserScript==
|
||||||
// @name 4chan X
|
// @name 4chan X
|
||||||
// @version 1.7.24
|
// @version 1.7.25
|
||||||
// @minGMVer 1.14
|
// @minGMVer 1.14
|
||||||
// @minFFVer 26
|
// @minFFVer 26
|
||||||
// @namespace 4chan-X
|
// @namespace 4chan-X
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
// Generated by CoffeeScript
|
// Generated by CoffeeScript
|
||||||
// ==UserScript==
|
// ==UserScript==
|
||||||
// @name 4chan X
|
// @name 4chan X
|
||||||
// @version 1.7.24
|
// @version 1.7.25
|
||||||
// @minGMVer 1.14
|
// @minGMVer 1.14
|
||||||
// @minFFVer 26
|
// @minFFVer 26
|
||||||
// @namespace 4chan-X
|
// @namespace 4chan-X
|
||||||
@ -24,7 +24,7 @@
|
|||||||
// ==/UserScript==
|
// ==/UserScript==
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* 4chan X - Version 1.7.24 - 2014-04-30
|
* 4chan X - Version 1.7.25 - 2014-05-01
|
||||||
*
|
*
|
||||||
* Licensed under the MIT license.
|
* Licensed under the MIT license.
|
||||||
* https://github.com/ccd0/4chan-x/blob/master/LICENSE
|
* https://github.com/ccd0/4chan-x/blob/master/LICENSE
|
||||||
@ -372,7 +372,7 @@
|
|||||||
doc = d.documentElement;
|
doc = d.documentElement;
|
||||||
|
|
||||||
g = {
|
g = {
|
||||||
VERSION: '1.7.24',
|
VERSION: '1.7.25',
|
||||||
NAMESPACE: '4chan X.',
|
NAMESPACE: '4chan X.',
|
||||||
boards: {}
|
boards: {}
|
||||||
};
|
};
|
||||||
@ -5647,7 +5647,7 @@
|
|||||||
};
|
};
|
||||||
|
|
||||||
QR = {
|
QR = {
|
||||||
mimeTypes: ['image/jpeg', 'image/png', 'image/gif', 'application/pdf', 'application/x-shockwave-flash', 'video/webm', ''],
|
mimeTypes: ['image/jpeg', 'image/png', 'image/gif', 'application/pdf', 'application/vnd.adobe.flash.movie', 'application/x-shockwave-flash', 'video/webm'],
|
||||||
init: function() {
|
init: function() {
|
||||||
var sc;
|
var sc;
|
||||||
if (!Conf['Quick Reply']) {
|
if (!Conf['Quick Reply']) {
|
||||||
@ -5990,32 +5990,18 @@
|
|||||||
QR.handleFiles(files);
|
QR.handleFiles(files);
|
||||||
return $.addClass(QR.nodes.el, 'dump');
|
return $.addClass(QR.nodes.el, 'dump');
|
||||||
},
|
},
|
||||||
handleBlob: function(urlBlob, header, url) {
|
handleBlob: function(urlBlob, contentType, contentDisposition, url) {
|
||||||
var blob, end, endnl, endsc, mime, name, name_end, name_start, start, _ref;
|
var blob, match, mime, name, _ref, _ref1, _ref2;
|
||||||
name = url.substr(url.lastIndexOf('/') + 1, url.length);
|
name = (_ref = url.match(/([^\/]+)\/*$/)) != null ? _ref[1] : void 0;
|
||||||
start = header.indexOf("Content-Type: ") + 14;
|
mime = (contentType != null ? contentType.match(/[^;]*/)[0] : void 0) || 'application/octet-stream';
|
||||||
endsc = header.substr(start, header.length).indexOf(";");
|
match = (contentDisposition != null ? (_ref1 = contentDisposition.match(/\bfilename\s*=\s*"((\\"|[^"])+)"/i)) != null ? _ref1[1] : void 0 : void 0) || (contentType != null ? (_ref2 = contentType.match(/\bname\s*=\s*"((\\"|[^"])+)"/i)) != null ? _ref2[1] : void 0 : void 0);
|
||||||
endnl = header.substr(start, header.length).indexOf("\n") - 1;
|
if (match) {
|
||||||
end = endnl;
|
name = match.replace(/\\"/g, '"');
|
||||||
if (endsc !== -1 && endsc < endnl) {
|
|
||||||
end = endsc;
|
|
||||||
}
|
}
|
||||||
mime = header.substr(start, end);
|
|
||||||
blob = new Blob([urlBlob], {
|
blob = new Blob([urlBlob], {
|
||||||
type: mime
|
type: mime
|
||||||
});
|
});
|
||||||
blob.name = url.substr(url.lastIndexOf('/') + 1, url.length);
|
blob.name = name;
|
||||||
name_start = header.indexOf('name="') + 6;
|
|
||||||
if (name_start - 6 !== -1) {
|
|
||||||
name_end = header.substr(name_start, header.length).indexOf('"');
|
|
||||||
blob.name = header.substr(name_start, name_end);
|
|
||||||
}
|
|
||||||
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]);
|
return QR.handleFiles([blob]);
|
||||||
},
|
},
|
||||||
handleUrl: function() {
|
handleUrl: function() {
|
||||||
@ -6024,12 +6010,12 @@
|
|||||||
if (url === null) {
|
if (url === null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
GM_xmlhttpRequest({
|
return GM_xmlhttpRequest({
|
||||||
method: "GET",
|
method: "GET",
|
||||||
url: url,
|
url: url,
|
||||||
overrideMimeType: "text/plain; charset=x-user-defined",
|
overrideMimeType: "text/plain; charset=x-user-defined",
|
||||||
onload: function(xhr) {
|
onload: function(xhr) {
|
||||||
var data, i, r;
|
var contentDisposition, contentType, data, i, r, _ref, _ref1;
|
||||||
r = xhr.responseText;
|
r = xhr.responseText;
|
||||||
data = new Uint8Array(r.length);
|
data = new Uint8Array(r.length);
|
||||||
i = 0;
|
i = 0;
|
||||||
@ -6037,13 +6023,12 @@
|
|||||||
data[i] = r.charCodeAt(i);
|
data[i] = r.charCodeAt(i);
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
QR.handleBlob(data, xhr.responseHeaders, url);
|
contentType = (_ref = xhr.responseHeaders.match(/Content-Type:\s*(.*)/i)) != null ? _ref[1] : void 0;
|
||||||
return;
|
contentDisposition = (_ref1 = xhr.responseHeaders.match(/Content-Disposition:\s*(.*)/i)) != null ? _ref1[1] : void 0;
|
||||||
return {
|
return QR.handleBlob(data, contentType, contentDisposition, url);
|
||||||
onerror: function(xhr) {
|
},
|
||||||
return QR.error("Can't load image.");
|
onerror: function(xhr) {
|
||||||
}
|
return QR.error("Can't load image.");
|
||||||
};
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
@ -6067,38 +6052,45 @@
|
|||||||
},
|
},
|
||||||
handleFile: function(file, index, nfiles) {
|
handleFile: function(file, index, nfiles) {
|
||||||
var isNewPost, max, post, _ref;
|
var isNewPost, max, post, _ref;
|
||||||
if (_ref = file.type, __indexOf.call(QR.mimeTypes, _ref) >= 0) {
|
if (/^text\//.test(file.type)) {
|
||||||
max = QR.nodes.fileInput.max;
|
|
||||||
if (/^video\//.test(file.type)) {
|
|
||||||
max = Math.min(max, QR.max_size_video);
|
|
||||||
}
|
|
||||||
if (file.size > max) {
|
|
||||||
return QR.error("" + file.name + ": File too large (file: " + ($.bytesToString(file.size)) + ", max: " + ($.bytesToString(max)) + ").");
|
|
||||||
}
|
|
||||||
isNewPost = false;
|
|
||||||
if (nfiles === 1) {
|
|
||||||
post = QR.selected;
|
|
||||||
} else if (index !== 0 || (post = QR.posts[QR.posts.length - 1]).file) {
|
|
||||||
isNewPost = true;
|
|
||||||
post = new QR.post();
|
|
||||||
}
|
|
||||||
return QR.checkDimensions(file, function(pass) {
|
|
||||||
if (pass) {
|
|
||||||
return post.setFile(file);
|
|
||||||
} else if (isNewPost) {
|
|
||||||
return post.rm();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
} else if (/^text/.test(file.type)) {
|
|
||||||
if (nfiles === 1) {
|
if (nfiles === 1) {
|
||||||
post = QR.selected;
|
post = QR.selected;
|
||||||
} else if (index !== 0 || (post = QR.posts[QR.posts.length - 1]).com) {
|
} else if (index !== 0 || (post = QR.posts[QR.posts.length - 1]).com) {
|
||||||
post = new QR.post();
|
post = new QR.post();
|
||||||
}
|
}
|
||||||
return post.pasteText(file);
|
post.pasteText(file);
|
||||||
} else {
|
return;
|
||||||
return QR.error("" + file.name + ": Unsupported file type.");
|
|
||||||
}
|
}
|
||||||
|
if (_ref = file.type, __indexOf.call(QR.mimeTypes, _ref) < 0) {
|
||||||
|
QR.error("" + file.name + ": Unsupported file type.");
|
||||||
|
if (nfiles !== 1) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
max = QR.nodes.fileInput.max;
|
||||||
|
if (/^video\//.test(file.type)) {
|
||||||
|
max = Math.min(max, QR.max_size_video);
|
||||||
|
}
|
||||||
|
if (file.size > max) {
|
||||||
|
QR.error("" + file.name + ": File too large (file: " + ($.bytesToString(file.size)) + ", max: " + ($.bytesToString(max)) + ").");
|
||||||
|
if (nfiles !== 1) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
isNewPost = false;
|
||||||
|
if (nfiles === 1) {
|
||||||
|
post = QR.selected;
|
||||||
|
} else if (index !== 0 || (post = QR.posts[QR.posts.length - 1]).file) {
|
||||||
|
isNewPost = true;
|
||||||
|
post = new QR.post();
|
||||||
|
}
|
||||||
|
return QR.checkDimensions(file, function(pass) {
|
||||||
|
if (pass || nfiles === 1) {
|
||||||
|
return post.setFile(file);
|
||||||
|
} else if (isNewPost) {
|
||||||
|
return post.rm();
|
||||||
|
}
|
||||||
|
});
|
||||||
},
|
},
|
||||||
checkDimensions: function(file, cb) {
|
checkDimensions: function(file, cb) {
|
||||||
var img, video;
|
var img, video;
|
||||||
@ -6106,17 +6098,18 @@
|
|||||||
img = new Image();
|
img = new Image();
|
||||||
img.onload = (function(_this) {
|
img.onload = (function(_this) {
|
||||||
return function() {
|
return function() {
|
||||||
var height, width;
|
var height, pass, width;
|
||||||
height = img.height, width = img.width;
|
height = img.height, width = img.width;
|
||||||
|
pass = true;
|
||||||
if (height > QR.max_height || width > QR.max_width) {
|
if (height > QR.max_height || width > QR.max_width) {
|
||||||
QR.error("" + file.name + ": Image too large (image: " + height + "x" + width + "px, max: " + QR.max_height + "x" + QR.max_width + "px)");
|
QR.error("" + file.name + ": Image too large (image: " + height + "x" + width + "px, max: " + QR.max_height + "x" + QR.max_width + "px)");
|
||||||
return cb(false);
|
pass = false;
|
||||||
} else if (height < QR.min_height || width < QR.min_width) {
|
|
||||||
QR.error("" + file.name + ": Image too small (image: " + height + "x" + width + "px, min: " + QR.min_height + "x" + QR.min_width + "px)");
|
|
||||||
return cb(false);
|
|
||||||
} else {
|
|
||||||
return cb(true);
|
|
||||||
}
|
}
|
||||||
|
if (height < QR.min_height || width < QR.min_width) {
|
||||||
|
QR.error("" + file.name + ": Image too small (image: " + height + "x" + width + "px, min: " + QR.min_height + "x" + QR.min_width + "px)");
|
||||||
|
pass = false;
|
||||||
|
}
|
||||||
|
return cb(pass);
|
||||||
};
|
};
|
||||||
})(this);
|
})(this);
|
||||||
return img.src = URL.createObjectURL(file);
|
return img.src = URL.createObjectURL(file);
|
||||||
@ -6124,37 +6117,47 @@
|
|||||||
video = $.el('video');
|
video = $.el('video');
|
||||||
$.on(video, 'loadedmetadata', (function(_this) {
|
$.on(video, 'loadedmetadata', (function(_this) {
|
||||||
return function() {
|
return function() {
|
||||||
var duration, max_height, max_width, videoHeight, videoWidth;
|
var duration, max_height, max_width, pass, videoHeight, videoWidth;
|
||||||
if (cb == null) {
|
if (cb == null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
videoHeight = video.videoHeight, videoWidth = video.videoWidth, duration = video.duration;
|
videoHeight = video.videoHeight, videoWidth = video.videoWidth, duration = video.duration;
|
||||||
max_height = Math.min(QR.max_height, QR.max_height_video);
|
max_height = Math.min(QR.max_height, QR.max_height_video);
|
||||||
max_width = Math.min(QR.max_width, QR.max_width_video);
|
max_width = Math.min(QR.max_width, QR.max_width_video);
|
||||||
|
pass = true;
|
||||||
if (videoHeight > max_height || videoWidth > max_width) {
|
if (videoHeight > max_height || videoWidth > max_width) {
|
||||||
QR.error("" + file.name + ": Video too large (video: " + videoHeight + "x" + videoWidth + "px, max: " + max_height + "x" + max_width + "px)");
|
QR.error("" + file.name + ": Video too large (video: " + videoHeight + "x" + videoWidth + "px, max: " + max_height + "x" + max_width + "px)");
|
||||||
cb(false);
|
pass = false;
|
||||||
} else if (videoHeight < QR.min_height || videoWidth < QR.min_width) {
|
|
||||||
QR.error("" + file.name + ": Video too small (video: " + videoHeight + "x" + videoWidth + "px, min: " + QR.min_height + "x" + QR.min_width + "px)");
|
|
||||||
cb(false);
|
|
||||||
} else if (!isFinite(video.duration)) {
|
|
||||||
QR.error("" + file.name + ": Video lacks duration metadata (try remuxing)");
|
|
||||||
cb(false);
|
|
||||||
} else if (duration > QR.max_duration_video) {
|
|
||||||
QR.error("" + file.name + ": Video too long (video: " + duration + "s, max: " + QR.max_duration_video + "s)");
|
|
||||||
cb(false);
|
|
||||||
} else {
|
|
||||||
cb(true);
|
|
||||||
}
|
}
|
||||||
|
if (videoHeight < QR.min_height || videoWidth < QR.min_width) {
|
||||||
|
QR.error("" + file.name + ": Video too small (video: " + videoHeight + "x" + videoWidth + "px, min: " + QR.min_height + "x" + QR.min_width + "px)");
|
||||||
|
pass = false;
|
||||||
|
}
|
||||||
|
if (!isFinite(video.duration)) {
|
||||||
|
QR.error("" + file.name + ": Video lacks duration metadata (try remuxing)");
|
||||||
|
pass = false;
|
||||||
|
}
|
||||||
|
if (duration > QR.max_duration_video) {
|
||||||
|
QR.error("" + file.name + ": Video too long (video: " + duration + "s, max: " + QR.max_duration_video + "s)");
|
||||||
|
pass = false;
|
||||||
|
}
|
||||||
|
if (video.mozHasAudio) {
|
||||||
|
QR.error("" + file.name + ": Audio not allowed");
|
||||||
|
pass = false;
|
||||||
|
}
|
||||||
|
cb(pass);
|
||||||
return cb = null;
|
return cb = null;
|
||||||
};
|
};
|
||||||
})(this));
|
})(this));
|
||||||
$.on(video, 'error', (function(_this) {
|
$.on(video, 'error', (function(_this) {
|
||||||
return function() {
|
return function() {
|
||||||
|
var _ref;
|
||||||
if (cb == null) {
|
if (cb == null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
QR.error("" + file.name + ": Video appears corrupt");
|
if (_ref = file.type, __indexOf.call(QR.mimeTypes, _ref) >= 0) {
|
||||||
|
QR.error("" + file.name + ": Video appears corrupt");
|
||||||
|
}
|
||||||
cb(false);
|
cb(false);
|
||||||
return cb = null;
|
return cb = null;
|
||||||
};
|
};
|
||||||
@ -6244,7 +6247,7 @@
|
|||||||
}
|
}
|
||||||
rules = $('ul.rules').textContent.trim();
|
rules = $('ul.rules').textContent.trim();
|
||||||
QR.min_width = QR.min_height = 1;
|
QR.min_width = QR.min_height = 1;
|
||||||
QR.max_width = QR.max_height = 5000;
|
QR.max_width = QR.max_height = 10000;
|
||||||
try {
|
try {
|
||||||
_ref1 = rules.match(/.+smaller than (\d+)x(\d+).+/), _ = _ref1[0], QR.min_width = _ref1[1], QR.min_height = _ref1[2];
|
_ref1 = rules.match(/.+smaller than (\d+)x(\d+).+/), _ = _ref1[0], QR.min_width = _ref1[1], QR.min_height = _ref1[2];
|
||||||
_ref2 = rules.match(/.+greater than (\d+)x(\d+).+/), _ = _ref2[0], QR.max_width = _ref2[1], QR.max_height = _ref2[2];
|
_ref2 = rules.match(/.+greater than (\d+)x(\d+).+/), _ = _ref2[0], QR.max_width = _ref2[1], QR.max_height = _ref2[2];
|
||||||
|
|||||||
BIN
builds/crx.crx
BIN
builds/crx.crx
Binary file not shown.
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "4chan X",
|
"name": "4chan X",
|
||||||
"version": "1.7.24",
|
"version": "1.7.25",
|
||||||
"manifest_version": 2,
|
"manifest_version": 2,
|
||||||
"description": "Cross-browser userscript for maximum lurking on 4chan.",
|
"description": "Cross-browser userscript for maximum lurking on 4chan.",
|
||||||
"icons": {
|
"icons": {
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
// Generated by CoffeeScript
|
// Generated by CoffeeScript
|
||||||
/*
|
/*
|
||||||
* 4chan X - Version 1.7.24 - 2014-04-30
|
* 4chan X - Version 1.7.25 - 2014-05-01
|
||||||
*
|
*
|
||||||
* Licensed under the MIT license.
|
* Licensed under the MIT license.
|
||||||
* https://github.com/ccd0/4chan-x/blob/master/LICENSE
|
* https://github.com/ccd0/4chan-x/blob/master/LICENSE
|
||||||
@ -348,7 +348,7 @@
|
|||||||
doc = d.documentElement;
|
doc = d.documentElement;
|
||||||
|
|
||||||
g = {
|
g = {
|
||||||
VERSION: '1.7.24',
|
VERSION: '1.7.25',
|
||||||
NAMESPACE: '4chan X.',
|
NAMESPACE: '4chan X.',
|
||||||
boards: {}
|
boards: {}
|
||||||
};
|
};
|
||||||
@ -5681,7 +5681,7 @@
|
|||||||
};
|
};
|
||||||
|
|
||||||
QR = {
|
QR = {
|
||||||
mimeTypes: ['image/jpeg', 'image/png', 'image/gif', 'application/pdf', 'application/x-shockwave-flash', 'video/webm', ''],
|
mimeTypes: ['image/jpeg', 'image/png', 'image/gif', 'application/pdf', 'application/vnd.adobe.flash.movie', 'application/x-shockwave-flash', 'video/webm'],
|
||||||
init: function() {
|
init: function() {
|
||||||
var sc;
|
var sc;
|
||||||
if (!Conf['Quick Reply']) {
|
if (!Conf['Quick Reply']) {
|
||||||
@ -6034,32 +6034,18 @@
|
|||||||
QR.handleFiles(files);
|
QR.handleFiles(files);
|
||||||
return $.addClass(QR.nodes.el, 'dump');
|
return $.addClass(QR.nodes.el, 'dump');
|
||||||
},
|
},
|
||||||
handleBlob: function(urlBlob, header, url) {
|
handleBlob: function(urlBlob, contentType, contentDisposition, url) {
|
||||||
var blob, end, endnl, endsc, mime, name, name_end, name_start, start, _ref;
|
var blob, match, mime, name, _ref, _ref1, _ref2;
|
||||||
name = url.substr(url.lastIndexOf('/') + 1, url.length);
|
name = (_ref = url.match(/([^\/]+)\/*$/)) != null ? _ref[1] : void 0;
|
||||||
start = header.indexOf("Content-Type: ") + 14;
|
mime = (contentType != null ? contentType.match(/[^;]*/)[0] : void 0) || 'application/octet-stream';
|
||||||
endsc = header.substr(start, header.length).indexOf(";");
|
match = (contentDisposition != null ? (_ref1 = contentDisposition.match(/\bfilename\s*=\s*"((\\"|[^"])+)"/i)) != null ? _ref1[1] : void 0 : void 0) || (contentType != null ? (_ref2 = contentType.match(/\bname\s*=\s*"((\\"|[^"])+)"/i)) != null ? _ref2[1] : void 0 : void 0);
|
||||||
endnl = header.substr(start, header.length).indexOf("\n") - 1;
|
if (match) {
|
||||||
end = endnl;
|
name = match.replace(/\\"/g, '"');
|
||||||
if (endsc !== -1 && endsc < endnl) {
|
|
||||||
end = endsc;
|
|
||||||
}
|
}
|
||||||
mime = header.substr(start, end);
|
|
||||||
blob = new Blob([urlBlob], {
|
blob = new Blob([urlBlob], {
|
||||||
type: mime
|
type: mime
|
||||||
});
|
});
|
||||||
blob.name = url.substr(url.lastIndexOf('/') + 1, url.length);
|
blob.name = name;
|
||||||
name_start = header.indexOf('name="') + 6;
|
|
||||||
if (name_start - 6 !== -1) {
|
|
||||||
name_end = header.substr(name_start, header.length).indexOf('"');
|
|
||||||
blob.name = header.substr(name_start, name_end);
|
|
||||||
}
|
|
||||||
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]);
|
return QR.handleFiles([blob]);
|
||||||
},
|
},
|
||||||
handleUrl: function() {
|
handleUrl: function() {
|
||||||
@ -6072,16 +6058,19 @@
|
|||||||
xhr.open('GET', url, true);
|
xhr.open('GET', url, true);
|
||||||
xhr.responseType = 'blob';
|
xhr.responseType = 'blob';
|
||||||
xhr.onload = function(e) {
|
xhr.onload = function(e) {
|
||||||
|
var contentDisposition, contentType;
|
||||||
if (this.readyState === this.DONE && xhr.status === 200) {
|
if (this.readyState === this.DONE && xhr.status === 200) {
|
||||||
QR.handleBlob(this.response, this.getResponseHeader('Content-Type'), url);
|
contentType = this.getResponseHeader('Content-Type');
|
||||||
|
contentDisposition = this.getResponseHeader('Content-Disposition');
|
||||||
|
return QR.handleBlob(this.response, contentType, contentDisposition, url);
|
||||||
} else {
|
} else {
|
||||||
QR.error("Can't load image.");
|
return QR.error("Can't load image.");
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
xhr.onerror = function(e) {
|
xhr.onerror = function(e) {
|
||||||
QR.error("Can't load image.");
|
return QR.error("Can't load image.");
|
||||||
};
|
};
|
||||||
xhr.send();
|
return xhr.send();
|
||||||
},
|
},
|
||||||
handleFiles: function(files) {
|
handleFiles: function(files) {
|
||||||
var file, i, _i, _len;
|
var file, i, _i, _len;
|
||||||
@ -6103,38 +6092,45 @@
|
|||||||
},
|
},
|
||||||
handleFile: function(file, index, nfiles) {
|
handleFile: function(file, index, nfiles) {
|
||||||
var isNewPost, max, post, _ref;
|
var isNewPost, max, post, _ref;
|
||||||
if (_ref = file.type, __indexOf.call(QR.mimeTypes, _ref) >= 0) {
|
if (/^text\//.test(file.type)) {
|
||||||
max = QR.nodes.fileInput.max;
|
|
||||||
if (/^video\//.test(file.type)) {
|
|
||||||
max = Math.min(max, QR.max_size_video);
|
|
||||||
}
|
|
||||||
if (file.size > max) {
|
|
||||||
return QR.error("" + file.name + ": File too large (file: " + ($.bytesToString(file.size)) + ", max: " + ($.bytesToString(max)) + ").");
|
|
||||||
}
|
|
||||||
isNewPost = false;
|
|
||||||
if (nfiles === 1) {
|
|
||||||
post = QR.selected;
|
|
||||||
} else if (index !== 0 || (post = QR.posts[QR.posts.length - 1]).file) {
|
|
||||||
isNewPost = true;
|
|
||||||
post = new QR.post();
|
|
||||||
}
|
|
||||||
return QR.checkDimensions(file, function(pass) {
|
|
||||||
if (pass) {
|
|
||||||
return post.setFile(file);
|
|
||||||
} else if (isNewPost) {
|
|
||||||
return post.rm();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
} else if (/^text/.test(file.type)) {
|
|
||||||
if (nfiles === 1) {
|
if (nfiles === 1) {
|
||||||
post = QR.selected;
|
post = QR.selected;
|
||||||
} else if (index !== 0 || (post = QR.posts[QR.posts.length - 1]).com) {
|
} else if (index !== 0 || (post = QR.posts[QR.posts.length - 1]).com) {
|
||||||
post = new QR.post();
|
post = new QR.post();
|
||||||
}
|
}
|
||||||
return post.pasteText(file);
|
post.pasteText(file);
|
||||||
} else {
|
return;
|
||||||
return QR.error("" + file.name + ": Unsupported file type.");
|
|
||||||
}
|
}
|
||||||
|
if (_ref = file.type, __indexOf.call(QR.mimeTypes, _ref) < 0) {
|
||||||
|
QR.error("" + file.name + ": Unsupported file type.");
|
||||||
|
if (nfiles !== 1) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
max = QR.nodes.fileInput.max;
|
||||||
|
if (/^video\//.test(file.type)) {
|
||||||
|
max = Math.min(max, QR.max_size_video);
|
||||||
|
}
|
||||||
|
if (file.size > max) {
|
||||||
|
QR.error("" + file.name + ": File too large (file: " + ($.bytesToString(file.size)) + ", max: " + ($.bytesToString(max)) + ").");
|
||||||
|
if (nfiles !== 1) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
isNewPost = false;
|
||||||
|
if (nfiles === 1) {
|
||||||
|
post = QR.selected;
|
||||||
|
} else if (index !== 0 || (post = QR.posts[QR.posts.length - 1]).file) {
|
||||||
|
isNewPost = true;
|
||||||
|
post = new QR.post();
|
||||||
|
}
|
||||||
|
return QR.checkDimensions(file, function(pass) {
|
||||||
|
if (pass || nfiles === 1) {
|
||||||
|
return post.setFile(file);
|
||||||
|
} else if (isNewPost) {
|
||||||
|
return post.rm();
|
||||||
|
}
|
||||||
|
});
|
||||||
},
|
},
|
||||||
checkDimensions: function(file, cb) {
|
checkDimensions: function(file, cb) {
|
||||||
var img, video;
|
var img, video;
|
||||||
@ -6142,17 +6138,18 @@
|
|||||||
img = new Image();
|
img = new Image();
|
||||||
img.onload = (function(_this) {
|
img.onload = (function(_this) {
|
||||||
return function() {
|
return function() {
|
||||||
var height, width;
|
var height, pass, width;
|
||||||
height = img.height, width = img.width;
|
height = img.height, width = img.width;
|
||||||
|
pass = true;
|
||||||
if (height > QR.max_height || width > QR.max_width) {
|
if (height > QR.max_height || width > QR.max_width) {
|
||||||
QR.error("" + file.name + ": Image too large (image: " + height + "x" + width + "px, max: " + QR.max_height + "x" + QR.max_width + "px)");
|
QR.error("" + file.name + ": Image too large (image: " + height + "x" + width + "px, max: " + QR.max_height + "x" + QR.max_width + "px)");
|
||||||
return cb(false);
|
pass = false;
|
||||||
} else if (height < QR.min_height || width < QR.min_width) {
|
|
||||||
QR.error("" + file.name + ": Image too small (image: " + height + "x" + width + "px, min: " + QR.min_height + "x" + QR.min_width + "px)");
|
|
||||||
return cb(false);
|
|
||||||
} else {
|
|
||||||
return cb(true);
|
|
||||||
}
|
}
|
||||||
|
if (height < QR.min_height || width < QR.min_width) {
|
||||||
|
QR.error("" + file.name + ": Image too small (image: " + height + "x" + width + "px, min: " + QR.min_height + "x" + QR.min_width + "px)");
|
||||||
|
pass = false;
|
||||||
|
}
|
||||||
|
return cb(pass);
|
||||||
};
|
};
|
||||||
})(this);
|
})(this);
|
||||||
return img.src = URL.createObjectURL(file);
|
return img.src = URL.createObjectURL(file);
|
||||||
@ -6160,37 +6157,43 @@
|
|||||||
video = $.el('video');
|
video = $.el('video');
|
||||||
$.on(video, 'loadedmetadata', (function(_this) {
|
$.on(video, 'loadedmetadata', (function(_this) {
|
||||||
return function() {
|
return function() {
|
||||||
var duration, max_height, max_width, videoHeight, videoWidth;
|
var duration, max_height, max_width, pass, videoHeight, videoWidth;
|
||||||
if (cb == null) {
|
if (cb == null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
videoHeight = video.videoHeight, videoWidth = video.videoWidth, duration = video.duration;
|
videoHeight = video.videoHeight, videoWidth = video.videoWidth, duration = video.duration;
|
||||||
max_height = Math.min(QR.max_height, QR.max_height_video);
|
max_height = Math.min(QR.max_height, QR.max_height_video);
|
||||||
max_width = Math.min(QR.max_width, QR.max_width_video);
|
max_width = Math.min(QR.max_width, QR.max_width_video);
|
||||||
|
pass = true;
|
||||||
if (videoHeight > max_height || videoWidth > max_width) {
|
if (videoHeight > max_height || videoWidth > max_width) {
|
||||||
QR.error("" + file.name + ": Video too large (video: " + videoHeight + "x" + videoWidth + "px, max: " + max_height + "x" + max_width + "px)");
|
QR.error("" + file.name + ": Video too large (video: " + videoHeight + "x" + videoWidth + "px, max: " + max_height + "x" + max_width + "px)");
|
||||||
cb(false);
|
pass = false;
|
||||||
} else if (videoHeight < QR.min_height || videoWidth < QR.min_width) {
|
|
||||||
QR.error("" + file.name + ": Video too small (video: " + videoHeight + "x" + videoWidth + "px, min: " + QR.min_height + "x" + QR.min_width + "px)");
|
|
||||||
cb(false);
|
|
||||||
} else if (!isFinite(video.duration)) {
|
|
||||||
QR.error("" + file.name + ": Video lacks duration metadata (try remuxing)");
|
|
||||||
cb(false);
|
|
||||||
} else if (duration > QR.max_duration_video) {
|
|
||||||
QR.error("" + file.name + ": Video too long (video: " + duration + "s, max: " + QR.max_duration_video + "s)");
|
|
||||||
cb(false);
|
|
||||||
} else {
|
|
||||||
cb(true);
|
|
||||||
}
|
}
|
||||||
|
if (videoHeight < QR.min_height || videoWidth < QR.min_width) {
|
||||||
|
QR.error("" + file.name + ": Video too small (video: " + videoHeight + "x" + videoWidth + "px, min: " + QR.min_height + "x" + QR.min_width + "px)");
|
||||||
|
pass = false;
|
||||||
|
}
|
||||||
|
if (!isFinite(video.duration)) {
|
||||||
|
QR.error("" + file.name + ": Video lacks duration metadata (try remuxing)");
|
||||||
|
pass = false;
|
||||||
|
}
|
||||||
|
if (duration > QR.max_duration_video) {
|
||||||
|
QR.error("" + file.name + ": Video too long (video: " + duration + "s, max: " + QR.max_duration_video + "s)");
|
||||||
|
pass = false;
|
||||||
|
}
|
||||||
|
cb(pass);
|
||||||
return cb = null;
|
return cb = null;
|
||||||
};
|
};
|
||||||
})(this));
|
})(this));
|
||||||
$.on(video, 'error', (function(_this) {
|
$.on(video, 'error', (function(_this) {
|
||||||
return function() {
|
return function() {
|
||||||
|
var _ref;
|
||||||
if (cb == null) {
|
if (cb == null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
QR.error("" + file.name + ": Video appears corrupt");
|
if (_ref = file.type, __indexOf.call(QR.mimeTypes, _ref) >= 0) {
|
||||||
|
QR.error("" + file.name + ": Video appears corrupt");
|
||||||
|
}
|
||||||
cb(false);
|
cb(false);
|
||||||
return cb = null;
|
return cb = null;
|
||||||
};
|
};
|
||||||
@ -6280,7 +6283,7 @@
|
|||||||
}
|
}
|
||||||
rules = $('ul.rules').textContent.trim();
|
rules = $('ul.rules').textContent.trim();
|
||||||
QR.min_width = QR.min_height = 1;
|
QR.min_width = QR.min_height = 1;
|
||||||
QR.max_width = QR.max_height = 5000;
|
QR.max_width = QR.max_height = 10000;
|
||||||
try {
|
try {
|
||||||
_ref1 = rules.match(/.+smaller than (\d+)x(\d+).+/), _ = _ref1[0], QR.min_width = _ref1[1], QR.min_height = _ref1[2];
|
_ref1 = rules.match(/.+smaller than (\d+)x(\d+).+/), _ = _ref1[0], QR.min_width = _ref1[1], QR.min_height = _ref1[2];
|
||||||
_ref2 = rules.match(/.+greater than (\d+)x(\d+).+/), _ = _ref2[0], QR.max_width = _ref2[1], QR.max_height = _ref2[2];
|
_ref2 = rules.match(/.+greater than (\d+)x(\d+).+/), _ = _ref2[0], QR.max_width = _ref2[1], QR.max_height = _ref2[2];
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
<?xml version='1.0' encoding='UTF-8'?>
|
<?xml version='1.0' encoding='UTF-8'?>
|
||||||
<gupdate xmlns='http://www.google.com/update2/response' protocol='2.0'>
|
<gupdate xmlns='http://www.google.com/update2/response' protocol='2.0'>
|
||||||
<app appid='lacclbnghgdicfifcamcmcnilckjamag'>
|
<app appid='lacclbnghgdicfifcamcmcnilckjamag'>
|
||||||
<updatecheck codebase='https://ccd0.github.io/4chan-x/builds/crx.crx' version='1.7.24' />
|
<updatecheck codebase='https://ccd0.github.io/4chan-x/builds/crx.crx' version='1.7.25' />
|
||||||
</app>
|
</app>
|
||||||
</gupdate>
|
</gupdate>
|
||||||
|
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "4chan-X",
|
"name": "4chan-X",
|
||||||
"version": "1.7.24",
|
"version": "1.7.25",
|
||||||
"description": "Cross-browser userscript for maximum lurking on 4chan.",
|
"description": "Cross-browser userscript for maximum lurking on 4chan.",
|
||||||
"meta": {
|
"meta": {
|
||||||
"name": "4chan X",
|
"name": "4chan X",
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user