3 files changed,
+17
−1
internal/docs/brand/list.js
+15 −0
internal/docs/render.go
+1 −1
internal/docs/views/list.html
+1 −0
| new file mode 100644 |
| index 0000000..3e5db20 |
| --- /dev/null |
| +++ b/internal/docs/brand/list.js |
| @@ -0,0 +1,15 @@ |
| +/* list.js: the document list's search field. On a results page, the |
| + field's own clear button (the × a search input draws) clears the |
| + search, not just the field: emptying it goes back to every document, |
| + and the "Clear search" link under the results, which is the same way |
| + out for a reader with no script, is taken away as redundant. */ |
| +(function () { |
| + "use strict"; |
| + var input = document.querySelector("[docs-search-input]"); |
| + if (!input || !input.value) return; |
| + var clear = document.querySelector("[docs-search-clear]"); |
| + if (clear) clear.hidden = true; |
| + input.addEventListener("input", function () { |
| + if (input.value === "") location.assign("/"); |
| + }); |
| +})(); |
| index f960a67..6cda77d 100644 |
| --- a/internal/docs/render.go |
| +++ b/internal/docs/render.go |
| @@ -739,7 +739,7 @@ func vendoredStaticFS() (fs.FS, error) { |
| "static/estilo/sky.css": {Data: sky.CSS()}, |
| "static/estilo/chrome.js": {Data: chrome.JS()}, |
| } |
| - for _, name := range []string{"icon-32.png", "apple-touch-icon.png", "brand.css", "LICENSE.lucide", "light.css", "pointer.js"} { |
| + for _, name := range []string{"icon-32.png", "apple-touch-icon.png", "brand.css", "LICENSE.lucide", "light.css", "pointer.js", "list.js"} { |
| body, err := brandFS.ReadFile("brand/" + name) |
| if err != nil { |
| return nil, err |
| index 65c23dd..d2c10f6 100644 |
| --- a/internal/docs/views/list.html |
| +++ b/internal/docs/views/list.html |
| @@ -524,4 +524,5 @@ |
| {{end}} |
| </div> |
| {{template "docs-jumpto" .}} |
| +<script defer src="{{asset "static/brand/list.js"}}"></script> |
| {{end}} |