Skip to content

Commit 86a5383

Browse files
committed
Release v3.0.0
1 parent 4959dca commit 86a5383

File tree

9 files changed

+345
-347
lines changed

9 files changed

+345
-347
lines changed

CHANGES.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# CHANGELOG
22

3-
## 3.0.0dev
3+
## 3.0.0
44

55
- Bootstrap 4 by default.
66
- Improved support for Bootstrap 4.

OPTIONS.md

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -229,7 +229,7 @@ Let's see the options of each section.
229229

230230
Displays the password strength in a progress bar.
231231

232-
* __progressExtraCssClasses__: (Bootstrap 3&4 only)
232+
* __progressExtraCssClasses__: (Bootstrap 3 & 4 only)
233233

234234
Default: `""` (String)
235235

@@ -280,14 +280,14 @@ Let's see the options of each section.
280280
Default: `false` (Boolean)
281281

282282
Displays the error messages and the verdicts in a Bootstrap popover, instead
283-
of below the input field. Bootstrap tooltip.js and popover.js must to be
284-
included.
283+
of below the input field.
285284

286285
If the `showVerdictsInsideProgressBar` option is active, then the verdicts
287286
won't appear on the popover.
288287

289288
_Note: In Bootstrap 4, the popper.js library is required. More details in
290-
[the Bootstrap documentation](https://getbootstrap.com/docs/4.1/components/popovers/)._
289+
[the Bootstrap documentation](https://getbootstrap.com/docs/4.1/components/popovers/).
290+
In previous versions tooltip.js and popover.js must be included._
291291

292292
* __popoverPlacement__:
293293

@@ -354,8 +354,6 @@ Let's see the options of each section.
354354
on the popover if it is being showed. Also this option overrides the value of
355355
the _showVerdicts_ one.
356356

357-
This option is not available when using Bootstrap 4.
358-
359357
* __useVerdictCssClass__:
360358

361359
Default: `false` (Boolean)

bower.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "pwstrength-bootstrap",
3-
"version": "3.0.0dev",
3+
"version": "3.0.0",
44
"homepage": "https://github.com/ablanco/jquery.pwstrength.bootstrap",
55
"authors": [
66
"Alejandro Blanco <alejandro.b.e@gmail.com>"

dist/pwstrength-bootstrap.js

Lines changed: 34 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/*!
22
* jQuery Password Strength plugin for Twitter Bootstrap
3-
* Version: 2.2.1
3+
* Version: 3.0.0
44
*
55
* Copyright (c) 2008-2013 Tane Piper
66
* Copyright (c) 2013 Alejandro Blanco
@@ -416,7 +416,7 @@ defaultOptions.rules.commonPasswords = [
416416

417417
defaultOptions.ui = {};
418418
defaultOptions.ui.bootstrap2 = false;
419-
defaultOptions.ui.bootstrap4 = false;
419+
defaultOptions.ui.bootstrap3 = false;
420420
defaultOptions.ui.colorClasses = [
421421
"danger", "danger", "danger", "warning", "warning", "success"
422422
];
@@ -613,16 +613,16 @@ var ui = {};
613613
}
614614

615615
$.each(options.ui.colorClasses, function (idx, value) {
616-
if (options.ui.bootstrap4) {
617-
$bar.removeClass("bg-" + value);
618-
} else {
616+
if (options.ui.bootstrap2 || options.bootstrap3) {
619617
$bar.removeClass(cssPrefix + "bar-" + value);
618+
} else {
619+
$bar.removeClass("bg-" + value);
620620
}
621621
});
622-
if (options.ui.bootstrap4) {
623-
$bar.addClass("bg-" + options.ui.colorClasses[cssClass]);
624-
} else {
622+
if (options.ui.bootstrap2 || options.ui.bootstrap3) {
625623
$bar.addClass(cssPrefix + "bar-" + options.ui.colorClasses[cssClass]);
624+
} else {
625+
$bar.addClass("bg-" + options.ui.colorClasses[cssClass]);
626626
}
627627
$bar.css("width", percentage + '%');
628628
};
@@ -689,25 +689,44 @@ var ui = {};
689689
$el.find("+ .popover .popover-content").html(html);
690690
} else {
691691
// It's hidden
692-
popover.options.content = html;
692+
if (options.ui.bootstrap2 || options.ui.bootstrap3) {
693+
popover.options.content = html;
694+
} else {
695+
popover.config.content = html;
696+
}
693697
$el.popover("show");
694698
}
695699
};
696700

697701
ui.updateFieldStatus = function (options, $el, cssClass, remove) {
698-
var targetClass = options.ui.bootstrap2 ? ".control-group" : ".form-group",
699-
$container = $el.parents(targetClass).first();
702+
var $target = $el;
703+
704+
if (options.ui.bootstrap2) {
705+
$target = $el.parents(".control-group").first();
706+
} else if (options.ui.bootstrap3) {
707+
$target = $el.parents(".form-group").first();
708+
}
700709

701710
$.each(statusClasses, function (idx, css) {
702-
if (!options.ui.bootstrap2) { css = "has-" + css; }
703-
$container.removeClass(css);
711+
if (options.ui.bootstrap3) {
712+
css = "has-" + css;
713+
} else if (!options.ui.bootstrap2) { // BS4
714+
if (css === "error") { css = "danger"; }
715+
css = "border-" + css;
716+
}
717+
$target.removeClass(css);
704718
});
705719

706720
if (remove) { return; }
707721

708722
cssClass = statusClasses[Math.floor(cssClass / 2)];
709-
if (!options.ui.bootstrap2) { cssClass = "has-" + cssClass; }
710-
$container.addClass(cssClass);
723+
if (options.ui.bootstrap3) {
724+
cssClass = "has-" + cssClass;
725+
} else if (!options.ui.bootstrap2) { // BS4
726+
if (cssClass === "error") { cssClass = "danger"; }
727+
cssClass = "border-" + cssClass;
728+
}
729+
$target.addClass(cssClass);
711730
};
712731

713732
ui.percentage = function (options, score, maximun) {

dist/pwstrength-bootstrap.min.js

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/pwstrength-bootstrap.min.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

examples/pwstrength.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/*!
22
* jQuery Password Strength plugin for Twitter Bootstrap
3-
* Version: 3.0.0dev
3+
* Version: 3.0.0
44
*
55
* Copyright (c) 2008-2013 Tane Piper
66
* Copyright (c) 2013 Alejandro Blanco

0 commit comments

Comments
 (0)