Update strengthify to 0.4.2

* includes local changes (ported them to upstream - see #10625)
* tipsy -> tooltip
* re-renders the element on scroll of a parent - fixes #20454
This commit is contained in:
Morris Jobke 2015-11-16 11:16:38 +01:00
parent 1e9203cdef
commit b1abef77e4
5 changed files with 39 additions and 36 deletions

View File

@ -24,7 +24,7 @@
"select2": "~3.4.8", "select2": "~3.4.8",
"zxcvbn": "*", "zxcvbn": "*",
"snapjs": "~2.0.0-rc1", "snapjs": "~2.0.0-rc1",
"strengthify": "0.4.1", "strengthify": "0.4.2",
"underscore": "~1.8.0", "underscore": "~1.8.0",
"bootstrap": "~3.3.5", "bootstrap": "~3.3.5",
"backbone": "~1.2.1" "backbone": "~1.2.1"

View File

@ -1,6 +1,6 @@
{ {
"name": "strengthify", "name": "strengthify",
"version": "0.4.1", "version": "0.4.2",
"homepage": "https://github.com/MorrisJobke/strengthify", "homepage": "https://github.com/MorrisJobke/strengthify",
"authors": [ "authors": [
"Morris Jobke <hey@morrisjobke.de>" "Morris Jobke <hey@morrisjobke.de>"
@ -8,13 +8,13 @@
"description": "Combine jQuery and zxcvbn to create a password strength meter.", "description": "Combine jQuery and zxcvbn to create a password strength meter.",
"main": "jquery.strengthify.js", "main": "jquery.strengthify.js",
"license": "MIT", "license": "MIT",
"_release": "0.4.1", "_release": "0.4.2",
"_resolution": { "_resolution": {
"type": "version", "type": "version",
"tag": "0.4.1", "tag": "v0.4.2",
"commit": "fe9d1c80156d3fcdd16434ebc789007d045c1d1f" "commit": "b3df9344d829063564cdced3c6328b001bc4bad1"
}, },
"_source": "git://github.com/MorrisJobke/strengthify.git", "_source": "git://github.com/MorrisJobke/strengthify.git",
"_target": "0.4.1", "_target": "0.4.2",
"_originalSource": "strengthify" "_originalSource": "strengthify"
} }

View File

@ -1,6 +1,6 @@
The MIT License (MIT) The MIT License (MIT)
Copyright (c) 2013 Morris Jobke Copyright (c) 2013-2015 Morris Jobke
Permission is hereby granted, free of charge, to any person obtaining a copy of Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in this software and associated documentation files (the "Software"), to deal in

View File

@ -1,15 +1,15 @@
/** /**
* Strengthify - show the weakness of a password (uses zxcvbn for this) * Strengthify - show the weakness of a password (uses zxcvbn for this)
* https://github.com/kabum/strengthify * https://github.com/MorrisJobke/strengthify
* *
* Version: 0.4.1 * Version: 0.4.2
* Author: Morris Jobke (github.com/kabum) * Author: Morris Jobke (github.com/MorrisJobke)
* *
* License: * License:
* *
* The MIT License (MIT) * The MIT License (MIT)
* *
* Copyright (c) 2013 Morris Jobke <morris.jobke@gmail.com> * Copyright (c) 2013-2015 Morris Jobke <morris.jobke@gmail.com>
* *
* Permission is hereby granted, free of charge, to any person obtaining a copy of * Permission is hereby granted, free of charge, to any person obtaining a copy of
* this software and associated documentation files (the "Software"), to deal in * this software and associated documentation files (the "Software"), to deal in
@ -43,23 +43,9 @@
'Perfect' 'Perfect'
] ]
}, },
options = $.extend(defaults, paramOptions); options = $.extend(defaults, paramOptions),
drawStrengthify = function() {
// add elements var password = $(me).val(),
$('.strengthify-wrapper')
.append('<div class="strengthify-bg" />')
.append('<div class="strengthify-container" />')
.append('<div class="strengthify-separator" style="left: 25%" />')
.append('<div class="strengthify-separator" style="left: 50%" />')
.append('<div class="strengthify-separator" style="left: 75%" />');
$.ajax({
cache: true,
dataType: 'script',
url: options.zxcvbn
}).done(function() {
me.bind('keyup input change', function() {
var password = $(this).val(),
// hide strengthigy if no input is provided // hide strengthigy if no input is provided
opacity = (password === '') ? 0 : 1, opacity = (password === '') ? 0 : 1,
// calculate result // calculate result
@ -107,15 +93,15 @@
$wrapper.attr( $wrapper.attr(
'title', 'title',
options.titles[result.score] options.titles[result.score]
).tipsy({ ).tooltip({
placement: 'bottom',
trigger: 'manual', trigger: 'manual',
opacity: opacity }).tooltip(
}).tipsy(
'show' 'show'
); );
if(opacity === 0) { if(opacity === 0) {
$wrapper.tipsy( $wrapper.tooltip(
'hide' 'hide'
); );
} }
@ -125,7 +111,24 @@
$container.css('width', 0); $container.css('width', 0);
} }
}); };
// add elements
$('.strengthify-wrapper')
.append('<div class="strengthify-bg" />')
.append('<div class="strengthify-container" />')
.append('<div class="strengthify-separator" style="left: 25%" />')
.append('<div class="strengthify-separator" style="left: 50%" />')
.append('<div class="strengthify-separator" style="left: 75%" />');
me.parents().on('scroll', drawStrengthify);
$.ajax({
cache: true,
dataType: 'script',
url: options.zxcvbn
}).done(function() {
me.bind('keyup input change', drawStrengthify);
}); });
return me; return me;

View File

@ -1,7 +1,7 @@
/** /**
* Strengthify - show the weakness of a password (uses zxcvbn for this) * Strengthify - show the weakness of a password (uses zxcvbn for this)
* https://github.com/kabum/strengthify * https://github.com/MorrisJobke/strengthify
* Version: 0.3 * Version: 0.4.2
* License: The MIT License (MIT) * License: The MIT License (MIT)
* Copyright (c) 2013 Morris Jobke <morris.jobke@gmail.com> * Copyright (c) 2013 Morris Jobke <morris.jobke@gmail.com>
*/ */