layouts
All repositories: gitoria
944 B
// lib/search.hl — the header's search: the form sends GET /search?q=…, a page cannot read the query (hl:web), so the// function route answers a redirect to /search/<words> (letters and digits only, words joined by '-'); the page// components/search.hl searches the showcase's pages.import { Response } from 'hl:http1'static searchRedirect = (req) => {q = req.query != null && req.query.q != null ? req.query.q.toLowerCase() : ''let out = ''let i = 0while (i < q.length) {let c = q.charCodeAt(i)if ((c >= 97 && c <= 122) || (c >= 48 && c <= 57)) { out = out + q.charAt(i) }else if (c == 32 && out != '' && !out.endsWith('-')) { out = out + '-' }i = i + 1}if (out.endsWith('-')) { out = out.slice(0, out.length - 1) }return new Response('see ' + out, { status = 302 headers = { 'Location' = out == '' ? '/' : '/search/' + out 'Cache-Control' = 'no-store' 'Content-Type' = 'text/plain; charset=utf-8' } })}
Branches
Latest commits
- a3e74c8alayouts mission 002 1/3: components re-copied byte-verbatim from components.hybriel 3f93d71 by tools/sync-components.sh (+ --check, components/SOURCE); gate 73/0, check-theme 0mre
- 80ce6ba9report 001 (mission 075)mre
- 5c6e338flayouts.worldapi.org in Hybriel: WorldAPI theme (tokens, borderless elements, themed components.hybriel components), shells (header, main/user menu, sidebar overlay, content-first, list-first, three-pane), showcase, check-theme helper; gate 73/0 (mission 075)mre