Repository: cordova-plugin-statusbar Updated Branches: refs/heads/master be8a3e594 -> 95f8de085
Update backgroundColorByHexString function The implementation when `hexString.length == 4` was a bit off. The current version either doesn't actually use the `split` variable, so that variable could be removed, or used in place accessing the string characters as they are now. Opted for the former in this case, though it doesn't really matter. Since the length is always going to be a number, also changed to `===` instead, as well as updated the check for `#` at the beginning of the string. Since it's always looking for the `#` tat the beginning `charAt(0)` seems to be a better fit. Project: http://git-wip-us.apache.org/repos/asf/cordova-plugin-statusbar/repo Commit: http://git-wip-us.apache.org/repos/asf/cordova-plugin-statusbar/commit/d9a8528c Tree: http://git-wip-us.apache.org/repos/asf/cordova-plugin-statusbar/tree/d9a8528c Diff: http://git-wip-us.apache.org/repos/asf/cordova-plugin-statusbar/diff/d9a8528c Branch: refs/heads/master Commit: d9a8528c8baaa1b94efa0b0efea0c22ccf988cf1 Parents: be8a3e5 Author: Brad Berger <[email protected]> Authored: Mon Jul 21 09:42:44 2014 +0200 Committer: Brad Berger <[email protected]> Committed: Mon Jul 21 09:42:44 2014 +0200 ---------------------------------------------------------------------- www/statusbar.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cordova-plugin-statusbar/blob/d9a8528c/www/statusbar.js ---------------------------------------------------------------------- diff --git a/www/statusbar.js b/www/statusbar.js index 63967a9..96c0808 100644 --- a/www/statusbar.js +++ b/www/statusbar.js @@ -71,13 +71,13 @@ var StatusBar = { }, backgroundColorByHexString: function (hexString) { - if (hexString.indexOf("#") < 0) { + if (hexString.charAt(0) === "#") { hexString = "#" + hexString; } - if (hexString.length == 4) { + if (hexString.length === 4) { var split = hexString.split(""); - hexString = "#" + hexString[1] + hexString[1] + hexString[2] + hexString[2] + hexString[3] + hexString[3]; + hexString = "#" + split[1] + split[1] + split[2] + split[2] + split[3] + split[3]; } exec(null, null, "StatusBar", "backgroundColorByHexString", [hexString]);
