From 554fe30288f43e61b65ef618eff098ce8af26830 Mon Sep 17 00:00:00 2001 From: mdipierro Date: Sun, 23 Sep 2012 17:00:34 -0500 Subject: [PATCH] better entropy colors and optional callback, thanks Niphlod --- VERSION | 2 +- applications/welcome/static/js/web2py.js | 3 +-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/VERSION b/VERSION index f55670fa..06a6fed3 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -Version 2.0.9 (2012-09-23 16:58:06) stable +Version 2.0.9 (2012-09-23 17:00:31) stable diff --git a/applications/welcome/static/js/web2py.js b/applications/welcome/static/js/web2py.js index 84b5b7b8..57c3caa5 100644 --- a/applications/welcome/static/js/web2py.js +++ b/applications/welcome/static/js/web2py.js @@ -191,8 +191,7 @@ function web2py_validate_entropy(myfield, req_entropy) { var v = (web2py_calc_entropy(myfield.val())||0)/req_entropy; var r=0,g=0,b=0,rs=function(x){return Math.round(x*15).toString(16)}; if(v<=0.5) {r=1.0; g=2.0*v;} - else if(v<1.0) {r=(1.0-2.0*(v-0.5)); g=1.0;} - else {g=Math.max(0,2.0-v); b=1.0;} + else {r=(1.0-2.0*(Math.max(v,0)-0.5)); g=1.0;} var color = '#'+rs(r)+rs(g)+rs(b); myfield.css('background-color',color); entroy_callback = myfield.attr('entroy_callback');