File tree Expand file tree Collapse file tree 1 file changed +6
-13
lines changed Expand file tree Collapse file tree 1 file changed +6
-13
lines changed Original file line number Diff line number Diff line change 88function showExamples ( ) {
99 chrome . storage . local . get ( [ 'showExamples' ] , ( result ) => {
1010 const showExamples = result . showExamples ;
11- const descriptionContainer = document . querySelector ( 'div._1l1MA' ) as Element ;
12- if ( ! descriptionContainer ) {
13- return ;
14- }
15- const examples = descriptionContainer . getElementsByClassName ( 'example' ) ;
16- if ( examples && examples . length > 0 ) {
17- const parent = examples [ 0 ] . parentNode as Element ;
18- if ( ! parent ) {
19- return ;
20- }
21- const startIndex = Array . from ( descriptionContainer . children ) . indexOf ( parent ) ;
22- for ( let i = startIndex ; i < descriptionContainer . children . length ; i ++ ) {
23- const child = descriptionContainer . children [ i ] as HTMLElement ;
11+
12+ const examples = document . getElementsByClassName ( 'xFUwe' ) [ 0 ] ;
13+ if ( examples && examples . children ) {
14+ for ( const child of examples . children ) {
15+ // skip the first child since it is the title of the examples section
16+ if ( child === examples . children [ 0 ] ) continue ;
2417 child . style . display = showExamples ? 'block' : 'none' ;
2518 }
2619 }
You can’t perform that action at this time.
0 commit comments