Merge pull request #3 from mdipierro/master

up
This commit is contained in:
nicozanf
2012-09-21 14:32:55 -07:00
3 changed files with 144 additions and 47 deletions
+1 -1
View File
@@ -1 +1 @@
Version 2.0.9 (2012-09-20 13:25:48) stable Version 2.0.9 (2012-09-21 09:37:29) stable
@@ -1,8 +1,8 @@
/*============================================================= //=======================================================
CUSTOM RULES // CUSTOM RULES
==============================================================*/ //=======================================================
body{height:auto;} /* to avoid vertical scroll bar */ body{height:auto;} // to avoid vertical scroll bar
div.flash.flash-center{left:25%;right:25%;} div.flash.flash-center{left:25%;right:25%;}
div.flash.flash-top,div.flash.flash-top:hover{ div.flash.flash-top,div.flash.flash-top:hover{
position:relative; position:relative;
@@ -36,16 +36,18 @@ div.flash.flash-top,div.flash.flash-top:hover{
font-size:20px; font-size:20px;
font-weight:300; font-weight:300;
} }
/* auth navbar - primitive style */ // auth navbar - primitive style
.auth_navbar,.auth_navbar a{color:inherit;} .auth_navbar,.auth_navbar a{color:inherit;}
.ie-lte7 .auth_navbar,.auth_navbar a{color:expression(this.parentNode.currentStyle['color']); /* ie7 doesn't support inherit */} .ie-lte7 .auth_navbar,.auth_navbar a{color:expression(this.parentNode.currentStyle['color']); // ie7 doesn't support inherit
.auth_navbar a{white-space:nowrap;} /* to avoid the nav split on more lines */ }
.auth_navbar a{white-space:nowrap;} // to avoid the nav split on more lines
.auth_navbar a:hover{color:white;text-decoration:none;} .auth_navbar a:hover{color:white;text-decoration:none;}
ul#navbar>.auth_navbar{ ul#navbar>.auth_navbar{
display:inline-block; display:inline-block;
padding:5px; padding:5px;
} }
/* form errors message box customization */
// form errors message box customization
div.error_wrapper{margin-bottom:9px;} div.error_wrapper{margin-bottom:9px;}
div.error{ div.error{
border-radius: 4px; border-radius: 4px;
@@ -53,8 +55,9 @@ div.error{
-moz-border-radius: 4px; -moz-border-radius: 4px;
-webkit-border-radius: 4px; -webkit-border-radius: 4px;
} }
/* below rules are only for formstyle = bootstrap
trying to make errors look like bootstrap ones */ // below rules are only for formstyle = bootstrap
// trying to make errors look like bootstrap ones
div.controls .error_wrapper{ div.controls .error_wrapper{
display:inline-block; display:inline-block;
margin-bottom:0; margin-bottom:0;
@@ -67,42 +70,46 @@ div.controls .error{
border:none; border:none;
padding:0; padding:0;
margin:0; margin:0;
//display:inline; /* uncommenting this, the animation effect is lost */ //display:inline; // uncommenting this, the animation effect is lost
} }
div.controls .inline-help{color:#3A87AD;} div.controls .inline-help{color:#3A87AD;}
div.controls .error_wrapper+.inline-help{margin-left:-99999px;} div.controls .error_wrapper+.inline-help{margin-left:-99999px;}
/* beautify brand */
// beautify brand
.navbar-inverse .brand{color:#c6cecc;} .navbar-inverse .brand{color:#c6cecc;}
.navbar-inverse .brand b{display:inline-block;margin-top:-1px;} .navbar-inverse .brand b{display:inline-block;margin-top:-1px;}
.navbar-inverse .brand b>span{font-size:22px;color:white} .navbar-inverse .brand b>span{font-size:22px;color:white}
.navbar-inverse .brand:hover b>span{color:white} .navbar-inverse .brand:hover b>span{color:white}
/* beautify web2py link in navbar */ // beautify web2py link in navbar
span.highlighted{color:#d8d800;} span.highlighted{color:#d8d800;}
.open span.highlighted{color:#ffff00;} .open span.highlighted{color:#ffff00;}
/*============================================================= //===========================================================
OVERRIDING WEB2PY.CSS RULES // OVERRIDING WEB2PY.CSS RULES
==============================================================*/ //===========================================================
/* reset to default */ // reset to default
a{white-space:normal;} a{white-space:normal;}
li{margin-bottom:0;} li{margin-bottom:0;}
textarea,button{display:block;} textarea,button{display:block;}
/*reset ul padding */ // reset ul padding
ul#navbar{padding:0;} ul#navbar{padding:0;}
/* label aligned to related input */ // label aligned to related input
td.w2p_fl,td.w2p_fc {padding:0;} td.w2p_fl,td.w2p_fc {padding:0;}
#web2py_user_form td{vertical-align:middle;} #web2py_user_form td{vertical-align:middle;}
/*============================================================= //==========================================================
OVERRIDING BOOTSTRAP.CSS RULES // OVERRIDING BOOTSTRAP.CSS RULES
==============================================================*/ //==========================================================
/* right folder for bootstrap black images/icons */ // because web2py handles this via js
.hidden{visibility:visible;}
// right folder for bootstrap black images/icons
[class^="icon-"],[class*=" icon-"]{ [class^="icon-"],[class*=" icon-"]{
background-image:url("../images/glyphicons-halflings.png") background-image:url("../images/glyphicons-halflings.png")
} }
/* right folder for bootstrap white images/icons */ // right folder for bootstrap white images/icons
.icon-white, .icon-white,
.nav-tabs > .active > a > [class^="icon-"], .nav-tabs > .active > a > [class^="icon-"],
.nav-tabs > .active > a > [class*=" icon-"], .nav-tabs > .active > a > [class*=" icon-"],
@@ -118,20 +125,20 @@ td.w2p_fl,td.w2p_fc {padding:0;}
.dropdown-menu > .active > a > [class*=" icon-"] { .dropdown-menu > .active > a > [class*=" icon-"] {
background-image:url("../images/glyphicons-halflings-white.png"); background-image:url("../images/glyphicons-halflings-white.png");
} }
/* bootstrap has a label as input's wrapper while web2py has a div */ // bootstrap has a label as input's wrapper while web2py has a div
div>input[type="radio"],div>input[type="checkbox"]{margin:0;} div>input[type="radio"],div>input[type="checkbox"]{margin:0;}
/* bootstrap has button instead of input */ // bootstrap has button instead of input
input[type="button"], input[type="submit"]{margin-right:8px;} input[type="button"], input[type="submit"]{margin-right:8px;}
/*============================================================= //===========================================================
RULES FOR SOLVING CONFLICTS BETWEEN WEB2PY.CSS AND BOOTSTRAP.CSS // SOLVING CONFLICTS BETWEEN WEB2PY.CSS AND BOOTSTRAP.CSS
==============================================================*/ //===========================================================
/*when formstyle=table3cols*/ // when formstyle=table3cols
tr#auth_user_remember__row>td.w2p_fw>div{padding-bottom:8px;} tr#auth_user_remember__row>td.w2p_fw>div{padding-bottom:8px;}
td.w2p_fw div>label{vertical-align:middle;} td.w2p_fw div>label{vertical-align:middle;}
td.w2p_fc {padding-bottom:5px;} td.w2p_fc {padding-bottom:5px;}
/*when formstyle=divs*/ // when formstyle=divs
div#auth_user_remember__row{margin-top:4px;} div#auth_user_remember__row{margin-top:4px;}
div#auth_user_remember__row>.w2p_fl{display:none;} div#auth_user_remember__row>.w2p_fl{display:none;}
div#auth_user_remember__row>.w2p_fw{min-height:39px;} div#auth_user_remember__row>.w2p_fw{min-height:39px;}
@@ -144,7 +151,8 @@ div.w2p_fc{
padding-left:5px; padding-left:5px;
margin-top:-8px; margin-top:-8px;
} }
/*when formstyle=ul*/
// when formstyle=ul
form>ul{ form>ul{
list-style:none; list-style:none;
margin:0; margin:0;
@@ -152,28 +160,30 @@ form>ul{
li#auth_user_remember__row{margin-top:4px;} li#auth_user_remember__row{margin-top:4px;}
li#auth_user_remember__row>.w2p_fl{display:none;} li#auth_user_remember__row>.w2p_fl{display:none;}
li#auth_user_remember__row>.w2p_fw{min-height:39px;} li#auth_user_remember__row>.w2p_fw{min-height:39px;}
/*when formstyle=bootstrap*/
// when formstyle=bootstrap
#auth_user_remember__row label.checkbox{display:block;} #auth_user_remember__row label.checkbox{display:block;}
span.inline-help{display:inline-block;} span.inline-help{display:inline-block;}
input[type="text"].input-xlarge,input[type="password"].input-xlarge{width:270px;} input[type="text"].input-xlarge,input[type="password"].input-xlarge{width:270px;}
/*when recaptcha is used*/
// when recaptcha is used
#recaptcha{min-height:30px;display:inline-block;margin-bottom:0;line-height:30px;vertical-align:middle;} #recaptcha{min-height:30px;display:inline-block;margin-bottom:0;line-height:30px;vertical-align:middle;}
td>#recaptcha{margin-bottom:6px;} td>#recaptcha{margin-bottom:6px;}
div>#recaptcha{margin-bottom:9px;} div>#recaptcha{margin-bottom:9px;}
/*============================================================= //==========================================================
OTHER RULES // OTHER RULES
==============================================================*/ //==========================================================
.navbar-inner{ .navbar-inner{
position:relative; /*unnecessary ??*/ position:relative; // unnecessary
} }
/* Massimo Di Pierro fixed alignment in forms with list:string */
// fixed alignment in forms with list:string
form table tr{margin-bottom:9px;} form table tr{margin-bottom:9px;}
td.w2p_fw ul{margin-left:0px;} td.w2p_fw ul{margin-left:0px;}
/* web2py_console in grid and smartgrid */ // web2py_console in grid and smartgrid
.hidden{visibility:visible;}
.web2py_console input{ .web2py_console input{
display: inline-block; display: inline-block;
margin-bottom: 0; margin-bottom: 0;
@@ -193,12 +203,12 @@ td.w2p_fw ul{margin-left:0px;}
margin:3px 0 0 2px; margin:3px 0 0 2px;
} }
.web2py_grid form table{width:auto;} .web2py_grid form table{width:auto;}
/* auth_user_remember checkbox extrapadding in IE fix */ // auth_user_remember checkbox extrapadding in IE fix
.ie-lte9 input#auth_user_remember.checkbox {padding-left:0;} .ie-lte9 input#auth_user_remember.checkbox {padding-left:0;}
/*============================================================= //===========================================================
MEDIA QUERIES // MEDIA QUERIES
==============================================================*/ //===========================================================
@media only screen and (max-width:979px){ @media only screen and (max-width:979px){
body{padding-top:0px;} body{padding-top:0px;}
+88 -1
View File
@@ -14,6 +14,93 @@ pass
}} }}
</div> </div>
<script language="javascript"><!-- <script language="javascript"><!--
jQuery("#web2py_user_form input:visible:enabled:first").focus(); jQuery("#web2py_user_form input:visible:enabled:first").focus();
function calc_entropy(mystring) {
/*" calculate a simple entropy for a given string "*/
var lowerset = 'abcdefghijklmnopqrstuvwxyz';
var upperset = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ';
var numberset = '0123456789';
var sym1set = '!@#$%^&*()';
var sym2set = '~`-_=+[]{}\\|;:\'",.<>?/';
var otherset = '0123456789abcdefghijklmnopqrstuvwxyz' /*anything else*/
var alphabet = 0;
var other = {};
var seen = {};
var lastset = null;
var mystringlist = mystring.split('');
for (var i=0;i<mystringlist.length;i++) {
var c = mystringlist[i];
//console.log('we are at char', c);
/* classify this character*/
var inset = otherset;
while (1) {
/*lowerset*/
if (lowerset.indexOf(c) != -1) {
inset = lowerset;
break
};
/*upperset*/
if (upperset.indexOf(c) != -1) {
inset = upperset;
break
};
/*numberset*/
if (numberset.indexOf(c) != -1) {
inset = numberset;
break
};
/*sym1set*/
if (sym1set.indexOf(c) != -1) {
inset = sym1set;
break
};
/*sym2set*/
if (sym2set.indexOf(c) != -1) {
inset = sym2set;
break
} else {break};
}
//console.log('inset detected as', inset, seen);
/*calculate effect of character on alphabet size*/
if (!(inset in seen)) {
//console.log('credit for a new character set');
seen[inset] = 1;
alphabet += inset.length; /*credit for a new character set*/
}
else if (!(c in other)) {
//console.log('credit for unique characters');
alphabet += 1;
other[c] = 1;
}
if (inset != lastset) {
//console.log('credit for set transitions');
alphabet += 1; /*credit for set transitions*/
lastset = inset;
}
}
var entropy = mystring.length / 1.0 * Math.log(alphabet) / 0.6931471805599453; /*math.log(2)*/
return Math.round(entropy*100)/100
}
function validate_entropy(myfield, midrange) {
var k = 256.0/midrange;
var validator = function () {
var value = calc_entropy(myfield.val());
var color;
if(value<30) {
var c = Math.floor(value*k).toString(16);
color = '#ff'+((c.length==1)?'0':''+c)+'00';
} else {
var c = Math.floor(Math.max(0,255-(value-midrange)*k)).toString(16);
color = '#'+((c.length==1)?'0':'')+c+'ff00';
}
myfield.css('background-color',color);
}
myfield.on('keyup', validator);
myfield.on('keydown', validator);
}
validate_entropy(jQuery('#auth_user_password'),50);
//--></script> //--></script>