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.
|
||||
* https://github.com/seaweedchan/4chan-x/blob/master/LICENSE
|
||||
|
||||
@ -22,7 +22,7 @@
|
||||
// ==/UserScript==
|
||||
|
||||
/*
|
||||
* 4chan X - Version 1.2.41 - 2013-10-13
|
||||
* 4chan X - Version 1.2.41 - 2013-10-16
|
||||
*
|
||||
* Licensed under the MIT 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 = {
|
||||
init: function() {
|
||||
if (!Conf['Custom CSS']) {
|
||||
@ -10038,32 +9987,35 @@
|
||||
if (this.isClone || !(uid = this.info.uniqueID)) {
|
||||
return;
|
||||
}
|
||||
span = $('.hand', this.nodes.uniqueID);
|
||||
if (!(span && span.nodeName === 'SPAN')) {
|
||||
return;
|
||||
}
|
||||
rgb = IDColor.compute(uid);
|
||||
span = this.nodes.uniqueID;
|
||||
style = span.style;
|
||||
style.color = rgb[3];
|
||||
style.backgroundColor = "rgb(" + rgb[0] + "," + rgb[1] + "," + rgb[2] + ")";
|
||||
$.addClass(span, 'painted');
|
||||
span.textContent = uid;
|
||||
return span.title = 'Highlight posts by this ID';
|
||||
},
|
||||
compute: function(uniqueID) {
|
||||
compute: function(uid) {
|
||||
var hash, rgb;
|
||||
|
||||
if (uniqueID in IDColor.ids) {
|
||||
return IDColor.ids[uniqueID];
|
||||
if (IDColor.ids[uid]) {
|
||||
return IDColor.ids[uid];
|
||||
}
|
||||
hash = this.hash(uniqueID);
|
||||
hash = IDColor.hash(uid);
|
||||
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');
|
||||
return this.ids[uniqueID] = rgb;
|
||||
rgb[3] = (rgb[0] * 0.299 + rgb[1] * 0.587 + rgb[2] * 0.114) > 125 ? '#000' : '#fff';
|
||||
return this.ids[uid] = rgb;
|
||||
},
|
||||
hash: function(uniqueID) {
|
||||
var i, msg, _i, _ref;
|
||||
hash: function(uid) {
|
||||
var i, msg;
|
||||
|
||||
msg = 0;
|
||||
for (i = _i = 0, _ref = uniqueID.length; _i < _ref; i = _i += 1) {
|
||||
msg = (msg << 5) - msg + uniqueID.charCodeAt(i);
|
||||
i = 0;
|
||||
while (i < 8) {
|
||||
msg = (msg << 5) - msg + uid.charCodeAt(i++);
|
||||
}
|
||||
return msg;
|
||||
}
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
// 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.
|
||||
* 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 = {
|
||||
init: function() {
|
||||
if (!Conf['Custom CSS']) {
|
||||
@ -10031,32 +9980,35 @@
|
||||
if (this.isClone || !(uid = this.info.uniqueID)) {
|
||||
return;
|
||||
}
|
||||
span = $('.hand', this.nodes.uniqueID);
|
||||
if (!(span && span.nodeName === 'SPAN')) {
|
||||
return;
|
||||
}
|
||||
rgb = IDColor.compute(uid);
|
||||
span = this.nodes.uniqueID;
|
||||
style = span.style;
|
||||
style.color = rgb[3];
|
||||
style.backgroundColor = "rgb(" + rgb[0] + "," + rgb[1] + "," + rgb[2] + ")";
|
||||
$.addClass(span, 'painted');
|
||||
span.textContent = uid;
|
||||
return span.title = 'Highlight posts by this ID';
|
||||
},
|
||||
compute: function(uniqueID) {
|
||||
compute: function(uid) {
|
||||
var hash, rgb;
|
||||
|
||||
if (uniqueID in IDColor.ids) {
|
||||
return IDColor.ids[uniqueID];
|
||||
if (IDColor.ids[uid]) {
|
||||
return IDColor.ids[uid];
|
||||
}
|
||||
hash = this.hash(uniqueID);
|
||||
hash = IDColor.hash(uid);
|
||||
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');
|
||||
return this.ids[uniqueID] = rgb;
|
||||
rgb[3] = (rgb[0] * 0.299 + rgb[1] * 0.587 + rgb[2] * 0.114) > 125 ? '#000' : '#fff';
|
||||
return this.ids[uid] = rgb;
|
||||
},
|
||||
hash: function(uniqueID) {
|
||||
var i, msg, _i, _ref;
|
||||
hash: function(uid) {
|
||||
var i, msg;
|
||||
|
||||
msg = 0;
|
||||
for (i = _i = 0, _ref = uniqueID.length; _i < _ref; i = _i += 1) {
|
||||
msg = (msg << 5) - msg + uniqueID.charCodeAt(i);
|
||||
i = 0;
|
||||
while (i < 8) {
|
||||
msg = (msg << 5) - msg + uid.charCodeAt(i++);
|
||||
}
|
||||
return msg;
|
||||
}
|
||||
|
||||
@ -5,8 +5,8 @@
|
||||
"http": true,
|
||||
"https": true,
|
||||
"software": "foolfuuka",
|
||||
"boards": ["a", "co", "gd", "jp", "m", "q", "sp", "tg", "tv", "v", "vg", "vp", "vr", "wsg"],
|
||||
"files": ["a", "gd", "jp", "m", "q", "tg", "vg", "vp", "vr", "wsg"]
|
||||
"boards": ["a", "co", "gd", "jp", "m", "sp", "tg", "tv", "v", "vg", "vp", "vr", "wsg"],
|
||||
"files": ["a", "gd", "jp", "m", "tg", "vg", "vp", "vr", "wsg"]
|
||||
}, {
|
||||
"uid": 1,
|
||||
"name": "NSFW Foolz",
|
||||
@ -50,8 +50,8 @@
|
||||
"http": true,
|
||||
"https": true,
|
||||
"software": "foolfuuka",
|
||||
"boards": ["b", "con", "e", "h", "hc", "p", "s", "soc", "sp", "u"],
|
||||
"files": ["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", "cm", "d", "e", "h", "hc", "pol", "r", "s", "s4s", "soc", "u", "y"]
|
||||
}, {
|
||||
"uid": 7,
|
||||
"name": "Install Gentoo",
|
||||
@ -68,8 +68,8 @@
|
||||
"http": true,
|
||||
"https": true,
|
||||
"software": "fuuka",
|
||||
"boards": ["cgl", "con", "g", "mu", "w"],
|
||||
"files": ["cgl", "con", "g", "mu", "w"]
|
||||
"boards": ["cgl", "g", "mu", "w"],
|
||||
"files": ["cgl", "g", "mu", "w"]
|
||||
}, {
|
||||
"uid": 9,
|
||||
"name": "Heinessen",
|
||||
@ -86,8 +86,8 @@
|
||||
"http": true,
|
||||
"https": true,
|
||||
"software": "fuuka",
|
||||
"boards": ["3", "cgl", "ck", "fa", "ic", "jp", "lit", "q", "tg", "vr"],
|
||||
"files": ["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", "tg", "vr"]
|
||||
}, {
|
||||
"uid": 13,
|
||||
"name": "Foolz Beta",
|
||||
@ -96,6 +96,6 @@
|
||||
"https": true,
|
||||
"withCredentials": true,
|
||||
"software": "foolfuuka",
|
||||
"boards": ["a", "co", "d", "gd", "h", "jp", "m", "mlp", "q", "sp", "tg", "tv", "u", "v", "vg", "vp", "vr", "wsg"],
|
||||
"files": ["a", "d", "gd", "h", "jp", "m", "q", "tg", "u", "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", "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 =
|
||||
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 = {}
|
||||
|
||||
Post.callbacks.push
|
||||
@ -8,33 +8,34 @@ IDColor =
|
||||
cb: @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
|
||||
span = @nodes.uniqueID
|
||||
{style} = span
|
||||
style.color = rgb[3]
|
||||
style.backgroundColor = "rgb(#{rgb[0]},#{rgb[1]},#{rgb[2]})"
|
||||
$.addClass span, 'painted'
|
||||
span.textContent = uid
|
||||
span.title = 'Highlight posts by this ID'
|
||||
|
||||
compute: (uniqueID) ->
|
||||
if uniqueID of IDColor.ids
|
||||
return IDColor.ids[uniqueID]
|
||||
hash = @hash uniqueID
|
||||
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.push if (rgb[0] * 0.299 + rgb[1] * 0.587 + rgb[2] * 0.114) > 170
|
||||
'black'
|
||||
rgb[3] = if (rgb[0] * 0.299 + rgb[1] * 0.587 + rgb[2] * 0.114) > 125
|
||||
'#000'
|
||||
else
|
||||
'white'
|
||||
@ids[uniqueID] = rgb
|
||||
'#fff'
|
||||
@ids[uid] = rgb
|
||||
|
||||
hash: (uniqueID) ->
|
||||
hash: (uid) ->
|
||||
msg = 0
|
||||
for i in [0...uniqueID.length] by 1
|
||||
msg = (msg << 5) - msg + uniqueID.charCodeAt i
|
||||
msg
|
||||
i = 0
|
||||
while i < 8
|
||||
msg = (msg << 5) - msg + uid.charCodeAt i++
|
||||
msg
|
||||
Loading…
x
Reference in New Issue
Block a user