Skip to content

Commit 6748462

Browse files
committed
Release v3.1.0
1 parent e5df79f commit 6748462

File tree

7 files changed

+70
-14
lines changed

7 files changed

+70
-14
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.1.0dev
3+
## 3.1.0
44

55
- Allow chaining after setter methods.
66
- Bootstrap 5 support.

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.10",
3+
"version": "3.1.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: 32 additions & 4 deletions
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.10
3+
* Version: 3.1.0
44
*
55
* Copyright (c) 2008-2013 Tane Piper
66
* Copyright (c) 2013 Alejandro Blanco
@@ -938,7 +938,9 @@ var ui = {};
938938
ui.updatePopover = function(options, $el, verdictText, remove) {
939939
var popover = $el.data('bs.popover'),
940940
html = '',
941-
hide = true;
941+
hide = true,
942+
bootstrap5 = false,
943+
itsVisible = false;
942944

943945
if (
944946
options.ui.showVerdicts &&
@@ -965,14 +967,30 @@ var ui = {};
965967

966968
if (options.ui.bootstrap2) {
967969
popover = $el.data('popover');
970+
} else if (!popover) {
971+
// Bootstrap 5
972+
popover = bootstrap.Popover.getInstance($el[0]);
973+
bootstrap5 = true;
968974
}
969975

970-
if (popover.$arrow && popover.$arrow.parents('body').length > 0) {
971-
$el.find('+ .popover .popover-content').html(html);
976+
if (bootstrap5) {
977+
itsVisible = $(popover.tip).is(':visible');
978+
} else {
979+
itsVisible = popover.$arrow && popover.$arrow.parents('body').length > 0;
980+
}
981+
982+
if (itsVisible) {
983+
if (bootstrap5) {
984+
$(popover.tip).find('.popover-body').html(html);
985+
} else {
986+
$el.find('+ .popover .popover-content').html(html);
987+
}
972988
} else {
973989
// It's hidden
974990
if (options.ui.bootstrap2 || options.ui.bootstrap3) {
975991
popover.options.content = html;
992+
} else if (bootstrap5) {
993+
popover._config.content = html;
976994
} else {
977995
popover.config.content = html;
978996
}
@@ -1110,13 +1128,17 @@ var methods = {};
11101128
elements.$errors.remove();
11111129
$el.removeData('pwstrength-bootstrap');
11121130
});
1131+
1132+
return this;
11131133
};
11141134

11151135
methods.forceUpdate = function() {
11161136
this.each(function(idx, el) {
11171137
var event = { target: el };
11181138
onKeyUp(event);
11191139
});
1140+
1141+
return this;
11201142
};
11211143

11221144
methods.addRule = function(name, method, score, active) {
@@ -1127,6 +1149,8 @@ var methods = {};
11271149
options.rules.scores[name] = score;
11281150
options.rules.extra[name] = method;
11291151
});
1152+
1153+
return this;
11301154
};
11311155

11321156
applyToAll = function(rule, prop, value) {
@@ -1137,10 +1161,14 @@ var methods = {};
11371161

11381162
methods.changeScore = function(rule, score) {
11391163
applyToAll.call(this, rule, 'scores', score);
1164+
1165+
return this;
11401166
};
11411167

11421168
methods.ruleActive = function(rule, active) {
11431169
applyToAll.call(this, rule, 'activated', active);
1170+
1171+
return this;
11441172
};
11451173

11461174
methods.ruleIsMet = function(rule) {

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: 32 additions & 4 deletions
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.10
3+
* Version: 3.1.0
44
*
55
* Copyright (c) 2008-2013 Tane Piper
66
* Copyright (c) 2013 Alejandro Blanco
@@ -938,7 +938,9 @@ var ui = {};
938938
ui.updatePopover = function(options, $el, verdictText, remove) {
939939
var popover = $el.data('bs.popover'),
940940
html = '',
941-
hide = true;
941+
hide = true,
942+
bootstrap5 = false,
943+
itsVisible = false;
942944

943945
if (
944946
options.ui.showVerdicts &&
@@ -965,14 +967,30 @@ var ui = {};
965967

966968
if (options.ui.bootstrap2) {
967969
popover = $el.data('popover');
970+
} else if (!popover) {
971+
// Bootstrap 5
972+
popover = bootstrap.Popover.getInstance($el[0]);
973+
bootstrap5 = true;
968974
}
969975

970-
if (popover.$arrow && popover.$arrow.parents('body').length > 0) {
971-
$el.find('+ .popover .popover-content').html(html);
976+
if (bootstrap5) {
977+
itsVisible = $(popover.tip).is(':visible');
978+
} else {
979+
itsVisible = popover.$arrow && popover.$arrow.parents('body').length > 0;
980+
}
981+
982+
if (itsVisible) {
983+
if (bootstrap5) {
984+
$(popover.tip).find('.popover-body').html(html);
985+
} else {
986+
$el.find('+ .popover .popover-content').html(html);
987+
}
972988
} else {
973989
// It's hidden
974990
if (options.ui.bootstrap2 || options.ui.bootstrap3) {
975991
popover.options.content = html;
992+
} else if (bootstrap5) {
993+
popover._config.content = html;
976994
} else {
977995
popover.config.content = html;
978996
}
@@ -1110,13 +1128,17 @@ var methods = {};
11101128
elements.$errors.remove();
11111129
$el.removeData('pwstrength-bootstrap');
11121130
});
1131+
1132+
return this;
11131133
};
11141134

11151135
methods.forceUpdate = function() {
11161136
this.each(function(idx, el) {
11171137
var event = { target: el };
11181138
onKeyUp(event);
11191139
});
1140+
1141+
return this;
11201142
};
11211143

11221144
methods.addRule = function(name, method, score, active) {
@@ -1127,6 +1149,8 @@ var methods = {};
11271149
options.rules.scores[name] = score;
11281150
options.rules.extra[name] = method;
11291151
});
1152+
1153+
return this;
11301154
};
11311155

11321156
applyToAll = function(rule, prop, value) {
@@ -1137,10 +1161,14 @@ var methods = {};
11371161

11381162
methods.changeScore = function(rule, score) {
11391163
applyToAll.call(this, rule, 'scores', score);
1164+
1165+
return this;
11401166
};
11411167

11421168
methods.ruleActive = function(rule, active) {
11431169
applyToAll.call(this, rule, 'activated', active);
1170+
1171+
return this;
11441172
};
11451173

11461174
methods.ruleIsMet = function(rule) {

package.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.10",
3+
"version": "3.1.0",
44
"description": "jQuery plugin for Twitter Bootstrap that provides rulesets for visualy displaying the quality of a users typed in password.",
55
"author": "Alejandro Blanco <alejandro.b.e@gmail.com>",
66
"homepage": "https://github.com/ablanco/jquery.pwstrength.bootstrap",

0 commit comments

Comments
 (0)