Sha256: 17d43cb68a6f80e671e733cf8428593546c04d3dffc60198cdd6b14c628c3fb4
Contents?: true
Size: 1.84 KB
Versions: 1
Compression:
Stored size: 1.84 KB
Contents
(function(initializer) { if (typeof(module) === "object" && module.exports) { module.exports = initializer; } else if (typeof(require) === "function" && require.amd) { require(["password_strength", "jquery"], initializer); } else { initializer(window.PasswordStrength, window.jQuery); } }(function(PasswordStrength, $){ $.strength = function(username, password, options, callback) { if (typeof(options) == "function") { callback = options; options = {}; } else if (!options) { options = {}; } var usernameField = $(username); var passwordField = $(password); var strength = new PasswordStrength(); strength.exclude = options["exclude"]; callback = callback || $.strength.callback; var handler = function(){ strength.username = $(usernameField).val(); if ($(usernameField).length == 0) { strength.username = username; } strength.password = $(passwordField).val(); if ($(passwordField).length == 0) { strength.password = password; } strength.test(); callback(usernameField, passwordField, strength); }; $(usernameField).keydown(handler); $(usernameField).keyup(handler); $(passwordField).keydown(handler); $(passwordField).keyup(handler); }; $.extend($.strength, { callback: function(username, password, strength){ var img = $(password).next("img.strength"); if (!img.length) { $(password).after("<img class='strength'>"); img = $("img.strength"); } $(img) .removeClass("weak") .removeClass("good") .removeClass("strong") .addClass(strength.status) .attr("src", $.strength[strength.status + "Image"]); }, weakImage: "/images/weak.png", goodImage: "/images/good.png", strongImage: "/images/strong.png" }); }));
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
password_strength-1.1.4 | app/assets/javascripts/jquery_strength.js |