@@ -26,63 +26,81 @@ document.addEventListener('DOMContentLoaded', () => {
2626 const showDifficultyIcon = document . getElementById ( 'show-difficulty-icon' ) ;
2727 if ( showDifficultyIcon ) showDifficultyIcon . textContent = result . showDifficulty ? '✅' : '❌' ;
2828 } ) ;
29- } ) ;
29+ chrome . storage . local . get ( [ 'showRating' ] , ( result ) => {
30+ const showRatingIcon = document . getElementById ( 'show-rating-icon' ) ;
31+ if ( showRatingIcon ) showRatingIcon . textContent = result . showRating ? '✅' : '❌' ;
32+ } ) ;
3033
31- // Get font fize and check if it is already set in local storage
32- const fontSizeSelect = document . getElementById ( 'font-size-select' ) as HTMLSelectElement ;
33- chrome . storage . local . get ( 'fontSize' , function ( data ) {
34- if ( data . fontSize ) {
35- fontSizeSelect . value = data . fontSize ;
36- document . documentElement . style . setProperty ( '--dynamic-font-size' , `${ data . fontSize } px` ) ;
37- }
38- } ) ;
39- fontSizeSelect . onchange = function ( event : Event ) {
40- const selectedFontSize = ( event . target as HTMLInputElement ) . value ;
41- chrome . storage . local . set ( { fontSize : selectedFontSize } ) ;
42- document . documentElement . style . setProperty ( '--dynamic-font-size' , `${ selectedFontSize } px` ) ;
43- } ;
34+ // Get font fize and check if it is already set in local storage
35+ const fontSizeSelect = document . getElementById ( 'font-size-select' ) as HTMLSelectElement ;
36+ chrome . storage . local . get ( 'fontSize' , function ( data ) {
37+ if ( data . fontSize ) {
38+ fontSizeSelect . value = data . fontSize ;
39+ document . documentElement . style . setProperty ( '--dynamic-font-size' , `${ data . fontSize } px` ) ;
40+ }
41+ } ) ;
42+ fontSizeSelect . onchange = function ( event : Event ) {
43+ const selectedFontSize = ( event . target as HTMLInputElement ) . value ;
44+ chrome . storage . local . set ( { fontSize : selectedFontSize } ) ;
45+ document . documentElement . style . setProperty ( '--dynamic-font-size' , `${ selectedFontSize } px` ) ;
46+ } ;
4447
45- const showCompanyTagsBtn = document . getElementById ( 'show-company-tags-btn' ) ;
46- showCompanyTagsBtn && showCompanyTagsBtn . addEventListener ( 'click' , function ( ) {
47- chrome . storage . local . get ( [ 'showCompanyTags' ] , ( result ) => {
48- const showCompanyTags = ! result . showCompanyTags ;
49- chrome . storage . local . set ( { showCompanyTags : showCompanyTags } , ( ) => {
50- const showCompanyTagsIcon = document . getElementById ( 'show-company-tags-icon' ) ;
51- showCompanyTagsIcon && ( showCompanyTagsIcon . textContent = showCompanyTags ? '✅' : '❌' ) ;
48+ const showCompanyTagsBtn = document . getElementById ( 'show-company-tags-btn' ) ;
49+ showCompanyTagsBtn && showCompanyTagsBtn . addEventListener ( 'click' , function ( ) {
50+ chrome . storage . local . get ( [ 'showCompanyTags' ] , ( result ) => {
51+ const showCompanyTags = ! result . showCompanyTags ;
52+ chrome . storage . local . set ( { showCompanyTags : showCompanyTags } , ( ) => {
53+ const showCompanyTagsIcon = document . getElementById ( 'show-company-tags-icon' ) ;
54+ showCompanyTagsIcon && ( showCompanyTagsIcon . textContent = showCompanyTags ? '✅' : '❌' ) ;
55+ chrome . tabs . query ( { active : true , currentWindow : true } , ( tabs ) => {
56+ chrome . tabs . sendMessage ( tabs [ 0 ] . id || 0 , { action : 'updateDescription' , title : tabs [ 0 ] . title || 'title' } ) ;
57+ } ) ;
58+ } ) ;
59+ } ) ;
60+ } ) ;
61+
62+ let showExamplesBtn = document . getElementById ( 'show-examples-btn' ) ;
63+ showExamplesBtn && showExamplesBtn . addEventListener ( 'click' , function ( ) {
64+ chrome . storage . local . get ( [ 'showExamples' ] , ( result ) => {
65+ const showExamples = ! result . showExamples ;
66+ chrome . storage . local . set ( { showExamples : showExamples } , ( ) => {
67+ const showExamplesIcon = document . getElementById ( 'show-examples-icon' ) ;
68+ showExamplesIcon && ( showExamplesIcon . textContent = showExamples ? '✅' : '❌' ) ;
69+ } ) ;
70+ // Manually trigger the update description after toggling
5271 chrome . tabs . query ( { active : true , currentWindow : true } , ( tabs ) => {
5372 chrome . tabs . sendMessage ( tabs [ 0 ] . id || 0 , { action : 'updateDescription' , title : tabs [ 0 ] . title || 'title' } ) ;
5473 } ) ;
5574 } ) ;
5675 } ) ;
57- } ) ;
5876
59- let showExamplesBtn = document . getElementById ( 'show-examples-btn' ) ;
60- showExamplesBtn && showExamplesBtn . addEventListener ( 'click' , function ( ) {
61- chrome . storage . local . get ( [ 'showExamples' ] , ( result ) => {
62- const showExamples = ! result . showExamples ;
63- chrome . storage . local . set ( { showExamples : showExamples } , ( ) => {
64- const showExamplesIcon = document . getElementById ( 'show-examples-icon' ) ;
65- showExamplesIcon && ( showExamplesIcon . textContent = showExamples ? '✅' : '❌' ) ;
66- } ) ;
67- // Manually trigger the update description after toggling
68- chrome . tabs . query ( { active : true , currentWindow : true } , ( tabs ) => {
69- chrome . tabs . sendMessage ( tabs [ 0 ] . id || 0 , { action : 'updateDescription' , title : tabs [ 0 ] . title || 'title' } ) ;
77+ const showDifficultyBtn = document . getElementById ( 'show-difficulty-btn' ) ;
78+ showDifficultyBtn && showDifficultyBtn . addEventListener ( 'click' , function ( ) {
79+ chrome . storage . local . get ( [ 'showDifficulty' ] , ( result ) => {
80+ const showDifficulty = ! result . showDifficulty ;
81+ chrome . storage . local . set ( { showDifficulty : showDifficulty } , ( ) => {
82+ const showDifficultyIcon = document . getElementById ( 'show-difficulty-icon' ) ;
83+ if ( showDifficultyIcon ) showDifficultyIcon . textContent = showDifficulty ? '✅' : '❌' ;
84+ } ) ;
85+ // Manually trigger the update description after toggling
86+ chrome . tabs . query ( { active : true , currentWindow : true } , ( tabs ) => {
87+ chrome . tabs . sendMessage ( tabs [ 0 ] . id || 0 , { action : 'updateDescription' , title : tabs [ 0 ] . title || 'title' } ) ;
88+ } ) ;
7089 } ) ;
7190 } ) ;
72- } ) ;
7391
74- const showDifficultyBtn = document . getElementById ( 'show-difficulty-btn' ) ;
75- showDifficultyBtn && showDifficultyBtn . addEventListener ( 'click' , function ( ) {
76- chrome . storage . local . get ( [ 'showDifficulty' ] , ( result ) => {
77- const showDifficulty = ! result . showDifficulty ;
78- chrome . storage . local . set ( { showDifficulty : showDifficulty } , ( ) => {
79- const showDifficultyIcon = document . getElementById ( 'show-difficulty-icon' ) ;
80- if ( showDifficultyIcon ) showDifficultyIcon . textContent = showDifficulty ? '✅' : '❌' ;
81- } ) ;
82- // Manually trigger the update description after toggling
83- chrome . tabs . query ( { active : true , currentWindow : true } , ( tabs ) => {
84- chrome . tabs . sendMessage ( tabs [ 0 ] . id || 0 , { action : 'updateDescription' , title : tabs [ 0 ] . title || 'title' } ) ;
92+ const showRatingBtn = document . getElementById ( 'show-rating-btn' ) ;
93+ showRatingBtn && showRatingBtn . addEventListener ( 'click' , function ( ) {
94+ chrome . storage . local . get ( [ 'showRating' ] , ( result ) => {
95+ const showRating = ! result . showRating ;
96+ chrome . storage . local . set ( { showRating : showRating } , ( ) => {
97+ const showRatingIcon = document . getElementById ( 'show-rating-icon' ) ;
98+ if ( showRatingIcon ) showRatingIcon . textContent = showRating ? '✅' : '❌' ;
99+ } ) ;
100+ // Manually trigger the update description after toggling
101+ chrome . tabs . query ( { active : true , currentWindow : true } , ( tabs ) => {
102+ chrome . tabs . sendMessage ( tabs [ 0 ] . id || 0 , { action : 'updateDescription' , title : tabs [ 0 ] . title || 'title' } ) ;
103+ } ) ;
85104 } ) ;
86105 } ) ;
87- } ) ;
88-
106+ } ) ;
0 commit comments