Skip to content

Commit 1e519ed

Browse files
thavelickclaude
andcommitted
Configure Biome to use 2-space indentation instead of tabs
- Add biome.json configuration file with space-based formatting - Apply formatting changes to convert from tabs to 2-space indentation 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
1 parent a2b784b commit 1e519ed

File tree

3 files changed

+182
-176
lines changed

3 files changed

+182
-176
lines changed

biome.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"formatter": {
3+
"indentStyle": "space",
4+
"indentWidth": 2
5+
}
6+
}

public_html/script.js

Lines changed: 136 additions & 136 deletions
Original file line numberDiff line numberDiff line change
@@ -1,163 +1,163 @@
11
const bangs = [
2-
{
3-
t: "al",
4-
u: "https://kiwix.tristanhavelick.com/search?content=archlinux_en_all_nopic_2022-05&pattern={{{s}}}",
5-
},
6-
{
7-
t: "cl",
8-
u: "https://denver.craigslist.org/search/?query={{{s}}}",
9-
},
10-
{
11-
t: "d",
12-
u: "https://lite.duckduckgo.com/lite?q={{{s}}}&kl=us-en",
13-
},
14-
{
15-
t: "e",
16-
u: "https://www.ebay.com/sch/i.html?_nkw={{{s}}}&rt=nc&LH_ItemCondition=4",
17-
},
18-
{
19-
t: "jw",
20-
u: "https://www.justwatch.com/us/search?q={{{s}}}",
21-
},
22-
{
23-
t: "k",
24-
u: "https://kiwix.tristanhavelick.com/search?pattern={{{s}}}",
25-
},
26-
{
27-
t: "lg",
28-
u: "http://libgen.is/search.php?req={{{s}}}",
29-
},
30-
{
31-
t: "lgf",
32-
u: "http://libgen.is/fiction/?q={{{s}}}",
33-
},
34-
{
35-
t: "m",
36-
u: "https://search.marginalia.nu/search?query={{{s}}}",
37-
},
38-
{
39-
t: "py",
40-
u: "https://kiwix.tristanhavelick.com/search?content=python-3.10.2&pattern={{{s}}}",
41-
},
42-
{
43-
t: "sg",
44-
u: "https://app.thestorygraph.com/browse?search_term={{{s}}}",
45-
},
46-
{
47-
t: "ytt",
48-
u: "https://youtranscript.tristanhavelick.com/search?search_term={{{s}}}",
49-
},
50-
{
51-
t: "x",
52-
u: "https://searxng.tristanhavelick.com/search?q={{{s}}}",
53-
},
54-
{
55-
t: "gh",
56-
u: "https://github.com/search?q={{{s}}}",
57-
},
58-
{
59-
t: "g",
60-
u: "https://www.google.com/search?q={{{s}}}",
61-
},
62-
{
63-
t: "ddg",
64-
u: "https://duckduckgo.com/?q={{{s}}}",
65-
},
66-
{
67-
t: "a",
68-
u: "https://www.amazon.com/s?k={{{s}}}",
69-
},
70-
{
71-
t: "pypi",
72-
u: "https://pypi.org/search/?q={{{s}}}",
73-
},
74-
{
75-
t: "w",
76-
u: "https://en.wikipedia.org/wiki/Special:Search?search={{{s}}}",
77-
},
2+
{
3+
t: "al",
4+
u: "https://kiwix.tristanhavelick.com/search?content=archlinux_en_all_nopic_2022-05&pattern={{{s}}}",
5+
},
6+
{
7+
t: "cl",
8+
u: "https://denver.craigslist.org/search/?query={{{s}}}",
9+
},
10+
{
11+
t: "d",
12+
u: "https://lite.duckduckgo.com/lite?q={{{s}}}&kl=us-en",
13+
},
14+
{
15+
t: "e",
16+
u: "https://www.ebay.com/sch/i.html?_nkw={{{s}}}&rt=nc&LH_ItemCondition=4",
17+
},
18+
{
19+
t: "jw",
20+
u: "https://www.justwatch.com/us/search?q={{{s}}}",
21+
},
22+
{
23+
t: "k",
24+
u: "https://kiwix.tristanhavelick.com/search?pattern={{{s}}}",
25+
},
26+
{
27+
t: "lg",
28+
u: "http://libgen.is/search.php?req={{{s}}}",
29+
},
30+
{
31+
t: "lgf",
32+
u: "http://libgen.is/fiction/?q={{{s}}}",
33+
},
34+
{
35+
t: "m",
36+
u: "https://search.marginalia.nu/search?query={{{s}}}",
37+
},
38+
{
39+
t: "py",
40+
u: "https://kiwix.tristanhavelick.com/search?content=python-3.10.2&pattern={{{s}}}",
41+
},
42+
{
43+
t: "sg",
44+
u: "https://app.thestorygraph.com/browse?search_term={{{s}}}",
45+
},
46+
{
47+
t: "ytt",
48+
u: "https://youtranscript.tristanhavelick.com/search?search_term={{{s}}}",
49+
},
50+
{
51+
t: "x",
52+
u: "https://searxng.tristanhavelick.com/search?q={{{s}}}",
53+
},
54+
{
55+
t: "gh",
56+
u: "https://github.com/search?q={{{s}}}",
57+
},
58+
{
59+
t: "g",
60+
u: "https://www.google.com/search?q={{{s}}}",
61+
},
62+
{
63+
t: "ddg",
64+
u: "https://duckduckgo.com/?q={{{s}}}",
65+
},
66+
{
67+
t: "a",
68+
u: "https://www.amazon.com/s?k={{{s}}}",
69+
},
70+
{
71+
t: "pypi",
72+
u: "https://pypi.org/search/?q={{{s}}}",
73+
},
74+
{
75+
t: "w",
76+
u: "https://en.wikipedia.org/wiki/Special:Search?search={{{s}}}",
77+
},
7878
];
7979

