mirror of
https://github.com/bigskysoftware/htmx.git
synced 2025-10-02 15:25:26 +00:00
hyperscript powered copy buttons let's GO
This commit is contained in:
parent
393b0bb70c
commit
c9b0444b54
@ -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>
|
Loading…
x
Reference in New Issue
Block a user