1
1
// shows the examples if the user has enabled it in the settings
2
2
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
+
3
9
chrome . storage . local . get ( [ 'showExamples' ] , ( result ) => {
4
10
const showExamples = result . showExamples ;
5
11
const examples = document . querySelectorAll ( 'div.flex.h-full.w-full' ) [ 0 ] ;
@@ -79,6 +85,12 @@ function observeThemeChanges() {
79
85
80
86
// show the leetcode difficulty if the user has enabled it in the settings
81
87
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
+
82
94
chrome . storage . local . get ( [ 'showDifficulty' ] , ( result ) => {
83
95
const showDifficulty = result . showDifficulty ;
84
96
const difficultyContainer = document . querySelectorAll ( 'div.relative.inline-flex' ) [ 0 ] as HTMLDivElement ;
@@ -95,6 +107,12 @@ function showDifficulty() {
95
107
96
108
// show the leetcode problem rating if the user has enabled it in the settings
97
109
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
+
98
116
chrome . storage . local . get ( [ 'showRating' ] , ( result ) => {
99
117
const showRating = result . showRating ;
100
118
if ( ! showRating ) {
@@ -148,6 +166,12 @@ function showCompanyTags(problemTitle: string) {
148
166
return ;
149
167
}
150
168
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
+
151
175
// Try to find the description element with retries
152
176
const maxRetries = 10 ;
153
177
const baseDelay = 300 ;
0 commit comments