Permalink
Browse files

Make it possible to enter hex value manually

Previous behavior was glitchy as pointed out by @theGeekPirate. Should be a bit
better now.

Closes #15.
  • Loading branch information...
bebraw committed Dec 6, 2012
1 parent 4e2be3a commit 58d81bafd1615361e898aa7cdefca17ace53c995
Showing with 15 additions and 5 deletions.
  1. +7 −2 dist/colorjoe.js
  2. +2 −2 dist/colorjoe.min.js
  3. +6 −1 src/extras.js
View
@@ -1,4 +1,4 @@
-/*! colorjoe - v0.7.1 - 2012-11-07
+/*! colorjoe - v0.7.1 - 2012-12-06
* http://bebraw.github.com/colorjoe/
* Copyright (c) 2012 Juho Vepsalainen; Licensed MIT */
@@ -1106,11 +1106,16 @@ function hex(p, joe, o) {
e.input.value = '#';
e.input.onkeyup = function(elem) {
+ var key = elem.keyCode || elem.which;
var val = elem.target.value;
val = val[0] == '#'? val: '#' + val;
val = pad(val, 7, '0');
- joe.set(val);
+ if(key == 13) joe.set(val);
+ };
+
+ e.input.onblur = function(elem) {
+ joe.set(elem.target.value);
};
return {
Oops, something went wrong.

0 comments on commit 58d81ba

Please sign in to comment.