Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

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)

AltStyle によって変換されたページ (->オリジナル) /