From 0733ceb3b60032c851d7f2f04a5d35a84219a735 Mon Sep 17 00:00:00 2001 From: Zixaphir Date: Thu, 2 Jan 2014 17:38:13 -0700 Subject: [PATCH] Small refactor --- builds/appchan-x.user.js | 21 +++++++++------------ builds/crx/script.js | 21 +++++++++------------ src/Theming/color.coffee | 6 ++++-- 3 files changed, 22 insertions(+), 26 deletions(-) diff --git a/builds/appchan-x.user.js b/builds/appchan-x.user.js index 16f09a18c..cfb5f9979 100644 --- a/builds/appchan-x.user.js +++ b/builds/appchan-x.user.js @@ -13699,20 +13699,17 @@ }; Color.prototype.shiftRGB = function(shift, smart) { - var color; + var color, rgb, _i, _len, _ref; if (smart) { - shift = (this.isLight ? -1 : 1) * Math.abs(shift); + shift = (this.isLight() ? -1 : 1) * Math.abs(shift); } - return ((function() { - var _i, _len, _ref, _results; - _ref = this.privateRGB; - _results = []; - for (_i = 0, _len = _ref.length; _i < _len; _i++) { - color = _ref[_i]; - _results.push(minmax(color + shift)); - } - return _results; - }).call(this)).join(","); + rgb = []; + _ref = this.privateRGB; + for (_i = 0, _len = _ref.length; _i < _len; _i++) { + color = _ref[_i]; + rgb.push(minmax(color + shift)); + } + return rgb.join(""); }; return Color; diff --git a/builds/crx/script.js b/builds/crx/script.js index 198a18237..bb8f15dd1 100644 --- a/builds/crx/script.js +++ b/builds/crx/script.js @@ -13710,20 +13710,17 @@ }; Color.prototype.shiftRGB = function(shift, smart) { - var color; + var color, rgb, _i, _len, _ref; if (smart) { - shift = (this.isLight ? -1 : 1) * Math.abs(shift); + shift = (this.isLight() ? -1 : 1) * Math.abs(shift); } - return ((function() { - var _i, _len, _ref, _results; - _ref = this.privateRGB; - _results = []; - for (_i = 0, _len = _ref.length; _i < _len; _i++) { - color = _ref[_i]; - _results.push(minmax(color + shift)); - } - return _results; - }).call(this)).join(","); + rgb = []; + _ref = this.privateRGB; + for (_i = 0, _len = _ref.length; _i < _len; _i++) { + color = _ref[_i]; + rgb.push(minmax(color + shift)); + } + return rgb.join(""); }; return Color; diff --git a/src/Theming/color.coffee b/src/Theming/color.coffee index 61a9f016e..761cde571 100644 --- a/src/Theming/color.coffee +++ b/src/Theming/color.coffee @@ -52,5 +52,7 @@ class Color isLight: -> (@privateRGB[0] * 0.299 + @privateRGB[1] * 0.587 + @privateRGB[2] * 0.114) > 125 shiftRGB: (shift, smart) -> - shift = (if @isLight then -1 else 1) * Math.abs shift if smart - return (minmax color + shift for color in @privateRGB).join "," \ No newline at end of file + shift = (if @isLight() then -1 else 1) * Math.abs shift if smart + rgb = [] + rgb.push minmax color + shift for color in @privateRGB + rgb.join "" \ No newline at end of file