mirror of
https://github.com/quantum5/correcthorsebatterystaple.git
synced 2025-07-26 19:44:12 -04:00
Compare commits
2 commits
8a3d1f1d85
...
6b540a940e
Author | SHA1 | Date | |
---|---|---|---|
|
6b540a940e | ||
|
ab7e4d0138 |
33
src/ui.js
33
src/ui.js
|
@ -55,15 +55,26 @@ $(() => {
|
|||
updateBitMeter()
|
||||
}
|
||||
|
||||
function generatePassword () {
|
||||
const options = $options.serializeObject()
|
||||
$output.text(generate(options)).removeClass('placeholder')
|
||||
$('#copy-password').prop('disabled', false)
|
||||
return false
|
||||
}
|
||||
|
||||
const settings = window.localStorage.getItem('settings')
|
||||
if (settings) {
|
||||
try {
|
||||
loadSettings(JSON.parse(settings))
|
||||
} catch (e) {
|
||||
console.log(e)
|
||||
}
|
||||
}
|
||||
|
||||
if (window.crypto && window.crypto.getRandomValues) {
|
||||
$('#too-old').hide()
|
||||
|
||||
$('#run-generator').click(() => {
|
||||
const options = $options.serializeObject()
|
||||
$output.text(generate(options)).removeClass('placeholder')
|
||||
$('#copy-password').prop('disabled', false)
|
||||
return false
|
||||
})
|
||||
$('#run-generator').click(generatePassword)
|
||||
|
||||
$('#save-settings').click(() => {
|
||||
const options = $options.serializeObject()
|
||||
|
@ -80,14 +91,6 @@ $(() => {
|
|||
$options.find('select, input').change(updateBitMeter)
|
||||
$options.find('input[type=number]').on('input', updateBitMeter)
|
||||
updateBitMeter()
|
||||
}
|
||||
|
||||
const settings = window.localStorage.getItem('settings')
|
||||
if (settings) {
|
||||
try {
|
||||
loadSettings(JSON.parse(settings))
|
||||
} catch (e) {
|
||||
console.log(e)
|
||||
}
|
||||
generatePassword()
|
||||
}
|
||||
})
|
||||
|
|
Loading…
Reference in a new issue