search for standard sites pub-search.waow.tech
search zig blog atproto

feat: parse @handle from search box for author filtering

Type @zzstoatzz.io compels to search "compels" filtered to that author.
The @handle is stripped from the query, set as currentAuthor, and sent
as the author param to the API (which resolves handles server-side).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

+11 -1
+11 -1
site/index.html
··· 835 835 <div class="syntax-help" id="syntax-help"> 836 836 <div class="syntax-row"><span class="syntax-example"><code>cat dog</code></span><span class="syntax-desc">matches either term</span></div> 837 837 <div class="syntax-row"><span class="syntax-example"><code>"exact phrase"</code></span><span class="syntax-desc">matches exact phrase</span></div> 838 - <div class="syntax-row"><span class="syntax-example"><code>@author</code></span><span class="syntax-desc">click author name in results to filter</span></div> 838 + <div class="syntax-row"><span class="syntax-example"><code>@handle query</code></span><span class="syntax-desc">filter by author</span></div> 839 839 </div> 840 840 841 841 <div id="mode-toggle" class="mode-toggle"></div> ··· 1267 1267 } 1268 1268 1269 1269 function doSearch() { 1270 + // parse @handle from query text 1271 + const raw = queryInput.value; 1272 + const authorMatch = raw.match(/(?:^|\s)@([\w.-]+\.\w+)(?:\s|$)/); 1273 + if (authorMatch) { 1274 + const handle = authorMatch[1]; 1275 + // strip @handle from query, clean up whitespace 1276 + queryInput.value = raw.replace(/@[\w.-]+\.\w+/, '').replace(/\s+/g, ' ').trim(); 1277 + currentAuthor = handle; 1278 + renderActiveFilter(); 1279 + } 1270 1280 updateUrl(); 1271 1281 search(queryInput.value, currentTag, currentPlatform); 1272 1282 }