12 lines
775 B
JavaScript
12 lines
775 B
JavaScript
|
|
// ═══════════════════════════════════════════════════════
|
||
|
|
// Base64
|
||
|
|
// ═══════════════════════════════════════════════════════
|
||
|
|
async function base64Op(op) {
|
||
|
|
const text = document.getElementById('b64Input').value;
|
||
|
|
if (!text) return setStatus('b64Status','error','Enter some text.');
|
||
|
|
const d = await apiPost('/api/base64/' + op, { text });
|
||
|
|
if (d.success) { document.getElementById('b64Output').value = d.result; setStatus('b64Status','success', op === 'encode' ? 'Encoded ✓' : 'Decoded ✓'); }
|
||
|
|
else setStatus('b64Status','error', d.error);
|
||
|
|
}
|
||
|
|
|