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,
|
||||||
|
|||||||
@ -73,61 +73,61 @@ Main =
|
|||||||
# c.time 'All initializations'
|
# c.time 'All initializations'
|
||||||
|
|
||||||
init
|
init
|
||||||
'Polyfill': Polyfill
|
'Polyfill': Polyfill
|
||||||
'Redirect': Redirect
|
'Redirect': Redirect
|
||||||
'Header': Header
|
'Header': Header
|
||||||
'Catalog Links': CatalogLinks
|
'Catalog Links': CatalogLinks
|
||||||
'Settings': Settings
|
'Settings': Settings
|
||||||
'Announcement Hiding': PSAHiding
|
'Announcement Hiding': PSAHiding
|
||||||
'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
|
||||||
'Filter': Filter
|
'Filter': Filter
|
||||||
'Thread Hiding Buttons': ThreadHiding
|
'Thread Hiding Buttons': ThreadHiding
|
||||||
'Reply Hiding Buttons': PostHiding
|
'Reply Hiding Buttons': PostHiding
|
||||||
'Recursive': Recursive
|
'Recursive': Recursive
|
||||||
'Strike-through Quotes': QuoteStrikeThrough
|
'Strike-through Quotes': QuoteStrikeThrough
|
||||||
'Quick Reply': QR
|
'Quick Reply': QR
|
||||||
'Menu': Menu
|
'Menu': Menu
|
||||||
'Report Link': ReportLink
|
'Report Link': ReportLink
|
||||||
'Thread Hiding (Menu)': ThreadHiding.menu
|
'Thread Hiding (Menu)': ThreadHiding.menu
|
||||||
'Reply Hiding (Menu)': PostHiding.menu
|
'Reply Hiding (Menu)': PostHiding.menu
|
||||||
'Delete Link': DeleteLink
|
'Delete Link': DeleteLink
|
||||||
'Filter (Menu)': Filter.menu
|
'Filter (Menu)': Filter.menu
|
||||||
'Download Link': DownloadLink
|
'Download Link': DownloadLink
|
||||||
'Archive Link': ArchiveLink
|
'Archive Link': ArchiveLink
|
||||||
'Quote Inlining': QuoteInline
|
'Quote Inlining': QuoteInline
|
||||||
'Quote Previewing': QuotePreview
|
'Quote Previewing': QuotePreview
|
||||||
'Quote Backlinks': QuoteBacklink
|
'Quote Backlinks': QuoteBacklink
|
||||||
'Mark Quotes of You': QuoteYou
|
'Mark Quotes of You': QuoteYou
|
||||||
'Mark OP Quotes': QuoteOP
|
'Mark OP Quotes': QuoteOP
|
||||||
'Mark Cross-thread Quotes': QuoteCT
|
'Mark Cross-thread Quotes': QuoteCT
|
||||||
'Anonymize': Anonymize
|
'Anonymize': Anonymize
|
||||||
'Time Formatting': Time
|
'Time Formatting': Time
|
||||||
'Relative Post Dates': RelativeDates
|
'Relative Post Dates': RelativeDates
|
||||||
'File Info Formatting': FileInfo
|
'File Info Formatting': FileInfo
|
||||||
'Fappe Tyme': FappeTyme
|
'Fappe Tyme': FappeTyme
|
||||||
'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
|
||||||
'Thread Expansion': ExpandThread
|
'Thread Expansion': ExpandThread
|
||||||
'Thread Excerpt': ThreadExcerpt
|
'Thread Excerpt': ThreadExcerpt
|
||||||
'Favicon': Favicon
|
'Favicon': Favicon
|
||||||
'Unread': Unread
|
'Unread': Unread
|
||||||
'Quote Threading': QuoteThreading
|
'Quote Threading': QuoteThreading
|
||||||
'Thread Stats': ThreadStats
|
'Thread Stats': ThreadStats
|
||||||
'Thread Updater': ThreadUpdater
|
'Thread Updater': ThreadUpdater
|
||||||
'Thread Watcher': ThreadWatcher
|
'Thread Watcher': ThreadWatcher
|
||||||
'Index Navigation': Nav
|
'Index Navigation': Nav
|
||||||
'Keybinds': Keybinds
|
'Keybinds': Keybinds
|
||||||
|
|
||||||
# c.timeEnd 'All initializations'
|
# c.timeEnd 'All initializations'
|
||||||
|
|
||||||
|
|||||||
@ -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