hyperscript powered copy buttons let's GO

This commit is contained in:
Carson Gross 2023-06-26 09:34:54 -06:00
parent 393b0bb70c
commit c9b0444b54

View File

@ -31,4 +31,22 @@ JSON is normally used in combination with SPA libraries: the whole system
is basically RPC with JSON added, or JSON/RPC. All these so-called "REST-ful"
APIs are really JSON/RPC.
</div>
</div>
<button _="on click
get the innerText of the previous <div/>
then writeText(the result) with the navigator's clipboard
put 'Copied!' into the next <output/>
wait 2s
put '' into the next <output/>">
Copy
</button>
<button _="on click
get the innerText of the previous <div/>
get result.split('\n').map( \ l -> ' ' + l ).join('\n')
then writeText(the result) with the navigator's clipboard
put 'Copied for HN!' into the next <output/>
wait 2s
put '' into the next <output/>">
Copy For HN
</button>
<output></output>