11// shows the examples if the user has enabled it in the settings
22function 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
8187function 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
97109function 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