Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,9 @@ Configuration
The path and the title of the different strength categories can
be configured with the first parameter of `.strengthify`.

The inputs property is an array of words to add to zxcvbn's dictionary
or a function that returns the array to use.

Default:

```JSON
Expand All @@ -52,7 +55,8 @@ Default:
"So-so",
"Good",
"Perfect"
]
],
"inputs": []
}
```

Expand Down
17 changes: 11 additions & 6 deletions jquery.strengthify.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,8 @@
'So-so',
'Good',
'Perfect'
]
],
inputs: []
},
options = $.extend(defaults, paramOptions);

Expand All @@ -58,12 +59,12 @@
dataType: 'script',
url: options.zxcvbn
}).done(function() {
me.bind('keyup input', function() {
var password = $(this).val(),
// hide strengthigy if no input is provided
function update() {
var password = me.val(),
// hide strengthify if no input is provided
opacity = (password === '') ? 0 : 1,
// calculate result
result = zxcvbn(password),
result = zxcvbn(password, typeof options.inputs === 'function' ? options.inputs() : options.inputs),
css = '',
// cache jQuery selections
$container = $('.strengthify-container'),
Expand Down Expand Up @@ -125,7 +126,11 @@
$container.css('width', 0);
}

});
};
me.bind('keyup input', update);
if (me.val()) {
update();
}
});

return me;
Expand Down
4 changes: 4 additions & 0 deletions strengthify.css
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@
* Copyright (c) 2013 Morris Jobke <morris.jobke@gmail.com>
*/

.strengthify-wrapper {
position: relative;
}

.strengthify-wrapper > * {
-ms-filter:"progid:DXImageTransform.Microsoft.Alpha(Opacity=0)";
filter: alpha(opacity=0);
Expand Down