Download this file
| 1 | /* brand/decks.js — the deck list's search field (Docs' brand/list.js). On a |
| 2 | result page the field's own clear button (the × a search input draws) |
| 3 | clears the search, not just the field: emptying it goes back to every |
| 4 | deck, and the "Clear search" link under the results, which is the |
| 5 | same way out for a reader with no script, is taken away as |
| 6 | redundant. */ |
| 7 | (function () { |
| 8 | "use strict"; |
| 9 | var input = document.querySelector("[slides-search-input]"); |
| 10 | if (!input || !input.value) return; |
| 11 | var clear = document.querySelector("[slides-search-clear]"); |
| 12 | if (clear) clear.hidden = true; |
| 13 | input.addEventListener("input", function () { |
| 14 | if (input.value === "") location.assign("/"); |
| 15 | }); |
| 16 | })(); |
| 17 | |