Skip to content
Open
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
41 changes: 39 additions & 2 deletions os2.html
Original file line number Diff line number Diff line change
Expand Up @@ -84,8 +84,15 @@ <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="copyToClipboard(this)"
class="absolute top-4 right-4 opacity-0 group-hover:opacity-100 focus:opacity-100 transition-opacity bg-slate-900 border border-slate-700 text-slate-400 hover:text-white px-3 py-1 text-[10px] font-black uppercase tracking-widest z-10"
aria-label="Copy code to clipboard"
>
Copy
</button>
<pre id="code-snippet" 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 @@ -148,6 +155,36 @@ <h4 class="text-[10px] font-black text-slate-400 uppercase mb-6 tracking-widest"
</footer>

<script>
function copyToClipboard(btn) {
const code = document.getElementById('code-snippet').innerText.trim();
const originalText = btn.innerText;

const handleSuccess = () => {
btn.innerText = 'Copied!';
btn.classList.add('!bg-lime-500', '!text-black', '!border-lime-500');
setTimeout(() => {
btn.innerText = originalText;
btn.classList.remove('!bg-lime-500', '!text-black', '!border-lime-500');
}, 2000);
};

if (navigator.clipboard && navigator.clipboard.writeText) {
navigator.clipboard.writeText(code).then(handleSuccess);
} else {
const textArea = document.createElement("textarea");
textArea.value = code;
document.body.appendChild(textArea);
textArea.select();
try {
document.execCommand('copy');
handleSuccess();
} catch (err) {
console.error('Fallback copy failed', err);
}
document.body.removeChild(textArea);
}
}

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