diff --git a/LICENSE b/LICENSE index 96736fa7e..f4dae1beb 100644 --- a/LICENSE +++ b/LICENSE @@ -1,5 +1,5 @@ /* -* appchan x - Version 2.7.4 - 2014-01-02 +* appchan x - Version 2.7.4 - 2014-01-04 * * Licensed under the MIT license. * https://github.com/zixaphir/appchan-x/blob/master/LICENSE diff --git a/builds/appchan-x.user.js b/builds/appchan-x.user.js index 69e990f9d..56bb8966e 100644 --- a/builds/appchan-x.user.js +++ b/builds/appchan-x.user.js @@ -22,7 +22,7 @@ // ==/UserScript== /* -* appchan x - Version 2.7.4 - 2014-01-02 +* appchan x - Version 2.7.4 - 2014-01-04 * * Licensed under the MIT license. * https://github.com/zixaphir/appchan-x/blob/master/LICENSE @@ -13642,7 +13642,7 @@ }; colorToHex = function(color) { - var digits, hex; + var digits, hex, len; if (color.substr(0, 1) === '#') { if (color.length !== 4) { return color.slice(1); @@ -13650,11 +13650,14 @@ return shortToLong(color.substr(1, 3)); } } - if (/[0-9a-f]{3}/i.test(color)) { - if (color.length === 6) { - return color; - } else { - return shortToLong(color); + len = color.length; + if (len === 3 || len === 6) { + if (/[0-9a-f]{3}/i.test(color)) { + if (color.length === 6) { + return color; + } else { + return shortToLong(color); + } } } if (digits = color.match(/(.*?)rgba?\((\d+), ?(\d+), ?(\d+)(.*?)\)/)) { diff --git a/builds/crx/script.js b/builds/crx/script.js index 633e215bc..745c3ffb0 100644 --- a/builds/crx/script.js +++ b/builds/crx/script.js @@ -1,6 +1,6 @@ // Generated by CoffeeScript /* -* appchan x - Version 2.7.4 - 2014-01-02 +* appchan x - Version 2.7.4 - 2014-01-04 * * Licensed under the MIT license. * https://github.com/zixaphir/appchan-x/blob/master/LICENSE @@ -13653,7 +13653,7 @@ }; colorToHex = function(color) { - var digits, hex; + var digits, hex, len; if (color.substr(0, 1) === '#') { if (color.length !== 4) { return color.slice(1); @@ -13661,11 +13661,14 @@ return shortToLong(color.substr(1, 3)); } } - if (/[0-9a-f]{3}/i.test(color)) { - if (color.length === 6) { - return color; - } else { - return shortToLong(color); + len = color.length; + if (len === 3 || len === 6) { + if (/[0-9a-f]{3}/i.test(color)) { + if (color.length === 6) { + return color; + } else { + return shortToLong(color); + } } } if (digits = color.match(/(.*?)rgba?\((\d+), ?(\d+), ?(\d+)(.*?)\)/)) { diff --git a/src/Theming/color.coffee b/src/Theming/color.coffee index 285bcb29d..0f6f00acf 100644 --- a/src/Theming/color.coffee +++ b/src/Theming/color.coffee @@ -16,8 +16,10 @@ class Color else return shortToLong color.substr(1, 3) - if /[0-9a-f]{3}/i.test color - return if color.length is 6 then color else shortToLong color + len = color.length + if len in [3, 6] + if /[0-9a-f]{3}/i.test color + return if color.length is 6 then color else shortToLong color if digits = color.match /(.*?)rgba?\((\d+), ?(\d+), ?(\d+)(.*?)\)/ # [R, G, B] to 0xRRGGBB