Fix a few features identifying themselves incorrectly
A few refactors to ColorUserIDs
This commit is contained in:
parent
ce6e317c98
commit
ee4ece2574
2
LICENSE
2
LICENSE
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* 4chan X - Version 1.2.25 - 2013-08-07
|
* 4chan X - Version 1.2.25 - 2013-08-08
|
||||||
*
|
*
|
||||||
* 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
|
||||||
|
|||||||
@ -19,7 +19,7 @@
|
|||||||
// @icon data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwAgMAAAAqbBEUAAAACVBMVEUAAGcAAABmzDNZt9VtAAAAAXRSTlMAQObYZgAAAHFJREFUKFOt0LENACEIBdBv4Qju4wgWanEj3D6OcIVMKaitYHEU/jwTCQj8W75kiVCSBvdQ5/AvfVHBin11BgdRq3ysBgfwBDRrj3MCIA+oAQaku/Q1cNctrAmyDl577tOThYt/Y1RBM4DgOHzM0HFTAyLukH/cmRnqAAAAAElFTkSuQmCC
|
// @icon data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwAgMAAAAqbBEUAAAACVBMVEUAAGcAAABmzDNZt9VtAAAAAXRSTlMAQObYZgAAAHFJREFUKFOt0LENACEIBdBv4Qju4wgWanEj3D6OcIVMKaitYHEU/jwTCQj8W75kiVCSBvdQ5/AvfVHBin11BgdRq3ysBgfwBDRrj3MCIA+oAQaku/Q1cNctrAmyDl577tOThYt/Y1RBM4DgOHzM0HFTAyLukH/cmRnqAAAAAElFTkSuQmCC
|
||||||
// ==/UserScript==
|
// ==/UserScript==
|
||||||
/*
|
/*
|
||||||
* 4chan X - Version 1.2.25 - 2013-08-07
|
* 4chan X - Version 1.2.25 - 2013-08-08
|
||||||
*
|
*
|
||||||
* 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
|
||||||
@ -8355,20 +8355,18 @@
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
return Post.prototype.callbacks.push({
|
return Post.prototype.callbacks.push({
|
||||||
name: 'Reveal Spoilers',
|
name: 'Color User IDs',
|
||||||
cb: this.node
|
cb: this.node
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
node: function(post) {
|
node: function(post) {
|
||||||
var str, uid;
|
var str, _ref;
|
||||||
|
|
||||||
if (!(uid = $('.hand', this.nodes.uniqueID))) {
|
if (((_ref = $('.hand', this.nodes.uniqueID)) != null ? _ref.nodeName : void 0) !== 'SPAN') {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
str = this.info.uniqueID;
|
str = this.info.uniqueID;
|
||||||
if (uid.nodeName === 'SPAN') {
|
return uid.style.cssText = IDColor.css(IDColor.ids[str] || IDColor.compute(str));
|
||||||
return uid.style.cssText = IDColor.apply.call(str);
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
ids: {},
|
ids: {},
|
||||||
compute: function(str) {
|
compute: function(str) {
|
||||||
@ -8380,11 +8378,8 @@
|
|||||||
this.ids[str] = rgb;
|
this.ids[str] = rgb;
|
||||||
return rgb;
|
return rgb;
|
||||||
},
|
},
|
||||||
apply: function() {
|
css: function(rgb) {
|
||||||
var rgb;
|
return "background-color: rgb(" + rgb[0] + "," + rgb[1] + "," + rgb[2] + "); color: " + (rgb[3] ? "black;" : "white;") + " border-radius: 3px; padding: 0px 2px;";
|
||||||
|
|
||||||
rgb = IDColor.ids[this] || IDColor.compute(this);
|
|
||||||
return ("background-color: rgb(" + rgb[0] + "," + rgb[1] + "," + rgb[2] + "); color: ") + (rgb[3] ? "black; border-radius: 3px; padding: 0px 2px;" : "white; border-radius: 3px; padding: 0px 2px;");
|
|
||||||
},
|
},
|
||||||
hash: function(str) {
|
hash: function(str) {
|
||||||
var i, j, msg;
|
var i, j, msg;
|
||||||
@ -10347,7 +10342,7 @@
|
|||||||
'Fourchan thingies': Fourchan,
|
'Fourchan thingies': Fourchan,
|
||||||
'Emoji': Emoji,
|
'Emoji': Emoji,
|
||||||
'Color User IDs': IDColor,
|
'Color User IDs': IDColor,
|
||||||
'Remove Spoilers': RemoveSpoilers,
|
'Reveal Spoilers': RemoveSpoilers,
|
||||||
'Custom CSS': CustomCSS,
|
'Custom CSS': CustomCSS,
|
||||||
'Linkify': Linkify,
|
'Linkify': Linkify,
|
||||||
'Resurrect Quotes': Quotify,
|
'Resurrect Quotes': Quotify,
|
||||||
@ -10379,7 +10374,7 @@
|
|||||||
'Sauce': Sauce,
|
'Sauce': Sauce,
|
||||||
'Image Expansion': ImageExpand,
|
'Image Expansion': ImageExpand,
|
||||||
'Image Expansion (Menu)': ImageExpand.menu,
|
'Image Expansion (Menu)': ImageExpand.menu,
|
||||||
'Reveal Spoilers': RevealSpoilers,
|
'Reveal Spoiler Thumbnails': RevealSpoilers,
|
||||||
'Image Loading': ImageLoader,
|
'Image Loading': ImageLoader,
|
||||||
'Image Hover': ImageHover,
|
'Image Hover': ImageHover,
|
||||||
'Comment Expansion': ExpandComment,
|
'Comment Expansion': ExpandComment,
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
// Generated by CoffeeScript
|
// Generated by CoffeeScript
|
||||||
/*
|
/*
|
||||||
* 4chan X - Version 1.2.25 - 2013-08-07
|
* 4chan X - Version 1.2.25 - 2013-08-08
|
||||||
*
|
*
|
||||||
* 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
|
||||||
@ -8341,20 +8341,18 @@
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
return Post.prototype.callbacks.push({
|
return Post.prototype.callbacks.push({
|
||||||
name: 'Reveal Spoilers',
|
name: 'Color User IDs',
|
||||||
cb: this.node
|
cb: this.node
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
node: function(post) {
|
node: function(post) {
|
||||||
var str, uid;
|
var str, _ref;
|
||||||
|
|
||||||
if (!(uid = $('.hand', this.nodes.uniqueID))) {
|
if (((_ref = $('.hand', this.nodes.uniqueID)) != null ? _ref.nodeName : void 0) !== 'SPAN') {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
str = this.info.uniqueID;
|
str = this.info.uniqueID;
|
||||||
if (uid.nodeName === 'SPAN') {
|
return uid.style.cssText = IDColor.css(IDColor.ids[str] || IDColor.compute(str));
|
||||||
return uid.style.cssText = IDColor.apply.call(str);
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
ids: {},
|
ids: {},
|
||||||
compute: function(str) {
|
compute: function(str) {
|
||||||
@ -8366,11 +8364,8 @@
|
|||||||
this.ids[str] = rgb;
|
this.ids[str] = rgb;
|
||||||
return rgb;
|
return rgb;
|
||||||
},
|
},
|
||||||
apply: function() {
|
css: function(rgb) {
|
||||||
var rgb;
|
return "background-color: rgb(" + rgb[0] + "," + rgb[1] + "," + rgb[2] + "); color: " + (rgb[3] ? "black;" : "white;") + " border-radius: 3px; padding: 0px 2px;";
|
||||||
|
|
||||||
rgb = IDColor.ids[this] || IDColor.compute(this);
|
|
||||||
return ("background-color: rgb(" + rgb[0] + "," + rgb[1] + "," + rgb[2] + "); color: ") + (rgb[3] ? "black; border-radius: 3px; padding: 0px 2px;" : "white; border-radius: 3px; padding: 0px 2px;");
|
|
||||||
},
|
},
|
||||||
hash: function(str) {
|
hash: function(str) {
|
||||||
var i, j, msg;
|
var i, j, msg;
|
||||||
@ -10331,7 +10326,7 @@
|
|||||||
'Fourchan thingies': Fourchan,
|
'Fourchan thingies': Fourchan,
|
||||||
'Emoji': Emoji,
|
'Emoji': Emoji,
|
||||||
'Color User IDs': IDColor,
|
'Color User IDs': IDColor,
|
||||||
'Remove Spoilers': RemoveSpoilers,
|
'Reveal Spoilers': RemoveSpoilers,
|
||||||
'Custom CSS': CustomCSS,
|
'Custom CSS': CustomCSS,
|
||||||
'Linkify': Linkify,
|
'Linkify': Linkify,
|
||||||
'Resurrect Quotes': Quotify,
|
'Resurrect Quotes': Quotify,
|
||||||
@ -10363,7 +10358,7 @@
|
|||||||
'Sauce': Sauce,
|
'Sauce': Sauce,
|
||||||
'Image Expansion': ImageExpand,
|
'Image Expansion': ImageExpand,
|
||||||
'Image Expansion (Menu)': ImageExpand.menu,
|
'Image Expansion (Menu)': ImageExpand.menu,
|
||||||
'Reveal Spoilers': RevealSpoilers,
|
'Reveal Spoiler Thumbnails': RevealSpoilers,
|
||||||
'Image Loading': ImageLoader,
|
'Image Loading': ImageLoader,
|
||||||
'Image Hover': ImageHover,
|
'Image Hover': ImageHover,
|
||||||
'Comment Expansion': ExpandComment,
|
'Comment Expansion': ExpandComment,
|
||||||
|
|||||||
@ -82,7 +82,7 @@ Main =
|
|||||||
'Fourchan thingies': Fourchan
|
'Fourchan thingies': Fourchan
|
||||||
'Emoji': Emoji
|
'Emoji': Emoji
|
||||||
'Color User IDs': IDColor
|
'Color User IDs': IDColor
|
||||||
'Remove Spoilers': RemoveSpoilers
|
'Reveal Spoilers': RemoveSpoilers
|
||||||
'Custom CSS': CustomCSS
|
'Custom CSS': CustomCSS
|
||||||
'Linkify': Linkify
|
'Linkify': Linkify
|
||||||
'Resurrect Quotes': Quotify
|
'Resurrect Quotes': Quotify
|
||||||
@ -114,7 +114,7 @@ Main =
|
|||||||
'Sauce': Sauce
|
'Sauce': Sauce
|
||||||
'Image Expansion': ImageExpand
|
'Image Expansion': ImageExpand
|
||||||
'Image Expansion (Menu)': ImageExpand.menu
|
'Image Expansion (Menu)': ImageExpand.menu
|
||||||
'Reveal Spoilers': RevealSpoilers
|
'Reveal Spoiler Thumbnails': RevealSpoilers
|
||||||
'Image Loading': ImageLoader
|
'Image Loading': ImageLoader
|
||||||
'Image Hover': ImageHover
|
'Image Hover': ImageHover
|
||||||
'Comment Expansion': ExpandComment
|
'Comment Expansion': ExpandComment
|
||||||
|
|||||||
@ -3,14 +3,13 @@ IDColor =
|
|||||||
return unless Conf['Color User IDs']
|
return unless Conf['Color User IDs']
|
||||||
|
|
||||||
Post::callbacks.push
|
Post::callbacks.push
|
||||||
name: 'Reveal Spoilers'
|
name: 'Color User IDs'
|
||||||
cb: @node
|
cb: @node
|
||||||
|
|
||||||
node: (post) ->
|
node: (post) ->
|
||||||
return unless uid = $ '.hand', @nodes.uniqueID
|
return unless $('.hand', @nodes.uniqueID)?.nodeName is 'SPAN'
|
||||||
str = @info.uniqueID
|
str = @info.uniqueID
|
||||||
if uid.nodeName is 'SPAN'
|
uid.style.cssText = IDColor.css IDColor.ids[str] or IDColor.compute str
|
||||||
uid.style.cssText = IDColor.apply.call str
|
|
||||||
|
|
||||||
ids: {}
|
ids: {}
|
||||||
|
|
||||||
@ -22,14 +21,13 @@ IDColor =
|
|||||||
(hash >> 16) & 0xFF
|
(hash >> 16) & 0xFF
|
||||||
(hash >> 8) & 0xFF
|
(hash >> 8) & 0xFF
|
||||||
]
|
]
|
||||||
|
|
||||||
rgb[3] = ((rgb[0] * 0.299) + (rgb[1] * 0.587) + (rgb[2] * 0.114)) > 125
|
rgb[3] = ((rgb[0] * 0.299) + (rgb[1] * 0.587) + (rgb[2] * 0.114)) > 125
|
||||||
|
|
||||||
@ids[str] = rgb
|
@ids[str] = rgb
|
||||||
rgb
|
rgb
|
||||||
|
|
||||||
apply: ->
|
css: (rgb) -> "background-color: rgb(#{rgb[0]},#{rgb[1]},#{rgb[2]}); color: #{if rgb[3] then "black;" else "white;"} border-radius: 3px; padding: 0px 2px;"
|
||||||
rgb = IDColor.ids[@] or IDColor.compute @
|
|
||||||
"background-color: rgb(#{rgb[0]},#{rgb[1]},#{rgb[2]}); color: " + if rgb[3] then "black; border-radius: 3px; padding: 0px 2px;" else "white; border-radius: 3px; padding: 0px 2px;"
|
|
||||||
|
|
||||||
hash: (str) ->
|
hash: (str) ->
|
||||||
msg = 0
|
msg = 0
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user