Fix #168: compact corner notification pill for paste creation
This commit is contained in:
@@ -198,11 +198,17 @@ body {
|
||||
border: 1px solid var(--border); border-radius: var(--radius); padding: 5px 8px; background: var(--bg);
|
||||
color: var(--fg); font: inherit; font-size: 21.6px; width: 130px;
|
||||
}
|
||||
.created-banner {
|
||||
display: none; padding: 10px 16px; font-size: 22.4px; background: var(--surface-2);
|
||||
border-bottom: 1px solid var(--border); word-break: break-all;
|
||||
/* #168: compact corner notification pill (paste-created feedback) */
|
||||
.created-pill {
|
||||
position: fixed; right: 16px; bottom: 16px; z-index: 200;
|
||||
background: var(--surface-2); color: var(--ok); border: 1px solid var(--ok);
|
||||
border-radius: var(--radius-sm); padding: 4px 12px; font-size: 13px;
|
||||
opacity: 0; pointer-events: none; transform: translateY(6px);
|
||||
transition: opacity .25s ease, transform .25s ease;
|
||||
box-shadow: 0 4px 16px rgba(0,0,0,.25);
|
||||
}
|
||||
.created-banner a { color: var(--accent); }
|
||||
.created-pill.show { opacity: 1; transform: translateY(0); }
|
||||
@media (max-width: 640px) { .created-pill { right: 12px; bottom: 12px; } }
|
||||
|
||||
/* paste view */
|
||||
.meta-bar { display: flex; align-items: center; gap: 12px; padding: 12px 18px; flex-wrap: wrap; }
|
||||
@@ -620,7 +626,6 @@ a.admin-link:hover { color: var(--fg); text-decoration: underline; }
|
||||
.code { font-size: 13px; }
|
||||
.codebody { padding: 0 12px; }
|
||||
.footnote { font-size: 12px; padding: 8px 12px; gap: 10px; }
|
||||
.created-banner { font-size: 13px; }
|
||||
.iconbtn { font-size: 13px; padding: 6px 10px; }
|
||||
|
||||
/* unlock card */
|
||||
@@ -799,4 +804,3 @@ button[type="submit"]:focus-visible,
|
||||
.mt18 { margin-top: 18px; }
|
||||
.toggle-inline { display: inline-flex; }
|
||||
.wrap-normal { word-break: normal; overflow-wrap: break-word; }
|
||||
.created-banner.show { display: block; }
|
||||
|
||||
@@ -42,6 +42,13 @@ var PASTE_ID = document.currentScript.getAttribute('data-paste-id');
|
||||
var copyBtn = document.getElementById('copy-btn');
|
||||
if (copyBtn) copyBtn.addEventListener('click', function (e) { e.preventDefault(); copyContent(copyBtn); });
|
||||
var delBtn = document.getElementById('delete-btn');
|
||||
|
||||
// #168: show the compact paste-created pill in the bottom corner, then fade it out
|
||||
const createdPill = document.getElementById('created-pill');
|
||||
if (createdPill) {
|
||||
requestAnimationFrame(() => createdPill.classList.add('show'));
|
||||
setTimeout(() => createdPill.classList.remove('show'), 4000);
|
||||
}
|
||||
if (delBtn) delBtn.addEventListener('click', function (e) { e.preventDefault(); redeem(); });
|
||||
var statsToggle = document.getElementById('stats-toggle');
|
||||
if (statsToggle) statsToggle.addEventListener('click', toggleStats);
|
||||
|
||||
@@ -28,7 +28,6 @@
|
||||
<textarea class="editor" id="content" placeholder="Paste your code, text, or notes here…" spellcheck="false"></textarea>
|
||||
<img id="file-preview" class="file-preview hidden" alt="File preview">
|
||||
</div>
|
||||
<div class="created-banner" id="created"></div>
|
||||
<div class="actionbar">
|
||||
<span class="hint">Ctrl+Enter to create</span>
|
||||
<div class="spacer spacer-flex"></div>
|
||||
|
||||
@@ -34,12 +34,7 @@
|
||||
</div>
|
||||
</div>
|
||||
{{if .JustCreated}}
|
||||
<div class="float">
|
||||
<div class="created-banner show">
|
||||
Paste created. Link copied to clipboard: <a href="/{{.ID}}">{{.Host}}/{{.ID}}</a>
|
||||
{{if .DeletionToken}} · deletion token: <code>{{.DeletionToken}}</code>{{end}}
|
||||
</div>
|
||||
</div>
|
||||
<div class="created-pill" id="created-pill" role="status">Paste Created · Link Copied</div>
|
||||
{{end}}
|
||||
{{if .Attachment}}
|
||||
<div class="float">
|
||||
|
||||
+1
-1
@@ -352,7 +352,7 @@ func (h *Handlers) HandlePasteView(w http.ResponseWriter, r *http.Request) {
|
||||
token = c.Value
|
||||
}
|
||||
if justCreated && token != "" {
|
||||
// one-time display of the deletion token via the created banner
|
||||
// one-time display of the deletion token via sessionStorage (#143)
|
||||
http.SetCookie(w, &http.Cookie{Name: "tok_" + row.ID, Value: token, Path: "/", MaxAge: 60, HttpOnly: true, SameSite: http.SameSiteLaxMode})
|
||||
}
|
||||
// Count the view for real page renders, deduped per-viewer within the
|
||||
|
||||
Reference in New Issue
Block a user