Merge branch 'v3' of git://github.com/MayhemYDG/4chan-x into v3
Conflicts: html/General/Settings-section-Rice.html Also renamed ColorUserIDs.coffee to IDColor.coffee to better handle IDColor conflicts between Mayhem's repo and ours
This commit is contained in:
commit
6f6766b9a0
2
LICENSE
2
LICENSE
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* 4chan X - Version 1.2.41 - 2013-10-13
|
* 4chan X - Version 1.2.41 - 2013-10-16
|
||||||
*
|
*
|
||||||
* Licensed under the MIT license.
|
* Licensed under the MIT license.
|
||||||
* https://github.com/seaweedchan/4chan-x/blob/master/LICENSE
|
* https://github.com/seaweedchan/4chan-x/blob/master/LICENSE
|
||||||
|
|||||||
@ -22,7 +22,7 @@
|
|||||||
// ==/UserScript==
|
// ==/UserScript==
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* 4chan X - Version 1.2.41 - 2013-10-13
|
* 4chan X - Version 1.2.41 - 2013-10-16
|
||||||
*
|
*
|
||||||
* Licensed under the MIT license.
|
* Licensed under the MIT license.
|
||||||
* https://github.com/seaweedchan/4chan-x/blob/master/LICENSE
|
* https://github.com/seaweedchan/4chan-x/blob/master/LICENSE
|
||||||
@ -9459,57 +9459,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']) {
|
||||||
@ -10038,32 +9987,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
|
||||||
/*
|
/*
|
||||||
* 4chan X - Version 1.2.41 - 2013-10-13
|
* 4chan X - Version 1.2.41 - 2013-10-16
|
||||||
*
|
*
|
||||||
* Licensed under the MIT license.
|
* Licensed under the MIT license.
|
||||||
* https://github.com/seaweedchan/4chan-x/blob/master/LICENSE
|
* https://github.com/seaweedchan/4chan-x/blob/master/LICENSE
|
||||||
@ -9452,57 +9452,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']) {
|
||||||
@ -10031,32 +9980,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"]
|
||||||
}]
|
}]
|
||||||
|
|||||||
@ -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
|
||||||
Loading…
x
Reference in New Issue
Block a user