Merge branch 'v3'
Conflicts: LICENSE builds/4chan-X.user.js builds/crx/script.js
This commit is contained in:
commit
c526b89c8d
@ -45,7 +45,6 @@
|
|||||||
* The QR will now warn you when you are running low on cached captchas while auto-posting.
|
* The QR will now warn you when you are running low on cached captchas while auto-posting.
|
||||||
|
|
||||||
**seaweedchan**:
|
**seaweedchan**:
|
||||||
<<<<<<< HEAD
|
|
||||||
- Gallery Bugfix: hide thumbnails
|
- Gallery Bugfix: hide thumbnails
|
||||||
|
|
||||||
**Zixaphir**:
|
**Zixaphir**:
|
||||||
@ -76,12 +75,6 @@
|
|||||||
*2013-08-21*
|
*2013-08-21*
|
||||||
|
|
||||||
**Zixaphir**:
|
**Zixaphir**:
|
||||||
=======
|
|
||||||
- Visual overhaul for gallery mode
|
|
||||||
|
|
||||||
**Zixaphir**:
|
|
||||||
- Fix an issue with the file dialog randomly opening multiple times (with seaweedchan)
|
|
||||||
>>>>>>> v3
|
|
||||||

|

|
||||||
- **New Feature**: `Gallery`.
|
- **New Feature**: `Gallery`.
|
||||||
* Disabled by default.
|
* Disabled by default.
|
||||||
|
|||||||
2
LICENSE
2
LICENSE
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* appchan x - Version 2.4.1 - 2013-10-14
|
* appchan x - Version 2.4.1 - 2013-10-16
|
||||||
*
|
*
|
||||||
* Licensed under the MIT license.
|
* Licensed under the MIT license.
|
||||||
* https://github.com/zixaphir/appchan-x/blob/master/LICENSE
|
* https://github.com/zixaphir/appchan-x/blob/master/LICENSE
|
||||||
|
|||||||
@ -20,7 +20,7 @@
|
|||||||
// ==/UserScript==
|
// ==/UserScript==
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* appchan x - Version 2.4.1 - 2013-10-14
|
* appchan x - Version 2.4.1 - 2013-10-16
|
||||||
*
|
*
|
||||||
* Licensed under the MIT license.
|
* Licensed under the MIT license.
|
||||||
* https://github.com/zixaphir/appchan-x/blob/master/LICENSE
|
* https://github.com/zixaphir/appchan-x/blob/master/LICENSE
|
||||||
@ -7097,11 +7097,56 @@
|
|||||||
},
|
},
|
||||||
MediaCrush: {
|
MediaCrush: {
|
||||||
regExp: /.*(?:mediacru.sh\/)([0-9a-z_]+)/i,
|
regExp: /.*(?:mediacru.sh\/)([0-9a-z_]+)/i,
|
||||||
style: 'border: 0; width: 640px; height: 480px; resize: both;',
|
style: 'border: 0;',
|
||||||
el: function(a) {
|
el: function(a) {
|
||||||
return $.el('iframe', {
|
var el;
|
||||||
src: "https://mediacru.sh/" + a.dataset.uid
|
|
||||||
|
el = $.el('div');
|
||||||
|
$.cache("https://mediacru.sh/" + a.dataset.uid + ".json", function() {
|
||||||
|
var embed, file, files, status, type, _i, _j, _len, _len1, _ref;
|
||||||
|
|
||||||
|
status = this.status;
|
||||||
|
if (![200, 304].contains(status)) {
|
||||||
|
return div.innerHTML = "ERROR " + status;
|
||||||
|
}
|
||||||
|
files = JSON.parse(this.response).files;
|
||||||
|
_ref = ['video/mp4', 'video/ogv', 'image/svg+xml', 'image/png', 'image/gif', 'image/jpeg', 'image/svg', 'audio/mpeg'];
|
||||||
|
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
|
||||||
|
type = _ref[_i];
|
||||||
|
for (_j = 0, _len1 = files.length; _j < _len1; _j++) {
|
||||||
|
file = files[_j];
|
||||||
|
if (file.type === type) {
|
||||||
|
embed = file;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (embed) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (!embed) {
|
||||||
|
return div.innerHTML = "ERROR: Not a valid filetype";
|
||||||
|
}
|
||||||
|
return el.innerHTML = (function() {
|
||||||
|
switch (embed.type) {
|
||||||
|
case 'video/mp4':
|
||||||
|
case 'video/ogv':
|
||||||
|
return "<video autoplay loop>\n <source src=\"https://mediacru.sh/" + a.dataset.uid + ".mp4\" type=\"video/mp4;\">\n <source src=\"https://mediacru.sh/" + a.dataset.uid + ".ogv\" type=\"video/ogg; codecs='theora, vorbis'\">\n</video>";
|
||||||
|
case 'image/png':
|
||||||
|
case 'image/gif':
|
||||||
|
case 'image/jpeg':
|
||||||
|
return "<a target=_blank href='" + a.dataset.href + "'><img src='https://mediacru.sh/" + file.file + "'></a>";
|
||||||
|
case 'image/svg':
|
||||||
|
case 'image/svg+xml':
|
||||||
|
return "<embed src='https://mediacru.sh/" + file.file + "' type='image/svg+xml' />";
|
||||||
|
case 'audio/mpeg':
|
||||||
|
return "<audio controls><source src='https://mediacru.sh/" + file.file + "'></audio>";
|
||||||
|
default:
|
||||||
|
return "ERROR: No valid filetype.";
|
||||||
|
}
|
||||||
|
})();
|
||||||
});
|
});
|
||||||
|
return el;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
pastebin: {
|
pastebin: {
|
||||||
@ -13237,57 +13282,6 @@
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
IDColor = {
|
|
||||||
init: function() {
|
|
||||||
if (g.VIEW === 'catalog' || !Conf['Color User IDs']) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
this.ids = {};
|
|
||||||
return Post.callbacks.push({
|
|
||||||
name: 'Color User IDs',
|
|
||||||
cb: this.node
|
|
||||||
});
|
|
||||||
},
|
|
||||||
node: function() {
|
|
||||||
var rgb, span, style, uid;
|
|
||||||
|
|
||||||
if (this.isClone || !(uid = this.info.uniqueID)) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
span = $('.hand', this.nodes.uniqueID);
|
|
||||||
if (!(span && span.nodeName === 'SPAN')) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
rgb = IDColor.compute(uid);
|
|
||||||
style = span.style;
|
|
||||||
style.color = rgb[3];
|
|
||||||
style.backgroundColor = "rgb(" + rgb[0] + "," + rgb[1] + "," + rgb[2] + ")";
|
|
||||||
$.addClass(span, 'painted');
|
|
||||||
return span.title = 'Highlight posts by this ID';
|
|
||||||
},
|
|
||||||
compute: function(uid) {
|
|
||||||
var hash, rgb;
|
|
||||||
|
|
||||||
if (IDColor.ids[uid]) {
|
|
||||||
return IDColor.ids[uid];
|
|
||||||
}
|
|
||||||
hash = IDColor.hash(uid);
|
|
||||||
rgb = [(hash >> 24) & 0xFF, (hash >> 16) & 0xFF, (hash >> 8) & 0xFF];
|
|
||||||
rgb[3] = (rgb[0] * 0.299 + rgb[1] * 0.587 + rgb[2] * 0.114) > 125 ? '#000' : '#fff';
|
|
||||||
return this.ids[uid] = rgb;
|
|
||||||
},
|
|
||||||
hash: function(uid) {
|
|
||||||
var i, msg;
|
|
||||||
|
|
||||||
msg = 0;
|
|
||||||
i = 0;
|
|
||||||
while (i < 8) {
|
|
||||||
msg = (msg << 5) - msg + uid.charCodeAt(i++);
|
|
||||||
}
|
|
||||||
return msg;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
CustomCSS = {
|
CustomCSS = {
|
||||||
init: function() {
|
init: function() {
|
||||||
if (!Conf['Custom CSS']) {
|
if (!Conf['Custom CSS']) {
|
||||||
@ -13761,32 +13755,35 @@
|
|||||||
if (this.isClone || !(uid = this.info.uniqueID)) {
|
if (this.isClone || !(uid = this.info.uniqueID)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
span = $('.hand', this.nodes.uniqueID);
|
||||||
|
if (!(span && span.nodeName === 'SPAN')) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
rgb = IDColor.compute(uid);
|
rgb = IDColor.compute(uid);
|
||||||
span = this.nodes.uniqueID;
|
|
||||||
style = span.style;
|
style = span.style;
|
||||||
style.color = rgb[3];
|
style.color = rgb[3];
|
||||||
style.backgroundColor = "rgb(" + rgb[0] + "," + rgb[1] + "," + rgb[2] + ")";
|
style.backgroundColor = "rgb(" + rgb[0] + "," + rgb[1] + "," + rgb[2] + ")";
|
||||||
$.addClass(span, 'painted');
|
$.addClass(span, 'painted');
|
||||||
span.textContent = uid;
|
|
||||||
return span.title = 'Highlight posts by this ID';
|
return span.title = 'Highlight posts by this ID';
|
||||||
},
|
},
|
||||||
compute: function(uniqueID) {
|
compute: function(uid) {
|
||||||
var hash, rgb;
|
var hash, rgb;
|
||||||
|
|
||||||
if (uniqueID in IDColor.ids) {
|
if (IDColor.ids[uid]) {
|
||||||
return IDColor.ids[uniqueID];
|
return IDColor.ids[uid];
|
||||||
}
|
}
|
||||||
hash = this.hash(uniqueID);
|
hash = IDColor.hash(uid);
|
||||||
rgb = [(hash >> 24) & 0xFF, (hash >> 16) & 0xFF, (hash >> 8) & 0xFF];
|
rgb = [(hash >> 24) & 0xFF, (hash >> 16) & 0xFF, (hash >> 8) & 0xFF];
|
||||||
rgb.push((rgb[0] * 0.299 + rgb[1] * 0.587 + rgb[2] * 0.114) > 170 ? 'black' : 'white');
|
rgb[3] = (rgb[0] * 0.299 + rgb[1] * 0.587 + rgb[2] * 0.114) > 125 ? '#000' : '#fff';
|
||||||
return this.ids[uniqueID] = rgb;
|
return this.ids[uid] = rgb;
|
||||||
},
|
},
|
||||||
hash: function(uniqueID) {
|
hash: function(uid) {
|
||||||
var i, msg, _i, _ref;
|
var i, msg;
|
||||||
|
|
||||||
msg = 0;
|
msg = 0;
|
||||||
for (i = _i = 0, _ref = uniqueID.length; _i < _ref; i = _i += 1) {
|
i = 0;
|
||||||
msg = (msg << 5) - msg + uniqueID.charCodeAt(i);
|
while (i < 8) {
|
||||||
|
msg = (msg << 5) - msg + uid.charCodeAt(i++);
|
||||||
}
|
}
|
||||||
return msg;
|
return msg;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
// Generated by CoffeeScript
|
// Generated by CoffeeScript
|
||||||
/*
|
/*
|
||||||
* appchan x - Version 2.4.1 - 2013-10-14
|
* appchan x - Version 2.4.1 - 2013-10-16
|
||||||
*
|
*
|
||||||
* Licensed under the MIT license.
|
* Licensed under the MIT license.
|
||||||
* https://github.com/zixaphir/appchan-x/blob/master/LICENSE
|
* https://github.com/zixaphir/appchan-x/blob/master/LICENSE
|
||||||
@ -7107,11 +7107,56 @@
|
|||||||
},
|
},
|
||||||
MediaCrush: {
|
MediaCrush: {
|
||||||
regExp: /.*(?:mediacru.sh\/)([0-9a-z_]+)/i,
|
regExp: /.*(?:mediacru.sh\/)([0-9a-z_]+)/i,
|
||||||
style: 'border: 0; width: 640px; height: 480px; resize: both;',
|
style: 'border: 0;',
|
||||||
el: function(a) {
|
el: function(a) {
|
||||||
return $.el('iframe', {
|
var el;
|
||||||
src: "https://mediacru.sh/" + a.dataset.uid
|
|
||||||
|
el = $.el('div');
|
||||||
|
$.cache("https://mediacru.sh/" + a.dataset.uid + ".json", function() {
|
||||||
|
var embed, file, files, status, type, _i, _j, _len, _len1, _ref;
|
||||||
|
|
||||||
|
status = this.status;
|
||||||
|
if (![200, 304].contains(status)) {
|
||||||
|
return div.innerHTML = "ERROR " + status;
|
||||||
|
}
|
||||||
|
files = JSON.parse(this.response).files;
|
||||||
|
_ref = ['video/mp4', 'video/ogv', 'image/svg+xml', 'image/png', 'image/gif', 'image/jpeg', 'image/svg', 'audio/mpeg'];
|
||||||
|
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
|
||||||
|
type = _ref[_i];
|
||||||
|
for (_j = 0, _len1 = files.length; _j < _len1; _j++) {
|
||||||
|
file = files[_j];
|
||||||
|
if (file.type === type) {
|
||||||
|
embed = file;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (embed) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (!embed) {
|
||||||
|
return div.innerHTML = "ERROR: Not a valid filetype";
|
||||||
|
}
|
||||||
|
return el.innerHTML = (function() {
|
||||||
|
switch (embed.type) {
|
||||||
|
case 'video/mp4':
|
||||||
|
case 'video/ogv':
|
||||||
|
return "<video autoplay loop>\n <source src=\"https://mediacru.sh/" + a.dataset.uid + ".mp4\" type=\"video/mp4;\">\n <source src=\"https://mediacru.sh/" + a.dataset.uid + ".ogv\" type=\"video/ogg; codecs='theora, vorbis'\">\n</video>";
|
||||||
|
case 'image/png':
|
||||||
|
case 'image/gif':
|
||||||
|
case 'image/jpeg':
|
||||||
|
return "<a target=_blank href='" + a.dataset.href + "'><img src='https://mediacru.sh/" + file.file + "'></a>";
|
||||||
|
case 'image/svg':
|
||||||
|
case 'image/svg+xml':
|
||||||
|
return "<embed src='https://mediacru.sh/" + file.file + "' type='image/svg+xml' />";
|
||||||
|
case 'audio/mpeg':
|
||||||
|
return "<audio controls><source src='https://mediacru.sh/" + file.file + "'></audio>";
|
||||||
|
default:
|
||||||
|
return "ERROR: No valid filetype.";
|
||||||
|
}
|
||||||
|
})();
|
||||||
});
|
});
|
||||||
|
return el;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
pastebin: {
|
pastebin: {
|
||||||
@ -13233,57 +13278,6 @@
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
IDColor = {
|
|
||||||
init: function() {
|
|
||||||
if (g.VIEW === 'catalog' || !Conf['Color User IDs']) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
this.ids = {};
|
|
||||||
return Post.callbacks.push({
|
|
||||||
name: 'Color User IDs',
|
|
||||||
cb: this.node
|
|
||||||
});
|
|
||||||
},
|
|
||||||
node: function() {
|
|
||||||
var rgb, span, style, uid;
|
|
||||||
|
|
||||||
if (this.isClone || !(uid = this.info.uniqueID)) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
span = $('.hand', this.nodes.uniqueID);
|
|
||||||
if (!(span && span.nodeName === 'SPAN')) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
rgb = IDColor.compute(uid);
|
|
||||||
style = span.style;
|
|
||||||
style.color = rgb[3];
|
|
||||||
style.backgroundColor = "rgb(" + rgb[0] + "," + rgb[1] + "," + rgb[2] + ")";
|
|
||||||
$.addClass(span, 'painted');
|
|
||||||
return span.title = 'Highlight posts by this ID';
|
|
||||||
},
|
|
||||||
compute: function(uid) {
|
|
||||||
var hash, rgb;
|
|
||||||
|
|
||||||
if (IDColor.ids[uid]) {
|
|
||||||
return IDColor.ids[uid];
|
|
||||||
}
|
|
||||||
hash = IDColor.hash(uid);
|
|
||||||
rgb = [(hash >> 24) & 0xFF, (hash >> 16) & 0xFF, (hash >> 8) & 0xFF];
|
|
||||||
rgb[3] = (rgb[0] * 0.299 + rgb[1] * 0.587 + rgb[2] * 0.114) > 125 ? '#000' : '#fff';
|
|
||||||
return this.ids[uid] = rgb;
|
|
||||||
},
|
|
||||||
hash: function(uid) {
|
|
||||||
var i, msg;
|
|
||||||
|
|
||||||
msg = 0;
|
|
||||||
i = 0;
|
|
||||||
while (i < 8) {
|
|
||||||
msg = (msg << 5) - msg + uid.charCodeAt(i++);
|
|
||||||
}
|
|
||||||
return msg;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
CustomCSS = {
|
CustomCSS = {
|
||||||
init: function() {
|
init: function() {
|
||||||
if (!Conf['Custom CSS']) {
|
if (!Conf['Custom CSS']) {
|
||||||
@ -13757,32 +13751,35 @@
|
|||||||
if (this.isClone || !(uid = this.info.uniqueID)) {
|
if (this.isClone || !(uid = this.info.uniqueID)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
span = $('.hand', this.nodes.uniqueID);
|
||||||
|
if (!(span && span.nodeName === 'SPAN')) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
rgb = IDColor.compute(uid);
|
rgb = IDColor.compute(uid);
|
||||||
span = this.nodes.uniqueID;
|
|
||||||
style = span.style;
|
style = span.style;
|
||||||
style.color = rgb[3];
|
style.color = rgb[3];
|
||||||
style.backgroundColor = "rgb(" + rgb[0] + "," + rgb[1] + "," + rgb[2] + ")";
|
style.backgroundColor = "rgb(" + rgb[0] + "," + rgb[1] + "," + rgb[2] + ")";
|
||||||
$.addClass(span, 'painted');
|
$.addClass(span, 'painted');
|
||||||
span.textContent = uid;
|
|
||||||
return span.title = 'Highlight posts by this ID';
|
return span.title = 'Highlight posts by this ID';
|
||||||
},
|
},
|
||||||
compute: function(uniqueID) {
|
compute: function(uid) {
|
||||||
var hash, rgb;
|
var hash, rgb;
|
||||||
|
|
||||||
if (uniqueID in IDColor.ids) {
|
if (IDColor.ids[uid]) {
|
||||||
return IDColor.ids[uniqueID];
|
return IDColor.ids[uid];
|
||||||
}
|
}
|
||||||
hash = this.hash(uniqueID);
|
hash = IDColor.hash(uid);
|
||||||
rgb = [(hash >> 24) & 0xFF, (hash >> 16) & 0xFF, (hash >> 8) & 0xFF];
|
rgb = [(hash >> 24) & 0xFF, (hash >> 16) & 0xFF, (hash >> 8) & 0xFF];
|
||||||
rgb.push((rgb[0] * 0.299 + rgb[1] * 0.587 + rgb[2] * 0.114) > 170 ? 'black' : 'white');
|
rgb[3] = (rgb[0] * 0.299 + rgb[1] * 0.587 + rgb[2] * 0.114) > 125 ? '#000' : '#fff';
|
||||||
return this.ids[uniqueID] = rgb;
|
return this.ids[uid] = rgb;
|
||||||
},
|
},
|
||||||
hash: function(uniqueID) {
|
hash: function(uid) {
|
||||||
var i, msg, _i, _ref;
|
var i, msg;
|
||||||
|
|
||||||
msg = 0;
|
msg = 0;
|
||||||
for (i = _i = 0, _ref = uniqueID.length; _i < _ref; i = _i += 1) {
|
i = 0;
|
||||||
msg = (msg << 5) - msg + uniqueID.charCodeAt(i);
|
while (i < 8) {
|
||||||
|
msg = (msg << 5) - msg + uid.charCodeAt(i++);
|
||||||
}
|
}
|
||||||
return msg;
|
return msg;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -5,8 +5,8 @@
|
|||||||
"http": true,
|
"http": true,
|
||||||
"https": true,
|
"https": true,
|
||||||
"software": "foolfuuka",
|
"software": "foolfuuka",
|
||||||
"boards": ["a", "co", "gd", "jp", "m", "q", "sp", "tg", "tv", "v", "vg", "vp", "vr", "wsg"],
|
"boards": ["a", "co", "gd", "jp", "m", "sp", "tg", "tv", "v", "vg", "vp", "vr", "wsg"],
|
||||||
"files": ["a", "gd", "jp", "m", "q", "tg", "vg", "vp", "vr", "wsg"]
|
"files": ["a", "gd", "jp", "m", "tg", "vg", "vp", "vr", "wsg"]
|
||||||
}, {
|
}, {
|
||||||
"uid": 1,
|
"uid": 1,
|
||||||
"name": "NSFW Foolz",
|
"name": "NSFW Foolz",
|
||||||
@ -50,8 +50,8 @@
|
|||||||
"http": true,
|
"http": true,
|
||||||
"https": true,
|
"https": true,
|
||||||
"software": "foolfuuka",
|
"software": "foolfuuka",
|
||||||
"boards": ["b", "con", "e", "h", "hc", "p", "s", "soc", "sp", "u"],
|
"boards": ["adv", "b", "cm", "d", "e", "h", "hc", "lgbt", "pol", "r", "s", "s4s", "soc", "trv", "u", "y"],
|
||||||
"files": ["b", "con", "e", "h", "hc", "p", "s", "soc", "sp", "u"]
|
"files": ["b", "cm", "d", "e", "h", "hc", "pol", "r", "s", "s4s", "soc", "u", "y"]
|
||||||
}, {
|
}, {
|
||||||
"uid": 7,
|
"uid": 7,
|
||||||
"name": "Install Gentoo",
|
"name": "Install Gentoo",
|
||||||
@ -68,8 +68,8 @@
|
|||||||
"http": true,
|
"http": true,
|
||||||
"https": true,
|
"https": true,
|
||||||
"software": "fuuka",
|
"software": "fuuka",
|
||||||
"boards": ["cgl", "con", "g", "mu", "w"],
|
"boards": ["cgl", "g", "mu", "w"],
|
||||||
"files": ["cgl", "con", "g", "mu", "w"]
|
"files": ["cgl", "g", "mu", "w"]
|
||||||
}, {
|
}, {
|
||||||
"uid": 9,
|
"uid": 9,
|
||||||
"name": "Heinessen",
|
"name": "Heinessen",
|
||||||
@ -86,8 +86,8 @@
|
|||||||
"http": true,
|
"http": true,
|
||||||
"https": true,
|
"https": true,
|
||||||
"software": "fuuka",
|
"software": "fuuka",
|
||||||
"boards": ["3", "cgl", "ck", "fa", "ic", "jp", "lit", "q", "tg", "vr"],
|
"boards": ["3", "cgl", "ck", "fa", "ic", "jp", "lit", "tg", "vr"],
|
||||||
"files": ["3", "cgl", "ck", "fa", "ic", "jp", "lit", "q", "tg", "vr"]
|
"files": ["3", "cgl", "ck", "fa", "ic", "jp", "lit", "tg", "vr"]
|
||||||
}, {
|
}, {
|
||||||
"uid": 13,
|
"uid": 13,
|
||||||
"name": "Foolz Beta",
|
"name": "Foolz Beta",
|
||||||
@ -96,6 +96,6 @@
|
|||||||
"https": true,
|
"https": true,
|
||||||
"withCredentials": true,
|
"withCredentials": true,
|
||||||
"software": "foolfuuka",
|
"software": "foolfuuka",
|
||||||
"boards": ["a", "co", "d", "gd", "h", "jp", "m", "mlp", "q", "sp", "tg", "tv", "u", "v", "vg", "vp", "vr", "wsg"],
|
"boards": ["a", "co", "d", "gd", "h", "jp", "m", "mlp", "sp", "tg", "tv", "u", "v", "vg", "vp", "vr", "wsg"],
|
||||||
"files": ["a", "d", "gd", "h", "jp", "m", "q", "tg", "u", "vg", "vp", "vr", "wsg"]
|
"files": ["a", "d", "gd", "h", "jp", "m", "tg", "u", "vg", "vp", "vr", "wsg"]
|
||||||
}]
|
}]
|
||||||
|
|||||||
@ -293,33 +293,35 @@ Linkify =
|
|||||||
|
|
||||||
MediaCrush:
|
MediaCrush:
|
||||||
regExp: /.*(?:mediacru.sh\/)([0-9a-z_]+)/i
|
regExp: /.*(?:mediacru.sh\/)([0-9a-z_]+)/i
|
||||||
style: 'border: 0; width: 640px; height: 480px; resize: both;'
|
style: 'border: 0;'
|
||||||
el: (a) ->
|
el: (a) ->
|
||||||
$.el 'iframe',
|
el = $.el 'div'
|
||||||
src: "https://mediacru.sh/#{a.dataset.uid}"
|
$.cache "https://mediacru.sh/#{a.dataset.uid}.json", ->
|
||||||
# MediaCrush CORS When?
|
{status} = @
|
||||||
#
|
return div.innerHTML = "ERROR #{status}" unless [200, 304].contains status
|
||||||
# el = $.el 'div'
|
{files} = JSON.parse @response
|
||||||
# $.cache "https://mediacru.sh/#{a.dataset.uid}.json", ->
|
for type in ['video/mp4', 'video/ogv', 'image/svg+xml', 'image/png', 'image/gif', 'image/jpeg', 'image/svg', 'audio/mpeg']
|
||||||
# {status} = @
|
for file in files
|
||||||
# return unless [200, 304].contains status
|
if file.type is type
|
||||||
# {files} = JSON.parse req.response
|
embed = file
|
||||||
# file = file for file of files when files.hasOwnProperty file
|
break
|
||||||
# el.innerHTML = switch file.type
|
break if embed
|
||||||
# when 'video/mp4', 'video/ogv'
|
return div.innerHTML = "ERROR: Not a valid filetype" unless embed
|
||||||
# """
|
el.innerHTML = switch embed.type
|
||||||
#<video autoplay loop>
|
when 'video/mp4', 'video/ogv' then """
|
||||||
# <source src="https://mediacru.sh/#{a.dataset.uid}.mp4" type="video/mp4;">
|
<video autoplay loop>
|
||||||
# <source src="https://mediacru.sh/#{a.dataset.uid}.ogv" type="video/ogg; codecs='theora, vorbis'">
|
<source src="https://mediacru.sh/#{a.dataset.uid}.mp4" type="video/mp4;">
|
||||||
#</video>"""
|
<source src="https://mediacru.sh/#{a.dataset.uid}.ogv" type="video/ogg; codecs='theora, vorbis'">
|
||||||
# when 'image/png', 'image/gif', 'image/jpeg'
|
</video>"""
|
||||||
# "<a target=_blank href='#{a.dataset.href}'><img src='https://mediacru.sh/#{file.file}'></a>"
|
when 'image/png', 'image/gif', 'image/jpeg'
|
||||||
# when 'image/svg', 'image/svg+xml'
|
"<a target=_blank href='#{a.dataset.href}'><img src='https://mediacru.sh/#{file.file}'></a>"
|
||||||
# "<embed src='https://mediacru.sh/#{file.file}' type='image/svg+xml' />"
|
when 'image/svg', 'image/svg+xml'
|
||||||
# when 'audio/mpeg'
|
"<embed src='https://mediacru.sh/#{file.file}' type='image/svg+xml' />"
|
||||||
# "<audio controls><source src='https://mediacru.sh/#{file.file}'></audio>"
|
when 'audio/mpeg'
|
||||||
# el
|
"<audio controls><source src='https://mediacru.sh/#{file.file}'></audio>"
|
||||||
|
else
|
||||||
|
"ERROR: No valid filetype."
|
||||||
|
el
|
||||||
|
|
||||||
pastebin:
|
pastebin:
|
||||||
regExp: /.*(?:pastebin.com\/(?!u\/))([^#\&\?]*).*/
|
regExp: /.*(?:pastebin.com\/(?!u\/))([^#\&\?]*).*/
|
||||||
|
|||||||
@ -1,41 +0,0 @@
|
|||||||
IDColor =
|
|
||||||
init: ->
|
|
||||||
return if g.VIEW is 'catalog' or not Conf['Color User IDs']
|
|
||||||
@ids = {}
|
|
||||||
|
|
||||||
Post.callbacks.push
|
|
||||||
name: 'Color User IDs'
|
|
||||||
cb: @node
|
|
||||||
|
|
||||||
node: ->
|
|
||||||
return if @isClone or not uid = @info.uniqueID
|
|
||||||
span = $ '.hand', @nodes.uniqueID
|
|
||||||
return unless span and span.nodeName is 'SPAN'
|
|
||||||
rgb = IDColor.compute uid
|
|
||||||
{style} = span
|
|
||||||
style.color = rgb[3]
|
|
||||||
style.backgroundColor = "rgb(#{rgb[0]},#{rgb[1]},#{rgb[2]})"
|
|
||||||
$.addClass span, 'painted'
|
|
||||||
span.title = 'Highlight posts by this ID'
|
|
||||||
|
|
||||||
compute: (uid) ->
|
|
||||||
return IDColor.ids[uid] if IDColor.ids[uid]
|
|
||||||
|
|
||||||
hash = IDColor.hash uid
|
|
||||||
rgb = [
|
|
||||||
(hash >> 24) & 0xFF
|
|
||||||
(hash >> 16) & 0xFF
|
|
||||||
(hash >> 8) & 0xFF
|
|
||||||
]
|
|
||||||
rgb[3] = if (rgb[0] * 0.299 + rgb[1] * 0.587 + rgb[2] * 0.114) > 125
|
|
||||||
'#000'
|
|
||||||
else
|
|
||||||
'#fff'
|
|
||||||
@ids[uid] = rgb
|
|
||||||
|
|
||||||
hash: (uid) ->
|
|
||||||
msg = 0
|
|
||||||
i = 0
|
|
||||||
while i < 8
|
|
||||||
msg = (msg << 5) - msg + uid.charCodeAt i++
|
|
||||||
msg
|
|
||||||
33
src/Miscellaneous/IDColor.coffee
Normal file → Executable file
33
src/Miscellaneous/IDColor.coffee
Normal file → Executable file
@ -1,6 +1,6 @@
|
|||||||
IDColor =
|
IDColor =
|
||||||
init: ->
|
init: ->
|
||||||
return if g.VIEW is 'catalog' or !Conf['Color User IDs']
|
return if g.VIEW is 'catalog' or not Conf['Color User IDs']
|
||||||
@ids = {}
|
@ids = {}
|
||||||
|
|
||||||
Post.callbacks.push
|
Post.callbacks.push
|
||||||
@ -8,33 +8,34 @@ IDColor =
|
|||||||
cb: @node
|
cb: @node
|
||||||
|
|
||||||
node: ->
|
node: ->
|
||||||
return if @isClone or !(uid = @info.uniqueID)
|
return if @isClone or not uid = @info.uniqueID
|
||||||
|
span = $ '.hand', @nodes.uniqueID
|
||||||
|
return unless span and span.nodeName is 'SPAN'
|
||||||
rgb = IDColor.compute uid
|
rgb = IDColor.compute uid
|
||||||
span = @nodes.uniqueID
|
|
||||||
{style} = span
|
{style} = span
|
||||||
style.color = rgb[3]
|
style.color = rgb[3]
|
||||||
style.backgroundColor = "rgb(#{rgb[0]},#{rgb[1]},#{rgb[2]})"
|
style.backgroundColor = "rgb(#{rgb[0]},#{rgb[1]},#{rgb[2]})"
|
||||||
$.addClass span, 'painted'
|
$.addClass span, 'painted'
|
||||||
span.textContent = uid
|
|
||||||
span.title = 'Highlight posts by this ID'
|
span.title = 'Highlight posts by this ID'
|
||||||
|
|
||||||
compute: (uniqueID) ->
|
compute: (uid) ->
|
||||||
if uniqueID of IDColor.ids
|
return IDColor.ids[uid] if IDColor.ids[uid]
|
||||||
return IDColor.ids[uniqueID]
|
|
||||||
hash = @hash uniqueID
|
hash = IDColor.hash uid
|
||||||
rgb = [
|
rgb = [
|
||||||
(hash >> 24) & 0xFF
|
(hash >> 24) & 0xFF
|
||||||
(hash >> 16) & 0xFF
|
(hash >> 16) & 0xFF
|
||||||
(hash >> 8) & 0xFF
|
(hash >> 8) & 0xFF
|
||||||
]
|
]
|
||||||
rgb.push if (rgb[0] * 0.299 + rgb[1] * 0.587 + rgb[2] * 0.114) > 170
|
rgb[3] = if (rgb[0] * 0.299 + rgb[1] * 0.587 + rgb[2] * 0.114) > 125
|
||||||
'black'
|
'#000'
|
||||||
else
|
else
|
||||||
'white'
|
'#fff'
|
||||||
@ids[uniqueID] = rgb
|
@ids[uid] = rgb
|
||||||
|
|
||||||
hash: (uniqueID) ->
|
hash: (uid) ->
|
||||||
msg = 0
|
msg = 0
|
||||||
for i in [0...uniqueID.length] by 1
|
i = 0
|
||||||
msg = (msg << 5) - msg + uniqueID.charCodeAt i
|
while i < 8
|
||||||
msg
|
msg = (msg << 5) - msg + uid.charCodeAt i++
|
||||||
|
msg
|
||||||
@ -58,4 +58,3 @@ Time =
|
|||||||
S: -> Time.zeroPad @getSeconds()
|
S: -> Time.zeroPad @getSeconds()
|
||||||
y: -> @getFullYear().toString()[2..]
|
y: -> @getFullYear().toString()[2..]
|
||||||
Y: -> @getFullYear()
|
Y: -> @getFullYear()
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user