Skip to content

Commit c6ba0d4

Browse files
committed
Use === !== equity checks
1 parent eb340b7 commit c6ba0d4

351 files changed

Lines changed: 1953 additions & 1919 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎apps/browser/create-firefox-build.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ firefox_manifest.browser_action = firefox_manifest.action
1919
delete firefox_manifest.action
2020

2121
firefox_manifest.permissions = firefox_manifest.permissions.filter(
22-
(p: string) => p != 'alarms'
22+
(p: string) => p !== 'alarms'
2323
)
2424

2525
firefox_manifest.permissions.push('contextualIdentities')

‎apps/browser/create-zip-archives.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ const delete_old_zip_archives = (current_version: string) => {
3434

3535
files.forEach((file) => {
3636
const match = file.match(zipPattern)
37-
if (match && match[1] != current_version) {
37+
if (match && match[1] !== current_version) {
3838
const filePath = path.join(__dirname, file)
3939
log(`Deleting old archive: ${file}`)
4040
fs.unlinkSync(filePath)

‎apps/browser/src/background/message-handler.ts‎

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ let is_finished_responding = false
2323
const CHAT_INITIALIZATION_TIMEOUT = 5000
2424

2525
export const handle_messages = (message: WebSocketMessage) => {
26-
if (message.action == 'initialize-chat') {
26+
if (message.action === 'initialize-chat') {
2727
handle_initialize_chat_message(message as InitializeChatMessage)
2828
}
2929
}
@@ -34,7 +34,7 @@ const check_browser_focus = async (): Promise<boolean> => {
3434
}
3535

3636
const process_next_chat = async () => {
37-
if (chat_queue.length == 0 || !is_processing) {
37+
if (chat_queue.length === 0 || !is_processing) {
3838
is_processing = false
3939
return
4040
}
@@ -80,7 +80,7 @@ const process_next_chat = async () => {
8080

8181
let target_url = ''
8282
// OpenRouter is a special case—model handling via search params
83-
if (current_chat_message.url == 'https://openrouter.ai/chat') {
83+
if (current_chat_message.url === 'https://openrouter.ai/chat') {
8484
// https://openrouter.ai/chat?models=openrouter/quasar-alpha
8585
const search_params = new URLSearchParams()
8686
if (current_chat_message.model) {
@@ -179,16 +179,16 @@ export const setup_message_listeners = () => {
179179
browser.runtime.onMessage.addListener(
180180
(message: any, sender: any, _: any): any => {
181181
if (is_message(message)) {
182-
if (message.action == 'chat-initialized') {
182+
if (message.action === 'chat-initialized') {
183183
handle_chat_initialized()
184-
} else if (message.action == 'apply-response') {
184+
} else if (message.action === 'apply-response') {
185185
send_message_to_server({
186186
action: 'apply-response',
187187
client_id: message.client_id,
188188
raw_instructions: message.raw_instructions
189189
} as ApplyResponseMessage)
190-
} else if (message.action == 'finished-responding') {
191-
if (sender.tab?.id && sender.tab.id == last_opened_tab_id) {
190+
} else if (message.action === 'finished-responding') {
191+
if (sender.tab?.id && sender.tab.id === last_opened_tab_id) {
192192
is_finished_responding = true
193193
}
194194
}

‎apps/browser/src/background/websocket.ts‎

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ let is_reconnecting = false
77
let last_ping_timestamp = Date.now()
88

99
browser.storage.onChanged.addListener((changes, areaName) => {
10-
if (areaName == 'local' && changes['browser-profile-name']) {
10+
if (areaName === 'local' && changes['browser-profile-name']) {
1111
if (websocket) {
1212
is_reconnecting = false
1313
const old_ws = websocket
@@ -28,7 +28,7 @@ export const check_server_health = async (): Promise<boolean> => {
2828
}
2929

3030
export const check_and_recover_connection = () => {
31-
if (websocket?.readyState == WebSocket.OPEN) {
31+
if (websocket?.readyState === WebSocket.OPEN) {
3232
if (Date.now() - last_ping_timestamp > 20000) {
3333
console.warn(
3434
'WebSocket connection is stale (no recent pings). Force reconnecting...'
@@ -40,8 +40,8 @@ export const check_and_recover_connection = () => {
4040

4141
if (
4242
!is_reconnecting &&
43-
websocket?.readyState != WebSocket.OPEN &&
44-
websocket?.readyState != WebSocket.CONNECTING
43+
websocket?.readyState !== WebSocket.OPEN &&
44+
websocket?.readyState !== WebSocket.CONNECTING
4545
) {
4646
connect_websocket()
4747
}
@@ -50,8 +50,8 @@ export const check_and_recover_connection = () => {
5050
export const connect_websocket = async (): Promise<void> => {
5151
if (
5252
is_reconnecting ||
53-
websocket?.readyState == WebSocket.OPEN ||
54-
websocket?.readyState == WebSocket.CONNECTING
53+
websocket?.readyState === WebSocket.OPEN ||
54+
websocket?.readyState === WebSocket.CONNECTING
5555
) {
5656
return
5757
}
@@ -104,9 +104,9 @@ export const connect_websocket = async (): Promise<void> => {
104104
ws.onmessage = async (event) => {
105105
if (websocket !== ws) return
106106
const message = JSON.parse(event.data)
107-
if (message.action == 'ping') {
107+
if (message.action === 'ping') {
108108
last_ping_timestamp = Date.now()
109-
if (ws.readyState == WebSocket.OPEN) {
109+
if (ws.readyState === WebSocket.OPEN) {
110110
ws.send(JSON.stringify({ action: 'pong' }))
111111
}
112112
return
@@ -137,7 +137,7 @@ export const connect_websocket = async (): Promise<void> => {
137137
}
138138

139139
export const send_message_to_server = (message: any): boolean => {
140-
if (websocket?.readyState == WebSocket.OPEN) {
140+
if (websocket?.readyState === WebSocket.OPEN) {
141141
websocket.send(JSON.stringify(message))
142142
return true
143143
}

‎apps/browser/src/content-scripts/send-prompt-content-script/chatbots/ai-studio.ts‎

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ export const ai_studio: Chatbot = {
9393
)
9494
const tools = settings_items.find((item) => {
9595
const title_element = item.querySelector('p.group-title')
96-
return title_element && title_element.textContent?.trim() == 'Tools'
96+
return title_element && title_element.textContent?.trim() === 'Tools'
9797
})
9898

9999
if (tools && !tools.classList.contains('expanded')) {
@@ -117,9 +117,10 @@ export const ai_studio: Chatbot = {
117117
})
118118
return
119119
}
120-
const is_checked = grounding_button.getAttribute('aria-checked') == 'true'
120+
const is_checked =
121+
grounding_button.getAttribute('aria-checked') === 'true'
121122
const should_be_checked = options.includes('grounding-with-google-search')
122-
if (is_checked != should_be_checked) {
123+
if (is_checked !== should_be_checked) {
123124
grounding_button.click()
124125
}
125126
}
@@ -178,7 +179,7 @@ export const ai_studio: Chatbot = {
178179

179180
for (const option of options) {
180181
const label = option.textContent?.trim()
181-
if (label == target_label) {
182+
if (label === target_label) {
182183
option.click()
183184
break
184185
}
@@ -275,7 +276,7 @@ export const ai_studio: Chatbot = {
275276
const has_thumb_up =
276277
footer.querySelector('button[iconname="thumb_up"]') ||
277278
Array.from(footer.querySelectorAll('button span')).some(
278-
(span) => span.textContent?.trim() == 'thumb_up'
279+
(span) => span.textContent?.trim() === 'thumb_up'
279280
)
280281
if (has_thumb_up) {
281282
const has_been_processed = footer.hasAttribute('data-cwc-processed')
@@ -337,7 +338,7 @@ const close_panel = async () => {
337338
}
338339
close_button.click()
339340
} else {
340-
if (sessionStorage.getItem('should-hide-panel') == 'true') {
341+
if (sessionStorage.getItem('should-hide-panel') === 'true') {
341342
const close_button = document.querySelector(
342343
'ms-run-settings button[iconname="close"]'
343344
) as HTMLButtonElement

‎apps/browser/src/content-scripts/send-prompt-content-script/chatbots/chatgpt.ts‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ export const chatgpt: Chatbot = {
2929
input_element.innerText = ' '
3030
input_element.dispatchEvent(new Event('input', { bubbles: true }))
3131

32-
if (input_element.innerText == ' ') {
32+
if (input_element.innerText === ' ') {
3333
resolve(null)
3434
return
3535
}
@@ -135,7 +135,7 @@ export const chatgpt: Chatbot = {
135135
if (!options) return
136136
const supported_options = CHATBOTS['ChatGPT'].supported_options
137137
for (const option of options) {
138-
if (option == 'temporary' && supported_options?.['temporary']) {
138+
if (option === 'temporary' && supported_options?.['temporary']) {
139139
const button = document.querySelector(
140140
'[data-testid="app-shell-header-context-menu-surface"] > div:last-child > div:last-child button'
141141
)

‎apps/browser/src/content-scripts/send-prompt-content-script/chatbots/claude.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ export const claude: Chatbot = {
1818
input_element.innerText = ' '
1919
input_element.dispatchEvent(new Event('input', { bubbles: true }))
2020

21-
if (input_element.innerText == ' ') {
21+
if (input_element.innerText === ' ') {
2222
resolve(null)
2323
return
2424
}

‎apps/browser/src/content-scripts/send-prompt-content-script/chatbots/copilot.ts‎

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ export const copilot: Chatbot = {
2525

2626
const supported_options = CHATBOTS['Copilot'].supported_options
2727
for (const option of options) {
28-
if (option == 'temporary' && supported_options?.['temporary']) {
28+
if (option === 'temporary' && supported_options?.['temporary']) {
2929
const temporary_button = document.querySelector(
3030
'button[aria-label="Temporary chat"]'
3131
) as HTMLButtonElement
@@ -38,7 +38,7 @@ export const copilot: Chatbot = {
3838
return
3939
}
4040

41-
if (temporary_button.getAttribute('aria-pressed') != 'true') {
41+
if (temporary_button.getAttribute('aria-pressed') !== 'true') {
4242
temporary_button.click()
4343
await new Promise((r) => requestAnimationFrame(r))
4444
}
@@ -85,23 +85,23 @@ export const copilot: Chatbot = {
8585
})
8686

8787
let target_text = ''
88-
if (reasoning_effort.toLowerCase() == 'auto') {
88+
if (reasoning_effort.toLowerCase() === 'auto') {
8989
target_text = 'auto'
90-
} else if (reasoning_effort.toLowerCase() == 'quick') {
90+
} else if (reasoning_effort.toLowerCase() === 'quick') {
9191
target_text = 'quick response'
92-
} else if (reasoning_effort.toLowerCase() == 'deep') {
92+
} else if (reasoning_effort.toLowerCase() === 'deep') {
9393
target_text = 'think deeper'
9494
}
9595

9696
const target_item = menu_items.find((item) => {
9797
const title = item.querySelector('h4')?.textContent?.trim().toLowerCase()
98-
if (title == target_text) return true
98+
if (title === target_text) return true
9999

100100
const primary_text = item
101101
.querySelector('.fai-CapabilityPickerMenuItem__primaryContentWrapper')
102102
?.textContent?.trim()
103103
.toLowerCase()
104-
if (primary_text == target_text) return true
104+
if (primary_text === target_text) return true
105105

106106
return false
107107
}) as HTMLElement

‎apps/browser/src/content-scripts/send-prompt-content-script/chatbots/deepseek.ts‎

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,14 @@ export const deepseek: Chatbot = {
1212
document.querySelectorAll('div.ds-toggle-button')
1313
).find(
1414
(button) =>
15-
button.textContent == 'DeepThink' || button.textContent == '深度思考'
15+
button.textContent === 'DeepThink' || button.textContent === '深度思考'
1616
) as HTMLButtonElement
1717

1818
const search_button = Array.from(
1919
document.querySelectorAll('div.ds-toggle-button')
2020
).find(
2121
(button) =>
22-
button.textContent == 'Search' || button.textContent == '联网搜索'
22+
button.textContent === 'Search' || button.textContent === '联网搜索'
2323
) as HTMLButtonElement
2424

2525
if (deep_think_button) {
@@ -37,8 +37,8 @@ export const deepseek: Chatbot = {
3737
if (search_button) {
3838
const search_button_style = window.getComputedStyle(search_button)
3939
if (
40-
search_button_style.getPropertyValue('color') != 'rgb(15, 17, 21)' &&
41-
search_button_style.getPropertyValue('color') != 'rgb(249, 250, 251)'
40+
search_button_style.getPropertyValue('color') !== 'rgb(15, 17, 21)' &&
41+
search_button_style.getPropertyValue('color') !== 'rgb(249, 250, 251)'
4242
) {
4343
search_button.click()
4444
}
@@ -50,9 +50,9 @@ export const deepseek: Chatbot = {
5050
if (!options) return
5151
const supported_options = CHATBOTS.DeepSeek.supported_options
5252
for (const option of options) {
53-
if (option == 'deep-think' && supported_options?.['deep-think']) {
53+
if (option === 'deep-think' && supported_options?.['deep-think']) {
5454
deep_think_button?.click()
55-
} else if (option == 'search' && supported_options?.search) {
55+
} else if (option === 'search' && supported_options?.search) {
5656
search_button?.click()
5757
}
5858
}

‎apps/browser/src/content-scripts/send-prompt-content-script/chatbots/doubao.ts‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ export const doubao: Chatbot = {
4848
return
4949
}
5050
const menu_items = portal.querySelectorAll('li[role="menuitem"]')
51-
if (menu_items.length == 0) {
51+
if (menu_items.length === 0) {
5252
report_initialization_error({
5353
function_name: 'doubao.set_options',
5454
log_message: 'Options menu items not found'
@@ -61,7 +61,7 @@ export const doubao: Chatbot = {
6161
await new Promise((r) => requestAnimationFrame(r))
6262
const supported_options = CHATBOTS['Doubao'].supported_options
6363
for (const option of options) {
64-
if (option == 'deep-thinking' && supported_options?.['deep-thinking']) {
64+
if (option === 'deep-thinking' && supported_options?.['deep-thinking']) {
6565
const deep_thinking_button_2 = document.querySelector(
6666
'div[data-testid="chat_input"] input[data-testid="upload-file-input"] + button'
6767
) as HTMLButtonElement

0 commit comments

Comments
 (0)