diff options
| author | Mitchell Riedstra <mitch@riedstra.dev> | 2024-01-05 23:18:49 -0500 |
|---|---|---|
| committer | Mitchell Riedstra <mitch@riedstra.dev> | 2024-01-05 23:18:49 -0500 |
| commit | bd5a00c61b355c857b5c99323592ca432dea5d0a (patch) | |
| tree | 7e8ac7730527c1ad71e3fdac85840948fd23f45f /htmx/static/pico-1.5.11/docs/js/grid.min.js | |
| parent | c71b37eb23d4c8af7ab983de34c6da5be9363f3a (diff) | |
| download | paste-bd5a00c61b355c857b5c99323592ca432dea5d0a.tar.gz paste-bd5a00c61b355c857b5c99323592ca432dea5d0a.tar.xz | |
wip
Diffstat (limited to 'htmx/static/pico-1.5.11/docs/js/grid.min.js')
| -rw-r--r-- | htmx/static/pico-1.5.11/docs/js/grid.min.js | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/htmx/static/pico-1.5.11/docs/js/grid.min.js b/htmx/static/pico-1.5.11/docs/js/grid.min.js new file mode 100644 index 0000000..08aef03 --- /dev/null +++ b/htmx/static/pico-1.5.11/docs/js/grid.min.js @@ -0,0 +1,15 @@ +"use strict";const grid={buttons:{text:{add:"Add column",remove:"Remove column"},target:"#grid article"},grid:{current:4,min:1,max:12,gridTarget:"#grid .grid",codeTarget:"#grid pre code"},init(){this.addButtons(),this.generateGrid()},addButtons(){var t=document.createElement("P");t.innerHTML=` + <button class="secondary add"> + <svg xmlns="http://www.w3.org/2000/svg" height="16px" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="3" stroke-linecap="round" stroke-linejoin="round"> + <line x1="12" y1="5" x2="12" y2="19"></line> + <line x1="5" y1="12" x2="19" y2="12">'</line> + </svg> + ${this.buttons.text.add} + </button> + + <button class="secondary remove"> + <svg xmlns="http://www.w3.org/2000/svg" height="16px" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="3" stroke-linecap="round" stroke-linejoin="round"> + <line x1="5" y1="12" x2="19" y2="12"></line> + </svg> + ${this.buttons.text.remove} + </button>`,document.querySelector(this.buttons.target).before(t),document.querySelector("#grid button.add").addEventListener("click",()=>{this.addColumn()},!1),document.querySelector("#grid button.remove").addEventListener("click",()=>{this.removeColumn()},!1)},generateGrid(){let e="",r='<<b>div</b> <i>class</i>=<u>"grid"</u>>\n';for(let t=0;t<this.grid.current;t++)e+="<div>"+(t+1)+"</div>",r+=" <<b>div</b>>"+(t+1)+"</<b>div</b>>\n";r+="</<b>div</b>>",document.querySelector(this.grid.gridTarget).innerHTML=e,document.querySelector(this.grid.codeTarget).innerHTML=r},addColumn(){this.grid.current<this.grid.max&&(this.grid.current++,this.generateGrid())},removeColumn(){this.grid.current>this.grid.min&&(this.grid.current--,this.generateGrid())}};grid.init();
\ No newline at end of file |
