Compare commits
1
Commits
v0.5.1
...
c32566979f
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
c32566979f |
@@ -580,6 +580,14 @@ a.admin-link:hover { color: var(--fg); text-decoration: underline; }
|
|||||||
outline-offset: 1px;
|
outline-offset: 1px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* swapbtn (#260): the label and the checkmark occupy the same grid cell, so
|
||||||
|
toggling feedback never changes the button's width — no pinning needed */
|
||||||
|
.swapbtn { display: inline-grid; }
|
||||||
|
.swapbtn > * { grid-area: 1 / 1; }
|
||||||
|
.swapbtn .btn-check { visibility: hidden; }
|
||||||
|
.swapbtn.ok .btn-check { visibility: visible; }
|
||||||
|
.swapbtn.ok .btn-label { visibility: hidden; }
|
||||||
|
|
||||||
/* in-place copy success feedback (#53) */
|
/* in-place copy success feedback (#53) */
|
||||||
.iconbtn.ok, .btn.ok {
|
.iconbtn.ok, .btn.ok {
|
||||||
color: var(--ok);
|
color: var(--ok);
|
||||||
|
|||||||
@@ -192,18 +192,14 @@ async function create() {
|
|||||||
// button, password auto-unlock, then redirect to the paste.
|
// button, password auto-unlock, then redirect to the paste.
|
||||||
function finishCreate(data) {
|
function finishCreate(data) {
|
||||||
const url = location.origin + '/' + (data.custom_slug || data.id);
|
const url = location.origin + '/' + (data.custom_slug || data.id);
|
||||||
showResult('<a href="' + url + '">' + url + '</a> <button class="btn btn-icon" id="result-copy" title="Copy URL" type="button">⧉</button>', 'ok');
|
showResult('<a href="' + url + '">' + url + '</a> <button class="btn btn-icon swapbtn" id="result-copy" title="Copy URL" type="button"><span class="btn-label">⧉</span><span class="btn-check">✓</span></button>', 'ok');
|
||||||
$('result').dataset.token = data.deletion_token || '';
|
$('result').dataset.token = data.deletion_token || '';
|
||||||
const copyBtn = document.getElementById('result-copy');
|
const copyBtn = document.getElementById('result-copy');
|
||||||
copyBtn.addEventListener('click', () => {
|
copyBtn.addEventListener('click', () => {
|
||||||
try {
|
try {
|
||||||
navigator.clipboard.writeText(url);
|
navigator.clipboard.writeText(url);
|
||||||
copyBtn.classList.add('ok'); // in-place success feedback (#53)
|
copyBtn.classList.add('ok'); // in-place success feedback (#53)
|
||||||
// #260: pin the pre-swap width so the wider/narrower glyph never
|
setTimeout(() => copyBtn.classList.remove('ok'), 2000);
|
||||||
// shifts neighbouring elements; release it when the label restores.
|
|
||||||
copyBtn.style.minWidth = Math.ceil(copyBtn.getBoundingClientRect().width) + 'px';
|
|
||||||
copyBtn.textContent = '✓';
|
|
||||||
setTimeout(() => { copyBtn.classList.remove('ok'); copyBtn.textContent = '⧉'; copyBtn.style.minWidth = ''; }, 2000);
|
|
||||||
} catch(e) { toast('Copy failed', 'error'); }
|
} catch(e) { toast('Copy failed', 'error'); }
|
||||||
});
|
});
|
||||||
// token carried via sessionStorage, never in the URL (#143)
|
// token carried via sessionStorage, never in the URL (#143)
|
||||||
|
|||||||
@@ -18,17 +18,11 @@ function toggleStats() {
|
|||||||
}
|
}
|
||||||
function copyFeedback(btn) {
|
function copyFeedback(btn) {
|
||||||
if (!btn) return;
|
if (!btn) return;
|
||||||
if (!btn.dataset.label) btn.dataset.label = btn.textContent; // remember the original label (Copy/Link)
|
// #260: the .swapbtn grid stacks label + checkmark in one cell, so the
|
||||||
// #260: keep the button width static during the feedback so surrounding
|
// width is static by construction — feedback is a pure class toggle.
|
||||||
// elements never jump. Pin the pre-swap width, release it on restore.
|
|
||||||
if (!btn.dataset.pinned) {
|
|
||||||
btn.style.minWidth = Math.ceil(btn.getBoundingClientRect().width) + 'px';
|
|
||||||
btn.dataset.pinned = '1';
|
|
||||||
}
|
|
||||||
btn.classList.add('ok');
|
btn.classList.add('ok');
|
||||||
btn.textContent = '✓';
|
|
||||||
clearTimeout(btn._okh);
|
clearTimeout(btn._okh);
|
||||||
btn._okh = setTimeout(() => { btn.classList.remove('ok'); btn.textContent = btn.dataset.label; }, 2000);
|
btn._okh = setTimeout(() => btn.classList.remove('ok'), 2000);
|
||||||
}
|
}
|
||||||
function copyContent(btn) {
|
function copyContent(btn) {
|
||||||
navigator.clipboard.writeText(document.getElementById('raw-content').value)
|
navigator.clipboard.writeText(document.getElementById('raw-content').value)
|
||||||
|
|||||||
@@ -8,8 +8,8 @@
|
|||||||
<div class="spacer"></div>
|
<div class="spacer"></div>
|
||||||
<button type="button" class="iconbtn wrap-toggle" title="Toggle line wrap" aria-pressed="false">Wrap</button>
|
<button type="button" class="iconbtn wrap-toggle" title="Toggle line wrap" aria-pressed="false">Wrap</button>
|
||||||
<a class="iconbtn" href="/raw/{{.ID}}">Raw</a>
|
<a class="iconbtn" href="/raw/{{.ID}}">Raw</a>
|
||||||
<a class="iconbtn" href="#" id="copy-link-btn">Link</a>
|
<a class="iconbtn swapbtn" href="#" id="copy-link-btn"><span class="btn-label">Link</span><span class="btn-check">✓</span></a>
|
||||||
<a class="iconbtn" href="#" id="copy-btn">Copy</a>
|
<a class="iconbtn swapbtn" href="#" id="copy-btn"><span class="btn-label">Copy</span><span class="btn-check">✓</span></a>
|
||||||
{{if .DeletionToken}}<a class="iconbtn danger" href="#" id="delete-btn">Delete</a>{{end}}
|
{{if .DeletionToken}}<a class="iconbtn danger" href="#" id="delete-btn">Delete</a>{{end}}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
Reference in New Issue
Block a user