mirror of
https://notabug.org/SuperSaltyGamer/ame
synced 2026-01-15 16:22:56 -03:00
[musicbrainz] Autofocus search field
This commit is contained in:
@@ -12,6 +12,7 @@ const LOG_TOC_PATTERN = /(\d+) +\| +([0-9:.]+) +\| +([0-9:.]+) +\| +(\d+) +\| +(
|
||||
const formEl = document.querySelector<HTMLFormElement>("form[action='/search']")!;
|
||||
const searchEl = document.querySelector<HTMLInputElement>("#headerid-query")!;
|
||||
|
||||
searchEl.focus();
|
||||
searchEl.placeholder = "Enhanced search";
|
||||
|
||||
formEl.addEventListener("submit", e => {
|
||||
@@ -41,7 +42,7 @@ formEl.addEventListener("submit", e => {
|
||||
}
|
||||
});
|
||||
|
||||
function identifyQuery(value: string): QueryType {
|
||||
export function identifyQuery(value: string): QueryType {
|
||||
if (value.match(/^(\d{8}|\d{12}|\d{13}|\d{14})$/i)) return QueryType.Barcode;
|
||||
if (value.match(/^[a-z]{5}[0-9]{7}$/i)) return QueryType.Isrc;
|
||||
if (value === value.toUpperCase() && value.match(/\d/i) && value.match(/[a-z]/i) && value.match(/[ ~-]/i)) return QueryType.Catalog;
|
||||
|
||||
Reference in New Issue
Block a user