Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions .jules/palette.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Palette UX Journal

This journal documents critical UX and accessibility learnings from the RTECH-TECHNOLOGIES project.

## 2026-04-18 - Copy Utility with Fallback
**Learning:** For terminal-style documentation, providing a copy utility significantly improves usability. However, relying solely on `navigator.clipboard` can fail in non-secure (HTTP) environments or older browsers. Implementing a hidden `textarea` fallback ensures the feature remains functional across all deployment scenarios common in industrial or internal testing environments.
**Action:** Use the robust copy-to-clipboard pattern with a visual "Copied!" state to provide immediate feedback and ensure cross-environment compatibility.
43 changes: 41 additions & 2 deletions os2.html
Original file line number Diff line number Diff line change
Expand Up @@ -84,8 +84,9 @@ <h4 class="text-lime-500 font-black text-xs uppercase mb-2">The Zest UI</h4>
</div>
</div>
</div>
<div class="code-window">
<pre class="text-lime-500 text-xs leading-loose">
<div class="code-window group">
<button onclick="copyCode(this)" class="absolute top-4 right-4 bg-zinc-900 border border-slate-700 text-slate-500 px-3 py-1 text-[10px] font-black uppercase transition-all opacity-0 group-hover:opacity-100 focus:opacity-100 hover:border-lime-500 hover:text-lime-500" aria-label="Copy assembly code">Copy</button>
<pre id="system-init-code" class="text-lime-500 text-xs leading-loose">
; OS*2 SYSTEM_INIT
move rdi 10 ; ALLOC_SOVEREIGNTY
push rdi ; SECURE_REGISTER
Expand Down Expand Up @@ -147,7 +148,45 @@ <h4 class="text-[10px] font-black text-slate-400 uppercase mb-6 tracking-widest"
</div>
</footer>


<script>
async function copyCode(btn) {
const code = document.getElementById('system-init-code').innerText.trim();
try {
if (navigator.clipboard && window.isSecureContext) {
await navigator.clipboard.writeText(code);
} else {
throw new Error('Fallback required');
}
} catch (err) {
try {
const textArea = document.createElement("textarea");
textArea.value = code;
textArea.style.position = "fixed";
textArea.style.left = "-9999px";
textArea.style.top = "0";
document.body.appendChild(textArea);
textArea.focus();
textArea.select();
document.execCommand('copy');
textArea.remove();
} catch (fallbackErr) {
console.error('Failed to copy fallback: ', fallbackErr);
return;
}
}

const originalText = btn.innerText;
btn.innerText = "Copied!";
const originalClasses = btn.className;
btn.className = "absolute top-4 right-4 bg-lime-500 border border-lime-500 text-black px-3 py-1 text-[10px] font-black uppercase transition-all opacity-100";

setTimeout(() => {
btn.innerText = originalText;
btn.className = originalClasses;
}, 2000);
}

async function checkAvailability() {
const btn = document.getElementById('download-btn');
const status = document.getElementById('system-status');
Expand Down