Merge branch 'master' of https://github.com/Spittie/4chan-x into v3

Conflicts:
	CHANGELOG.md
	LICENSE
	builds/4chan-X.user.js
	builds/crx/script.js
	src/Posting/QR.coffee
This commit is contained in:
Zixaphir 2014-03-01 14:53:36 -07:00
commit 5a1bebf14d
16 changed files with 177 additions and 282 deletions

View File

@ -1,3 +1,4 @@
<<<<<<< HEAD
**MayhemYDG**:
- Thread and post hiding changes:
- The posts' menu now has a label entry listing the reasons why a post got hidden or highlighted.
@ -45,6 +46,17 @@
- Added `Original filename` variable to Sauce panel.
- Fixed a bug which prevented QR cooldowns from being pruned from storage.
- On Chrome, the storage could reach the quota and prevent 4chan X from saving data like QR name/mail or auto-watch for example.
=======
### v1.4.1
*2014-03-01*
**Spittie**
- Check image dimension before uploading
![Check image dimension](src/General/img/changelog/1.4.1.png)
- Bug fixes
- Update archives
>>>>>>> e8992deab7cecb6e54095bb760613c1cb06b88ca
## v1.4.0
*2014-02-24*

View File

@ -1,5 +1,5 @@
/*
* 4chan X - Version 1.4.0 - 2014-03-01
* 4chan X - Version 1.4.1 - 2014-03-01
*
* Licensed under the MIT license.
* https://github.com/Spittie/4chan-x/blob/master/LICENSE

View File

@ -4,9 +4,9 @@ Personal fork of Seaweed's 4chan X.
##[Install](https://github.com/Spittie/4chan-x/raw/master/builds/4chan-X.user.js) (Firefox)
##[Install](https://github.com/Spittie/4chan-x/raw/master/builds/crx.crx) (Chrom*)
##[Install](http://a.pomf.se/iazopu.xpi) (Firefox Mobile)
##[Install](http://a.pomf.se/tkhuwm.xpi) (Firefox Mobile)
## If you have any problems, try resetting your 4chan X settings before calling me a faggot (but feel free to do so)
## If you have any problems, try resetting your 4chan X settings
## Forking

View File

@ -1,6 +1,6 @@
// ==UserScript==
// @name 4chan X
// @version 1.4.0
// @version 1.4.1
// @minGMVer 1.14
// @minFFVer 26
// @namespace 4chan-X

View File

@ -1,7 +1,7 @@
// Generated by CoffeeScript
// ==UserScript==
// @name 4chan X
// @version 1.4.0
// @version 1.4.1
// @minGMVer 1.14
// @minFFVer 26
// @namespace 4chan-X
@ -24,7 +24,7 @@
// ==/UserScript==
/*
* 4chan X - Version 1.4.0 - 2014-03-01
* 4chan X - Version 1.4.1 - 2014-03-01
*
* Licensed under the MIT license.
* https://github.com/Spittie/4chan-x/blob/master/LICENSE
@ -368,7 +368,7 @@
doc = d.documentElement;
g = {
VERSION: '1.4.0',
VERSION: '1.4.1',
NAMESPACE: '4chan X.',
boards: {}
};
@ -6421,12 +6421,30 @@
QR.cleanNotifications();
for (_i = 0, _len = files.length; _i < _len; _i++) {
file = files[_i];
QR.handleFile(file, isSingle, max);
QR.checkDimensions(file, isSingle, max);
}
if (!isSingle) {
return $.addClass(QR.nodes.el, 'dump');
}
},
checkDimensions: function(file, isSingle, max) {
var img;
img = new Image();
img.onload = (function(_this) {
return function() {
var height, width;
height = img.height, width = img.width;
if (height > QR.max_heigth || width > QR.max_heigth) {
return QR.error("" + file.name + ": Image too large (image: " + img.height + "x" + img.width + "px, max: " + QR.max_heigth + "x" + QR.max_width + "px)");
}
if (height < QR.min_heigth || width < QR.min_heigth) {
return QR.error("" + file.name + ": Image too small (image: " + img.height + "x" + img.width + "px, min: " + QR.min_heigth + "x" + QR.min_width + "px)");
}
return QR.handleFile(file, isSingle, max);
};
})(this);
return img.src = URL.createObjectURL(file);
},
handleFile: function(file, isSingle, max) {
var post, _ref;
if (file.size > max) {
@ -6496,7 +6514,7 @@
return list.value = g.VIEW === 'thread' ? g.THREADID : 'new';
},
dialog: function() {
var dialog, elm, event, i, items, name, node, nodes, save, val, _i, _len, _ref;
var dialog, elm, event, i, items, name, node, nodes, rules, save, val, _, _i, _len, _ref, _ref1, _ref2;
QR.nodes = nodes = {
el: dialog = UI.dialog('qr', 'top:0;right:0;', "<div class=move><label><input type=checkbox id=autohide title=Auto-hide>Quick Reply</label><a href=javascript:; class=close title=Close>×</a><select data-name=thread title='Create a new thread / Reply'><option value=new>New thread</option></select></div><form><div class=persona><input name=name data-name=name list=\"list-name\" placeholder=Name class=field size=1 tabindex=10><input name=email data-name=email list=\"list-email\" placeholder=E-mail class=field size=1 tabindex=20><input name=sub data-name=sub list=\"list-sub\" placeholder=Subject class=field size=1 tabindex=30> </div><div class=textarea><textarea data-name=com placeholder=Comment class=field tabindex=40></textarea><span id=char-count></span></div><div id=dump-list-container><div id=dump-list></div><a id=add-post href=javascript:; title=\"Add a post\" tabindex=50>+</a></div><div id=file-n-submit><span id=qr-filename-container class=field tabindex=60><span id=qr-no-file>No selected file</span><input id=\"qr-filename\" data-name=\"filename\" spellcheck=\"false\"><span id=qr-extras-container><a id=qr-filerm href=javascript:; title='Remove file'><i class=\"fa fa-times-circle\"></i></a><a id=url-button title='Post from url'><i class=\"fa fa-link\"></i></a><a id=dump-button title='Dump list'><i class=\"fa fa-plus-square\"></i></a></span></span><label id=qr-spoiler-label><input type=checkbox id=qr-file-spoiler title='Spoiler image' tabindex=70></label><input type=submit tabindex=80></div><input type=file multiple></form><datalist id=\"list-name\"></datalist><datalist id=\"list-email\"></datalist><datalist id=\"list-sub\"></datalist> ")
};
@ -6505,6 +6523,15 @@
val = _ref[_i];
nodes[val[0]] = $(val[1], dialog);
}
rules = $('ul.rules').textContent.trim();
QR.min_width = QR.min_heigth = 1;
QR.max_width = QR.max_heigth = 5000;
try {
_ref1 = rules.match(/.+smaller than (\d+)x(\d+).+/), _ = _ref1[0], QR.min_width = _ref1[1], QR.min_heigth = _ref1[2];
_ref2 = rules.match(/.+greater than (\d+)x(\d+).+/), _ = _ref2[0], QR.max_width = _ref2[1], QR.max_heigth = _ref2[2];
} catch (_error) {
null;
}
nodes.fileInput.max = $('input[name=MAX_FILE_SIZE]').value;
QR.spoiler = !!$('input[name=spoiler]');
if (QR.spoiler) {
@ -10787,8 +10814,8 @@
archives: [
{
name: "Foolz",
boards: ["a", "biz", "co", "gd", "jp", "m", "sp", "tg", "tv", "v", "vg", "vp", "vr", "wsg"],
files: ["a", "biz", "gd", "jp", "m", "tg", "vg", "vp", "vr", "wsg"],
boards: ["a", "biz", "co", "diy", "gd", "jp", "m", "sci", "sp", "tg", "tv", "v", "vg", "vp", "vr", "wsg"],
files: ["a", "biz", "diy", "gd", "jp", "m", "sci", "tg", "vg", "vp", "vr", "wsg"],
data: {
domain: "archive.foolz.us",
http: false,
@ -10866,8 +10893,8 @@
}
}, {
name: "warosu",
boards: ["3", "cgl", "ck", "fa", "ic", "jp", "lit", "tg", "vr"],
files: ["3", "cgl", "ck", "fa", "ic", "jp", "lit", "tg", "vr"],
boards: ["3", "biz", "cgl", "ck", "diy", "fa", "g", "ic", "jp", "lit", "sci", "tg", "vr"],
files: ["3", "biz", "cgl", "ck", "diy", "fa", "ic", "jp", "lit", "sci", "tg", "vr"],
data: {
domain: "fuuka.warosu.org",
https: true,
@ -10893,7 +10920,7 @@
software: "foolfuuka"
}
}, {
name: "installgentoo.com",
name: "InstallGentoo",
boards: ["g", "t"],
files: ["g", "t"],
data: {
@ -10903,8 +10930,8 @@
}
}, {
name: "Foolz Beta",
boards: ["a", "biz", "co", "d", "gd", "jp", "m", "mlp", "s4s", "sp", "tg", "tv", "u", "v", "vg", "vp", "vr", "wsg"],
files: ["a", "biz", "d", "gd", "jp", "m", "s4s", "tg", "u", "vg", "vp", "vr", "wsg"],
boards: ["a", "biz", "co", "d", "diy", "gd", "jp", "m", "mlp", "s4s", "sci", "sp", "tg", "tv", "u", "v", "vg", "vp", "vr", "wsg"],
files: ["a", "biz", "d", "diy", "gd", "jp", "m", "s4s", "sci", "tg", "u", "vg", "vp", "vr", "wsg"],
data: {
domain: "beta.foolz.us",
http: true,

Binary file not shown.

View File

@ -1,6 +1,6 @@
{
"name": "4chan X",
"version": "1.4.0",
"version": "1.4.1",
"manifest_version": 2,
"description": "Cross-browser userscript for maximum lurking on 4chan.",
"icons": {

View File

@ -1,6 +1,6 @@
// Generated by CoffeeScript
/*
* 4chan X - Version 1.4.0 - 2014-03-01
* 4chan X - Version 1.4.1 - 2014-03-01
*
* Licensed under the MIT license.
* https://github.com/Spittie/4chan-x/blob/master/LICENSE
@ -344,7 +344,7 @@
doc = d.documentElement;
g = {
VERSION: '1.4.0',
VERSION: '1.4.1',
NAMESPACE: '4chan X.',
boards: {}
};
@ -6475,12 +6475,30 @@
QR.cleanNotifications();
for (_i = 0, _len = files.length; _i < _len; _i++) {
file = files[_i];
QR.handleFile(file, isSingle, max);
QR.checkDimensions(file, isSingle, max);
}
if (!isSingle) {
return $.addClass(QR.nodes.el, 'dump');
}
},
checkDimensions: function(file, isSingle, max) {
var img;
img = new Image();
img.onload = (function(_this) {
return function() {
var height, width;
height = img.height, width = img.width;
if (height > QR.max_heigth || width > QR.max_heigth) {
return QR.error("" + file.name + ": Image too large (image: " + img.height + "x" + img.width + "px, max: " + QR.max_heigth + "x" + QR.max_width + "px)");
}
if (height < QR.min_heigth || width < QR.min_heigth) {
return QR.error("" + file.name + ": Image too small (image: " + img.height + "x" + img.width + "px, min: " + QR.min_heigth + "x" + QR.min_width + "px)");
}
return QR.handleFile(file, isSingle, max);
};
})(this);
return img.src = URL.createObjectURL(file);
},
handleFile: function(file, isSingle, max) {
var post, _ref;
if (file.size > max) {
@ -6550,7 +6568,7 @@
return list.value = g.VIEW === 'thread' ? g.THREADID : 'new';
},
dialog: function() {
var dialog, elm, event, i, items, name, node, nodes, save, val, _i, _len, _ref;
var dialog, elm, event, i, items, name, node, nodes, rules, save, val, _, _i, _len, _ref, _ref1, _ref2;
QR.nodes = nodes = {
el: dialog = UI.dialog('qr', 'top:0;right:0;', "<div class=move><label><input type=checkbox id=autohide title=Auto-hide>Quick Reply</label><a href=javascript:; class=close title=Close>×</a><select data-name=thread title='Create a new thread / Reply'><option value=new>New thread</option></select></div><form><div class=persona><input name=name data-name=name list=\"list-name\" placeholder=Name class=field size=1 tabindex=10><input name=email data-name=email list=\"list-email\" placeholder=E-mail class=field size=1 tabindex=20><input name=sub data-name=sub list=\"list-sub\" placeholder=Subject class=field size=1 tabindex=30> </div><div class=textarea><textarea data-name=com placeholder=Comment class=field tabindex=40></textarea><span id=char-count></span></div><div id=dump-list-container><div id=dump-list></div><a id=add-post href=javascript:; title=\"Add a post\" tabindex=50>+</a></div><div id=file-n-submit><span id=qr-filename-container class=field tabindex=60><span id=qr-no-file>No selected file</span><input id=\"qr-filename\" data-name=\"filename\" spellcheck=\"false\"><span id=qr-extras-container><a id=qr-filerm href=javascript:; title='Remove file'><i class=\"fa fa-times-circle\"></i></a><a id=url-button title='Post from url'><i class=\"fa fa-link\"></i></a><a id=dump-button title='Dump list'><i class=\"fa fa-plus-square\"></i></a></span></span><label id=qr-spoiler-label><input type=checkbox id=qr-file-spoiler title='Spoiler image' tabindex=70></label><input type=submit tabindex=80></div><input type=file multiple></form><datalist id=\"list-name\"></datalist><datalist id=\"list-email\"></datalist><datalist id=\"list-sub\"></datalist> ")
};
@ -6559,6 +6577,15 @@
val = _ref[_i];
nodes[val[0]] = $(val[1], dialog);
}
rules = $('ul.rules').textContent.trim();
QR.min_width = QR.min_heigth = 1;
QR.max_width = QR.max_heigth = 5000;
try {
_ref1 = rules.match(/.+smaller than (\d+)x(\d+).+/), _ = _ref1[0], QR.min_width = _ref1[1], QR.min_heigth = _ref1[2];
_ref2 = rules.match(/.+greater than (\d+)x(\d+).+/), _ = _ref2[0], QR.max_width = _ref2[1], QR.max_heigth = _ref2[2];
} catch (_error) {
null;
}
nodes.fileInput.max = $('input[name=MAX_FILE_SIZE]').value;
QR.spoiler = !!$('input[name=spoiler]');
if (QR.spoiler) {
@ -10801,8 +10828,8 @@
archives: [
{
name: "Foolz",
boards: ["a", "biz", "co", "gd", "jp", "m", "sp", "tg", "tv", "v", "vg", "vp", "vr", "wsg"],
files: ["a", "biz", "gd", "jp", "m", "tg", "vg", "vp", "vr", "wsg"],
boards: ["a", "biz", "co", "diy", "gd", "jp", "m", "sci", "sp", "tg", "tv", "v", "vg", "vp", "vr", "wsg"],
files: ["a", "biz", "diy", "gd", "jp", "m", "sci", "tg", "vg", "vp", "vr", "wsg"],
data: {
domain: "archive.foolz.us",
http: false,
@ -10880,8 +10907,8 @@
}
}, {
name: "warosu",
boards: ["3", "cgl", "ck", "fa", "ic", "jp", "lit", "tg", "vr"],
files: ["3", "cgl", "ck", "fa", "ic", "jp", "lit", "tg", "vr"],
boards: ["3", "biz", "cgl", "ck", "diy", "fa", "g", "ic", "jp", "lit", "sci", "tg", "vr"],
files: ["3", "biz", "cgl", "ck", "diy", "fa", "ic", "jp", "lit", "sci", "tg", "vr"],
data: {
domain: "fuuka.warosu.org",
https: true,
@ -10907,7 +10934,7 @@
software: "foolfuuka"
}
}, {
name: "installgentoo.com",
name: "InstallGentoo",
boards: ["g", "t"],
files: ["g", "t"],
data: {
@ -10917,8 +10944,8 @@
}
}, {
name: "Foolz Beta",
boards: ["a", "biz", "co", "d", "gd", "jp", "m", "mlp", "s4s", "sp", "tg", "tv", "u", "v", "vg", "vp", "vr", "wsg"],
files: ["a", "biz", "d", "gd", "jp", "m", "s4s", "tg", "u", "vg", "vp", "vr", "wsg"],
boards: ["a", "biz", "co", "d", "diy", "gd", "jp", "m", "mlp", "s4s", "sci", "sp", "tg", "tv", "u", "v", "vg", "vp", "vr", "wsg"],
files: ["a", "biz", "d", "diy", "gd", "jp", "m", "s4s", "sci", "tg", "u", "vg", "vp", "vr", "wsg"],
data: {
domain: "beta.foolz.us",
http: true,

Binary file not shown.

View File

@ -1,7 +1,7 @@
// Generated by CoffeeScript
// ==UserScript==
// @name 4chan X
// @version 1.4.0
// @version 1.4.1
// @minGMVer 1.14
// @minFFVer 26
// @namespace 4chan-X
@ -24,7 +24,7 @@
// ==/UserScript==
/*
* 4chan X - Version 1.4.0 - 2014-02-24
* 4chan X - Version 1.4.1 - 2014-03-01
*
* Licensed under the MIT license.
* https://github.com/Spittie/4chan-x/blob/master/LICENSE
@ -364,7 +364,7 @@
doc = d.documentElement;
g = {
VERSION: '1.4.0',
VERSION: '1.4.1',
NAMESPACE: '4chan X.',
boards: {}
};
@ -2540,7 +2540,7 @@
return Math.max(0, Index.getPagesNum() - 1);
},
togglePagelist: function() {
return Index.pagelist.hidden = Conf['Index Mode'] === 'all pages';
return Index.pagelist.hidden = Conf['Index Mode'] !== 'paged';
},
buildPagelist: function() {
var a, i, maxPageNum, nodes, pagesRoot, _i;
@ -5664,7 +5664,10 @@
return {
catalog: function() {
if (Conf["Persistent QR"]) {
return QR.open();
QR.open();
}
if (Conf['Auto Hide QR']) {
return QR.hide();
}
},
index: function() {
@ -5985,12 +5988,29 @@
QR.cleanNotifications();
for (_i = 0, _len = files.length; _i < _len; _i++) {
file = files[_i];
QR.handleFile(file, isSingle, max);
QR.checkDimensions(file, isSingle, max);
}
if (!isSingle) {
return $.addClass(QR.nodes.el, 'dump');
}
},
checkDimensions: function(file, isSingle, max) {
var img,
_this = this;
img = new Image();
img.onload = function() {
var height, width;
height = img.height, width = img.width;
if (height > QR.max_heigth || width > QR.max_heigth) {
return QR.error("" + file.name + ": Image too large (image: " + img.height + "x" + img.width + "px, max: " + QR.max_heigth + "x" + QR.max_width + "px)");
}
if (height < QR.min_heigth || width < QR.min_heigth) {
return QR.error("" + file.name + ": Image too small (image: " + img.height + "x" + img.width + "px, min: " + QR.min_heigth + "x" + QR.min_width + "px)");
}
return QR.handleFile(file, isSingle, max);
};
return img.src = URL.createObjectURL(file);
},
handleFile: function(file, isSingle, max) {
var post, _ref;
if (file.size > max) {
@ -6060,7 +6080,7 @@
return list.value = g.VIEW === 'thread' ? g.THREADID : 'new';
},
dialog: function() {
var dialog, elm, event, i, items, key, name, node, nodes, save, value, _ref;
var dialog, elm, event, i, items, key, max_heigth, max_width, min_heigth, min_width, name, node, nodes, rules, save, tmp_dim, value, _ref;
QR.nodes = nodes = {
el: dialog = UI.dialog('qr', 'top:0;right:0;', "<div class=move><label><input type=checkbox id=autohide title=Auto-hide>Quick Reply</label><a href=javascript:; class=close title=Close>×</a><select data-name=thread title='Create a new thread / Reply'><option value=new>New thread</option></select></div><form><div class=persona><input name=name data-name=name list=\"list-name\" placeholder=Name class=field size=1 tabindex=10><input name=email data-name=email list=\"list-email\" placeholder=E-mail class=field size=1 tabindex=20><input name=sub data-name=sub list=\"list-sub\" placeholder=Subject class=field size=1 tabindex=30> </div><div class=textarea><textarea data-name=com placeholder=Comment class=field tabindex=40></textarea><span id=char-count></span></div><div id=dump-list-container><div id=dump-list></div><a id=add-post href=javascript:; title=\"Add a post\" tabindex=50>+</a></div><div id=file-n-submit><span id=qr-filename-container class=field tabindex=60><span id=qr-no-file>No selected file</span><input id=\"qr-filename\" data-name=\"filename\" spellcheck=\"false\"><span id=qr-extras-container><a id=qr-filerm href=javascript:; title='Remove file'><i class=\"fa fa-times-circle\"></i></a><a id=url-button title='Post from url'><i class=\"fa fa-link\"></i></a><a id=dump-button title='Dump list'><i class=\"fa fa-plus-square\"></i></a></span></span><label id=qr-spoiler-label><input type=checkbox id=qr-file-spoiler title='Spoiler image' tabindex=70></label><input type=submit tabindex=80></div><input type=file multiple></form><datalist id=\"list-name\"></datalist><datalist id=\"list-email\"></datalist><datalist id=\"list-sub\"></datalist> ")
};
@ -6094,6 +6114,23 @@
value = _ref[key];
nodes[key] = $(value, dialog);
}
rules = $('ul.rules').textContent.trim();
try {
tmp_dim = rules.match(/.+smaller than (\d+)x(\d+).+/);
min_width = tmp_dim[1];
min_heigth = tmp_dim[2];
} catch (_error) {
min_width = 1;
min_heigth = 1;
}
try {
tmp_dim = rules.match(/.+greater than (\d+)x(\d+).+/);
max_width = tmp_dim[1];
max_heigth = tmp_dim[2];
} catch (_error) {
QR.max_width = 5000;
QR.max_heigth = 5000;
}
nodes.fileInput.max = $('input[name=MAX_FILE_SIZE]').value;
QR.spoiler = !!$('input[name=spoiler]');
if (QR.spoiler) {
@ -6346,6 +6383,8 @@
if (/captcha|verification/i.test(err.textContent) || err === 'Connection error with sys.4chan.org.') {
if (/mistyped/i.test(err.textContent)) {
err = 'You seem to have mistyped the CAPTCHA.';
} else if (/expired/i.test(err.textContent)) {
err = 'This CAPTCHA is no longer valid because it has expired.';
}
QR.cooldown.auto = QR.captcha.isEnabled ? !!QR.captcha.captchas.length : err === 'Connection error with sys.4chan.org.' ? true : false;
QR.cooldown.set({
@ -10303,8 +10342,8 @@
archives: [
{
name: "Foolz",
boards: ["a", "biz", "co", "gd", "jp", "m", "sp", "tg", "tv", "v", "vg", "vp", "vr", "wsg"],
files: ["a", "biz", "gd", "jp", "m", "tg", "vg", "vp", "vr", "wsg"],
boards: ["a", "biz", "co", "diy", "gd", "jp", "m", "sci", "sp", "tg", "tv", "v", "vg", "vp", "vr", "wsg"],
files: ["a", "biz", "diy", "gd", "jp", "m", "sci", "tg", "vg", "vp", "vr", "wsg"],
data: {
domain: "archive.foolz.us",
http: false,
@ -10382,8 +10421,8 @@
}
}, {
name: "warosu",
boards: ["3", "cgl", "ck", "fa", "ic", "jp", "lit", "tg", "vr"],
files: ["3", "cgl", "ck", "fa", "ic", "jp", "lit", "tg", "vr"],
boards: ["3", "biz", "cgl", "ck", "diy", "fa", "g", "ic", "jp", "lit", "sci", "tg", "vr"],
files: ["3", "biz", "cgl", "ck", "diy", "fa", "ic", "jp", "lit", "sci", "tg", "vr"],
data: {
domain: "fuuka.warosu.org",
https: true,
@ -10409,7 +10448,7 @@
software: "foolfuuka"
}
}, {
name: "installgentoo.com",
name: "InstallGentoo",
boards: ["g", "t"],
files: ["g", "t"],
data: {
@ -10419,236 +10458,8 @@
}
}, {
name: "Foolz Beta",
boards: ["a", "biz", "co", "d", "gd", "jp", "m", "mlp", "s4s", "sp", "tg", "tv", "u", "v", "vg", "vp", "vr", "wsg"],
files: ["a", "biz", "d", "gd", "jp", "m", "s4s", "tg", "u", "vg", "vp", "vr", "wsg"],
data: {
domain: "beta.foolz.us",
http: true,
https: true,
withCredentials: true,
software: "foolfuuka"
}
}
],
to: function(dest, data) {
var archive;
archive = (dest === 'search' ? Redirect.data.thread : Redirect.data[dest])[data.boardID];
if (!archive) {
return '';
}
return Redirect[dest](archive, data);
},
protocol: function(archive) {
var protocol;
protocol = location.protocol;
if (!archive[protocol.slice(0, -1)]) {
protocol = protocol === 'https:' ? 'http:' : 'https:';
}
return "" + protocol + "//";
},
thread: function(archive, _arg) {
var boardID, path, postID, threadID;
boardID = _arg.boardID, threadID = _arg.threadID, postID = _arg.postID;
path = threadID ? "" + boardID + "/thread/" + threadID : "" + boardID + "/post/" + postID;
if (archive.software === 'foolfuuka') {
path += '/';
}
if (threadID && postID) {
path += archive.software === 'foolfuuka' ? "#" + postID : "#p" + postID;
}
return "" + (Redirect.protocol(archive)) + archive.domain + "/" + path;
},
post: function(archive, _arg) {
var URL, boardID, postID;
boardID = _arg.boardID, postID = _arg.postID;
URL = new String("" + (Redirect.protocol(archive)) + archive.domain + "/_/api/chan/post/?board=" + boardID + "&num=" + postID);
URL.archive = archive;
return URL;
},
file: function(archive, _arg) {
var boardID, filename;
boardID = _arg.boardID, filename = _arg.filename;
return "" + (Redirect.protocol(archive)) + archive.domain + "/" + boardID + "/full_image/" + filename;
},
search: function(archive, _arg) {
var boardID, path, type, value;
boardID = _arg.boardID, type = _arg.type, value = _arg.value;
type = type === 'name' ? 'username' : type === 'MD5' ? 'image' : type;
value = encodeURIComponent(value);
path = archive.software === 'foolfuuka' ? "" + boardID + "/search/" + type + "/" + value : "" + boardID + "/?task=search2&search_" + (type === 'image' ? 'media_hash' : type) + "=" + value;
return "" + (Redirect.protocol(archive)) + archive.domain + "/" + path;
}
};
Redirect = {
init: function() {
var archive, archives, boardID, boards, data, files, id, name, o, record, software, type, _i, _j, _len, _len1, _ref, _ref1, _ref2;
o = {
thread: {},
post: {},
file: {}
};
archives = {};
_ref = Redirect.archives;
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
_ref1 = _ref[_i], name = _ref1.name, boards = _ref1.boards, files = _ref1.files, data = _ref1.data;
archives[name] = {
boards: boards,
files: files,
data: data
};
software = data.software;
for (_j = 0, _len1 = boards.length; _j < _len1; _j++) {
boardID = boards[_j];
if (!(boardID in o.thread)) {
o.thread[boardID] = data;
}
if (!(boardID in o.post || software !== 'foolfuuka')) {
o.post[boardID] = data;
}
if (!(boardID in o.file || __indexOf.call(files, boardID) < 0)) {
o.file[boardID] = data;
}
}
}
_ref2 = Conf['selectedArchives'];
for (boardID in _ref2) {
record = _ref2[boardID];
for (type in record) {
id = record[type];
if (!((archive = archives[id]))) {
continue;
}
boards = type === 'file' ? archive.files : archive.boards;
if (__indexOf.call(boards, boardID) < 0) {
continue;
}
o[type][boardID] = archive.data;
}
}
return Redirect.data = o;
},
archives: [
{
name: "Foolz",
boards: ["a", "biz", "co", "gd", "jp", "m", "sp", "tg", "tv", "v", "vg", "vp", "vr", "wsg"],
files: ["a", "biz", "gd", "jp", "m", "tg", "vg", "vp", "vr", "wsg"],
data: {
domain: "archive.foolz.us",
http: false,
https: true,
software: "foolfuuka"
}
}, {
name: "NSFW Foolz",
boards: ["u"],
files: ["u"],
data: {
domain: "nsfw.foolz.us",
http: false,
https: true,
software: "foolfuuka"
}
}, {
name: "The Dark Cave",
boards: ["c", "int", "out", "po"],
files: ["c", "po"],
data: {
domain: "archive.thedarkcave.org",
http: true,
https: true,
software: "foolfuuka"
}
}, {
name: "4plebs",
boards: ["adv", "hr", "o", "pol", "s4s", "tg", "tv", "x"],
files: ["adv", "hr", "o", "pol", "s4s", "tg", "tv", "x"],
data: {
domain: "archive.4plebs.org",
http: true,
https: true,
software: "foolfuuka"
}
}, {
name: "Nyafuu",
boards: ["c", "e", "w", "wg"],
files: ["c", "e", "w", "wg"],
data: {
domain: "archive.nyafuu.org",
http: true,
https: true,
software: "foolfuuka"
}
}, {
name: "Love is Over",
boards: ["d", "i"],
files: ["d", "i"],
data: {
domain: "loveisover.me",
http: true,
https: true,
software: "foolfuuka"
}
}, {
name: "Rebecca Black Tech",
boards: ["cgl", "g", "mu", "w"],
files: ["cgl", "g", "mu", "w"],
data: {
domain: "archive.rebeccablacktech.com",
http: true,
https: true,
software: "fuuka"
}
}, {
name: "Heinessen",
boards: ["an", "fit", "k", "mlp", "r9k", "toy"],
files: ["an", "fit", "k", "r9k", "toy"],
data: {
domain: "archive.heinessen.com",
http: true,
software: "fuuka"
}
}, {
name: "warosu",
boards: ["3", "cgl", "ck", "fa", "ic", "jp", "lit", "tg", "vr"],
files: ["3", "cgl", "ck", "fa", "ic", "jp", "lit", "tg", "vr"],
data: {
domain: "fuuka.warosu.org",
https: true,
software: "fuuka"
}
}, {
name: "fgts",
boards: ["r", "soc"],
files: ["r", "soc"],
data: {
domain: "fgst.eu",
http: true,
https: true,
software: "foolfuuka"
}
}, {
name: "maware",
boards: ["t"],
files: ["t"],
data: {
domain: "archive.mawa.re",
http: true,
software: "foolfuuka"
}
}, {
name: "installgentoo.com",
boards: ["g", "t"],
files: ["g", "t"],
data: {
domain: "chan.installgentoo.com",
http: true,
software: "foolfuuka"
}
}, {
name: "Foolz Beta",
boards: ["a", "biz", "co", "d", "gd", "jp", "m", "mlp", "s4s", "sp", "tg", "tv", "u", "v", "vg", "vp", "vr", "wsg"],
files: ["a", "biz", "d", "gd", "jp", "m", "s4s", "tg", "u", "vg", "vp", "vr", "wsg"],
boards: ["a", "biz", "co", "d", "diy", "gd", "jp", "m", "mlp", "s4s", "sci", "sp", "tg", "tv", "u", "v", "vg", "vp", "vr", "wsg"],
files: ["a", "biz", "d", "diy", "gd", "jp", "m", "s4s", "sci", "tg", "u", "vg", "vp", "vr", "wsg"],
data: {
domain: "beta.foolz.us",
http: true,
@ -12622,7 +12433,7 @@
},
navigate: function(e) {
var boardID, load, pageNum, path, threadID, view;
if (this.hostname !== 'boards.4chan.org' || window.location.hostname === 'rs.4chan.org' || (e && (e.shiftKey || (e.type === 'click' && e.button !== 0)))) {
if (this.hostname !== 'boards.4chan.org' || window.location.hostname === 'rs.4chan.org' || (e && (e.shiftKey || e.ctrlKey || (e.type === 'click' && e.button !== 0)))) {
return;
}
$.addClass(Index.button, 'fa-spin');

View File

@ -5,5 +5,5 @@
"description": "Adds various features to 4chan.",
"author": "Spittie",
"license": "MIT",
"version": "1.3.7"
"version": "1.4.1"
}

View File

@ -1 +1 @@
postMessage({version:'1.4.0'},'*')
postMessage({version:'1.4.1'},'*')

View File

@ -1,6 +1,6 @@
{
"name": "4chan-X",
"version": "1.4.0",
"version": "1.4.1",
"description": "Cross-browser userscript for maximum lurking on 4chan.",
"meta": {
"name": "4chan X",

View File

@ -24,8 +24,8 @@ Redirect =
archives: [
name: "Foolz"
boards: ["a", "biz","co", "gd", "jp", "m", "sp", "tg", "tv", "v", "vg", "vp", "vr", "wsg"]
files: ["a", "biz","gd", "jp", "m", "tg", "vg", "vp", "vr", "wsg"]
boards: ["a", "biz", "co", "diy", "gd", "jp", "m", "sci", "sp", "tg", "tv", "v", "vg", "vp", "vr", "wsg"]
files: ["a", "biz", "diy", "gd", "jp", "m", "sci", "tg", "vg", "vp", "vr", "wsg"]
data:
domain: "archive.foolz.us"
http: false
@ -95,8 +95,8 @@ Redirect =
software: "fuuka"
,
name: "warosu"
boards: ["3", "cgl", "ck", "fa", "ic", "jp", "lit", "tg", "vr"]
files: ["3", "cgl", "ck", "fa", "ic", "jp", "lit", "tg", "vr"]
boards: ["3", "biz", "cgl", "ck", "diy", "fa", "g", "ic", "jp", "lit", "sci", "tg", "vr"]
files: ["3", "biz", "cgl", "ck", "diy", "fa", "ic", "jp", "lit", "sci", "tg", "vr"]
data:
domain: "fuuka.warosu.org"
https: true
@ -119,7 +119,7 @@ Redirect =
http: true
software: "foolfuuka"
,
name: "installgentoo.com"
name: "InstallGentoo"
boards: ["g", "t"]
files: ["g", "t"]
data:
@ -128,8 +128,8 @@ Redirect =
software: "foolfuuka"
,
name: "Foolz Beta"
boards: ["a", "biz", "co", "d", "gd", "jp", "m", "mlp", "s4s", "sp", "tg", "tv", "u", "v", "vg", "vp", "vr", "wsg"],
files: ["a", "biz", "d", "gd", "jp", "m", "s4s", "tg", "u", "vg", "vp", "vr", "wsg"]
boards: ["a", "biz", "co", "d", "diy", "gd", "jp", "m", "mlp", "s4s", "sci", "sp", "tg", "tv", "u", "v", "vg", "vp", "vr", "wsg"],
files: ["a", "biz", "d", "diy", "gd", "jp", "m", "s4s", "sci", "tg", "u", "vg", "vp", "vr", "wsg"]
data:
domain: "beta.foolz.us"
http: true

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.8 KiB

View File

@ -378,9 +378,18 @@ QR =
isSingle = files.length is 1
QR.cleanNotifications()
for file in files
QR.handleFile file, isSingle, max
QR.checkDimensions file, isSingle, max
$.addClass QR.nodes.el, 'dump' unless isSingle
checkDimensions: (file, isSingle, max) ->
img = new Image()
img.onload = =>
{height, width} = img
return QR.error "#{file.name}: Image too large (image: #{img.height}x#{img.width}px, max: #{QR.max_heigth}x#{QR.max_width}px)" if height > QR.max_heigth or width > QR.max_heigth
return QR.error "#{file.name}: Image too small (image: #{img.height}x#{img.width}px, min: #{QR.min_heigth}x#{QR.min_width}px)" if height < QR.min_heigth or width < QR.min_heigth
QR.handleFile file, isSingle, max
img.src = URL.createObjectURL file
handleFile: (file, isSingle, max) ->
if file.size > max
QR.error "#{file.name}: File too large (file: #{$.bytesToString file.size}, max: #{$.bytesToString max})."
@ -462,6 +471,15 @@ QR =
['status', '[type=submit]']
['fileInput', '[type=file]']
]
rules = $('ul.rules').textContent.trim()
QR.min_width = QR.min_heigth = 1
QR.max_width = QR.max_heigth = 5000
try
[_, QR.min_width, QR.min_heigth] = rules.match(/.+smaller than (\d+)x(\d+).+/)
[_, QR.max_width, QR.max_heigth] = rules.match(/.+greater than (\d+)x(\d+).+/)
catch
null
nodes.fileInput.max = $('input[name=MAX_FILE_SIZE]').value