Skip to content

Commit 130dd7e

Browse files
committed
fix trying to add company tags to solutions tab
1 parent 96e419a commit 130dd7e

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

src/content-script/update-description-tab.ts

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
// shows the examples if the user has enabled it in the settings
22
function showExamples() {
3+
// Check if we're on the description tab before proceeding
4+
const isDescriptionPage = !window.location.href.includes('/solutions');
5+
if (!isDescriptionPage) {
6+
return;
7+
}
8+
39
chrome.storage.local.get(['showExamples'], (result) => {
410
const showExamples = result.showExamples;
511
const examples = document.querySelectorAll('div.flex.h-full.w-full')[0];
@@ -79,6 +85,12 @@ function observeThemeChanges() {
7985

8086
// show the leetcode difficulty if the user has enabled it in the settings
8187
function showDifficulty() {
88+
// Check if we're on the description tab before proceeding
89+
const isDescriptionPage = !window.location.href.includes('/solutions');
90+
if (!isDescriptionPage) {
91+
return;
92+
}
93+
8294
chrome.storage.local.get(['showDifficulty'], (result) => {
8395
const showDifficulty = result.showDifficulty;
8496
const difficultyContainer = document.querySelectorAll('div.relative.inline-flex')[0] as HTMLDivElement;
@@ -95,6 +107,12 @@ function showDifficulty() {
95107

96108
// show the leetcode problem rating if the user has enabled it in the settings
97109
function showRating(problemTitle: string) {
110+
// Check if we're on the description tab before proceeding
111+
const isDescriptionPage = !window.location.href.includes('/solutions');
112+
if (!isDescriptionPage) {
113+
return;
114+
}
115+
98116
chrome.storage.local.get(['showRating'], (result) => {
99117
const showRating = result.showRating;
100118
if (!showRating) {
@@ -148,6 +166,12 @@ function showCompanyTags(problemTitle: string) {
148166
return;
149167
}
150168

169+
// Check if we're on the description tab before proceeding
170+
const isDescriptionPage = !window.location.href.includes('/solutions');
171+
if (!isDescriptionPage) {
172+
return;
173+
}
174+
151175
// Try to find the description element with retries
152176
const maxRetries = 10;
153177
const baseDelay = 300;

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy