Skip to content

Commit 82a3bda

Browse files
committed
Hopefully fixed capitalization of old-fashioned version of password.
1 parent 3582d29 commit 82a3bda

1 file changed

Lines changed: 8 additions & 2 deletions

File tree

ThreeRandomWords.html

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,6 @@
3939
#oldFashioned {
4040
text-indent: 4em;
4141
color: blue;
42-
text-transform: capitalize;
4342
}
4443
</style>
4544

@@ -56,7 +55,7 @@ <h2>Your New Password</h2>
5655

5756
<p>For websites that have old-fashioned constraints&mdash;such as demands for capitals, numbers and non-alphanumerics&mdash;copy and paste the following, which is just as secure: </p>
5857

59-
<p id="oldFashioned"><span class="word1"></span><span class="word2"></span><span class="word3"></span>9!</p>
58+
<p id="oldFashioned"><span class="word1c"></span><span class="word2c"></span><span class="word3c"></span>9!</p>
6059

6160
<p>Don't like the password? Refresh the page to select another.</p>
6261

@@ -78,6 +77,9 @@ <h2>Your New Password</h2>
7877
<!-- ****************************************** Javascript *********************************************** -->
7978

8079
<script type="text/javascript">
80+
function capitalize(word) {
81+
return word ? word.charAt(0).toUpperCase() + word.slice(1).toLowerCase() : '';
82+
}
8183

8284
$.get('https://raw.githubusercontent.com/first20hours/google-10000-english/master/google-10000-english-no-swears.txt', function(passwordFile) {
8385
var passwords = (passwordFile.split(/\s+/) // Ignore different line endings
@@ -88,6 +90,10 @@ <h2>Your New Password</h2>
8890
$(".word1").text(passwords[randomIntegers[0] % passwords.length]);
8991
$(".word2").text(passwords[randomIntegers[1] % passwords.length]);
9092
$(".word3").text(passwords[randomIntegers[2] % passwords.length]);
93+
$(".word1c").text(capitalize(passwords[randomIntegers[0] % passwords.length]));
94+
$(".word2c").text(capitalize(passwords[randomIntegers[1] % passwords.length]));
95+
$(".word3c").text(capitalize(passwords[randomIntegers[2] % passwords.length]));
96+
9197
}, 'text');
9298

9399
</script>

0 commit comments

Comments
 (0)