8080
function processBang(query) {
81-
const trimmed = query.trim();
81+
const trimmed = query.trim();
8282

83-
if (trimmed.startsWith("!")) {
84-
const spaceIndex = trimmed.indexOf(" ");
85-
if (spaceIndex === -1) {
86-
return null;
87-
}
83+
if (trimmed.startsWith("!")) {
84+
const spaceIndex = trimmed.indexOf(" ");
85+
if (spaceIndex === -1) {
86+
return null;
87+
}
8888

89-
const bangTag = trimmed.substring(1, spaceIndex);
90-
const searchTerm = trimmed.substring(spaceIndex + 1).trim();
89+
const bangTag = trimmed.substring(1, spaceIndex);
90+
const searchTerm = trimmed.substring(spaceIndex + 1).trim();
9191

92-
const bang = bangs.find((b) => b.t === bangTag);
93-
if (bang) {
94-
return bang.u.replace(/{{{s}}}/g, encodeURIComponent(searchTerm));
95-
}
96-
}
97-
const bangMatch = trimmed.match(/^(.+)\s+(\w+)!$/);
98-
if (bangMatch) {
99-
const searchTerm = bangMatch[1].trim();
100-
const bangTag = bangMatch[2];
92+
const bang = bangs.find((b) => b.t === bangTag);
93+
if (bang) {
94+
return bang.u.replace(/{{{s}}}/g, encodeURIComponent(searchTerm));
95+
}
96+
}
97+
const bangMatch = trimmed.match(/^(.+)\s+(\w+)!$/);
98+
if (bangMatch) {
99+
const searchTerm = bangMatch[1].trim();
100+
const bangTag = bangMatch[2];
101101

102-
const bang = bangs.find((b) => b.t === bangTag);
103-
if (bang) {
104-
return bang.u.replace(/{{{s}}}/g, encodeURIComponent(searchTerm));
105-
}
106-
}
107-
return `https://lite.duckduckgo.com/lite?q=${encodeURIComponent(trimmed)}&kl=us-en`;
102+
const bang = bangs.find((b) => b.t === bangTag);
103+
if (bang) {
104+
return bang.u.replace(/{{{s}}}/g, encodeURIComponent(searchTerm));
105+
}
106+
}
107+
return `https://lite.duckduckgo.com/lite?q=${encodeURIComponent(trimmed)}&kl=us-en`;
108108
}
109109

110110
function getQueryParam(key) {
111-
const urlParams = new URLSearchParams(window.location.search);
112-
return urlParams.get(key);
111+
const urlParams = new URLSearchParams(window.location.search);
112+
return urlParams.get(key);
113113
}
114114

115115
function redirect(url) {
116-
window.location.href = url;
116+
window.location.href = url;
117117
}
118118

119119
function setupUI() {
120-
const searchInput = document.getElementById("searchInput");
120+
const searchInput = document.getElementById("searchInput");
121121

122-
function performSearch() {
123-
const query = searchInput.value;
124-
const url = processBang(query);
125-
if (url) {
126-
window.location.hash = `#q=${encodeURIComponent(query)}`;
127-
redirect(url);
128-
}
129-
}
122+
function performSearch() {
123+
const query = searchInput.value;
124+
const url = processBang(query);
125+
if (url) {
126+
window.location.hash = `#q=${encodeURIComponent(query)}`;
127+
redirect(url);
128+
}
129+
}
130130

131-
document
132-
.getElementById("searchButton")
133-
.addEventListener("click", performSearch);
131+
document
132+
.getElementById("searchButton")
133+
.addEventListener("click", performSearch);
134134

135-
searchInput.addEventListener("keypress", (e) => {
136-
if (e.key === "Enter") {
137-
e.preventDefault();
138-
performSearch();
139-
}
140-
});
135+
searchInput.addEventListener("keypress", (e) => {
136+
if (e.key === "Enter") {
137+
e.preventDefault();
138+
performSearch();
139+
}
140+
});
141141

142-
if (window.location.hash) {
143-
const hashParams = new URLSearchParams(window.location.hash.substring(1));
144-
const hashQuery = hashParams.get("q");
145-
if (hashQuery) {
146-
searchInput.value = decodeURIComponent(hashQuery);
147-
}
148-
}
142+
if (window.location.hash) {
143+
const hashParams = new URLSearchParams(window.location.hash.substring(1));
144+
const hashQuery = hashParams.get("q");
145+
if (hashQuery) {
146+
searchInput.value = decodeURIComponent(hashQuery);
147+
}
148+
}
149149
}
150150

151151
function initialize() {
152-
const queryParam = getQueryParam("q");
153-
if (queryParam) {
154-
const url = processBang(queryParam);
155-
if (url) {
156-
redirect(url);
157-
}
158-
} else {
159-
document.addEventListener("DOMContentLoaded", setupUI);
160-
}
152+
const queryParam = getQueryParam("q");
153+
if (queryParam) {
154+
const url = processBang(queryParam);
155+
if (url) {
156+
redirect(url);
157+
}
158+
} else {
159+
document.addEventListener("DOMContentLoaded", setupUI);
160+
}
161161
}
162162

163163
initialize();

0 commit comments

Comments
 (0)