From 72ab97bb45877483a42ab35ab53ba26a4dbde93a Mon Sep 17 00:00:00 2001 From: Robert Sesek Date: Sat, 9 Jun 2012 17:24:48 -0400 Subject: [PATCH] Select the password when you click the generated password label --- core.js | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/core.js b/core.js index 54a8f8a..78937c6 100644 --- a/core.js +++ b/core.js @@ -68,6 +68,8 @@ SkeletonKey.prototype.MIN_LENGTH = 6; */ SkeletonKey.prototype._init = function() { this._generateButton.onclick = this._onGenerate.bind(this); + + this._password.labels[0].onclick = this._selectPassword.bind(this); }; /** @@ -84,8 +86,7 @@ SkeletonKey.prototype._onGenerate = function(e) { var hexString = key.toString(); hexString = this._capitalizeKey(hexString); this._password.value = hexString; - this._password.focus(); - this._password.select(); + this._selectPassword(); }; /** @@ -131,3 +132,12 @@ SkeletonKey.prototype._capitalizeKey = function(key) { return newKey; }; + +/** + * Selects the contents of the generated password. + * @private + */ +SkeletonKey.prototype._selectPassword = function() { + this._password.focus(); + this._password.select(); +}; -- 2.43.5