Couple small changes

This commit is contained in:
Zixaphir 2013-08-13 15:12:27 -07:00
parent 2ea8441fd4
commit 0cc7b8ee29
3 changed files with 16 additions and 12 deletions

View File

@ -8815,7 +8815,7 @@
IDColor = {
init: function() {
if (!Conf['Color User IDs']) {
if (g.VIEW === 'catalog' || !Conf['Color user IDs']) {
return;
}
return Post.prototype.callbacks.push({
@ -8826,9 +8826,11 @@
node: function() {
var str, uid;
str = this.info.uniqueID;
if (this.isClone || !(str = this.info.uniqueID)) {
return;
}
uid = $('.hand', this.nodes.uniqueID);
if (!(str && uid && uid.nodeName === 'SPAN')) {
if (!(uid && uid.nodeName === 'SPAN')) {
return;
}
return uid.style.cssText = IDColor.css(IDColor.ids[str] || IDColor.compute(str));
@ -8837,7 +8839,7 @@
compute: function(str) {
var hash, rgb;
hash = this.hash(str);
hash = IDColor.hash(str);
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;
this.ids[str] = rgb;

View File

@ -8802,7 +8802,7 @@
IDColor = {
init: function() {
if (!Conf['Color User IDs']) {
if (g.VIEW === 'catalog' || !Conf['Color user IDs']) {
return;
}
return Post.prototype.callbacks.push({
@ -8813,9 +8813,11 @@
node: function() {
var str, uid;
str = this.info.uniqueID;
if (this.isClone || !(str = this.info.uniqueID)) {
return;
}
uid = $('.hand', this.nodes.uniqueID);
if (!(str && uid && uid.nodeName === 'SPAN')) {
if (!(uid && uid.nodeName === 'SPAN')) {
return;
}
return uid.style.cssText = IDColor.css(IDColor.ids[str] || IDColor.compute(str));
@ -8824,7 +8826,7 @@
compute: function(str) {
var hash, rgb;
hash = this.hash(str);
hash = IDColor.hash(str);
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;
this.ids[str] = rgb;

View File

@ -1,21 +1,21 @@
IDColor =
init: ->
return unless Conf['Color User IDs']
return if g.VIEW is 'catalog' or !Conf['Color user IDs']
Post::callbacks.push
name: 'Color User IDs'
cb: @node
node: ->
str = @info.uniqueID
return if @isClone or not str = @info.uniqueID
uid = $ '.hand', @nodes.uniqueID
return unless str and uid and uid.nodeName is 'SPAN'
return unless uid and uid.nodeName is 'SPAN'
uid.style.cssText = IDColor.css IDColor.ids[str] or IDColor.compute str
ids: {}
compute: (str) ->
hash = @hash str
hash = IDColor.hash str
rgb = [
(hash >> 24) & 0xFF