Bugfix on UI elements when no secret is found. Add copy secret button on successful retrieval. Include deployment information and updated example files.

This commit is contained in:
2022-12-27 12:25:14 -06:00
parent c3a3374e45
commit ee8686bc83
11 changed files with 91 additions and 113 deletions

View File

@ -172,9 +172,17 @@ input[type=number]
box-shadow: 8px 8px 12px #ccc
.pwResult
margin: 0.25em 0 0.75em 0
font-size: 1.5em
color: #f0f6f0
.pwResultCopy
width: 1px
overflow: hidden
display: inline-block
height: 1px
color: rgba(255,255,255,0)
.shareNew
padding: 0.5em 0.5em 0.5em 1.5em
background-color: #{colorTwo}

View File

@ -5,6 +5,7 @@ $doctype 5
<title>purr
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<script src="https://unpkg.com/htmx.org@1.7.0" integrity="sha384-EzBXYPt0/T6gxNp0nuPtLkmRpmDBbjg6WmCUZRLXBBwYYmwAUxzlSGej0ARHX0Bo" crossorigin="anonymous">
<script src="/copySecret.js" integrity="sha384-jB3mpB1WyAo8ToD7oWm/LjXBnEImM/8GB7tjExykwuNErwdPHa9mihHlVJRtV+bt">
<link rel="stylesheet" href="/style.css">
<body>

View File

@ -0,0 +1,10 @@
function copySecret(secret) {
var tempText = document.createElement('input');
tempText.style = 'position: absolute; left: -1000px; top: -1000px';
tempText.value = secret;
document.body.appendChild(tempText);
tempText.select();
document.execCommand('copy');
document.body.removeChild(tempText);
document.getElementById('copyButton').innerHTML = "- secret copied -";
}

View File

@ -2,5 +2,7 @@
$maybe pw <- password
<p .resLink>secret found at <a href="/pw/#{link}">/pw/#{link}</a>:
<h3 .pwResult>#{pw}
<button #copyButton .mainButton onclick="copySecret('#{pw}')">copy secret</button>
$nothing
<h3 .pwResult>no secret found at <a href="/pw/#{link}">/pw/#{link}</a>
<p .resLink>no secret found at
<br /><a href="/pw/#{link}">/pw/#{link}</a>