Skip to content

Commit ffa008a

Browse files
committed
as per @johnhawkinson's suggestion from #9, use a placeholder for the label input box,
making it easier to figure out how to use this after multiple keys were added the placeholder will also show no keys at all were added, but an empty list is still a list after all ;-) also replace the XXXXXX with grayed-out 000000 for the non-yet generated TOTP code (text and color configurable via css / userContent.css)
1 parent fbc54a1 commit ffa008a

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

form.html

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@
99
#CODE { font: 250% monospace; letter-spacing: .15em; user-select: all }
1010
#CODE::after { all: initial; content: ' ' attr(title); color: red; pointer-events: none }
1111
#CODE[title^="copied!"]::after { color: green }
12+
#CODE:empty::before { content: '000000'; color: lightgray }
13+
::placeholder { color: #aaaaaa }
1214

1315
input, button { font: inherit }
1416
#USER, #KEY { box-sizing: border-box; width: 100%; max-width: 25em }
@@ -24,14 +26,14 @@
2426

2527
<form id=FORM>
2628
<label for=USER>User</label><br>
27-
<input id=USER size=27 autocomplete=username>
29+
<input id=USER size=27 autocomplete=username placeholder="click for the list of saved keys">
2830
<p>
2931
<label for=KEY>Shared Key</label>
3032
<label><input type=checkbox id=SHOW>show</label><br>
3133
<input id=KEY size=27 autocomplete=current-password type=password pattern="[a-zA-Z2-7\s]+">
3234
<output for=KEY id=ERROR></output>
3335
</p>
34-
<output for=KEY id=CODE>XXXXXX</output>
36+
<output for=KEY id=CODE></output>
3537
<a id=ADD href target=_blank>add key</a>
3638
<p><button type=button id=GENERATE>Generate TOTP (and copy it to clipboard)</button>
3739
<p><button>Save the key (with the browser's password manager)</button>

form.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ function select_is_broken(){
1010
return /\(X11;.* Gecko\//.exec(navigator.userAgent);
1111
}
1212
async function copy(emsg, select){
13+
if(CODE.value === '') return
1314
try {
1415
await navigator.clipboard.writeText(CODE.value);
1516
CODE.title = 'copied!';

0 commit comments

Comments
 (0)