Skip to content

Commit 10f54bd

Browse files
committed
fix hide examples
1 parent a0adcec commit 10f54bd

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

src/content-script/update-description-tab.ts

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,13 @@
88
function showExamples() {
99
chrome.storage.local.get(['showExamples'], (result) => {
1010
const showExamples = result.showExamples;
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;
17-
child.style.display = showExamples ? 'block' : 'none';
11+
let examples = document.getElementsByClassName('xFUwe')[0];
12+
if (!examples) return;
13+
let preTags = examples.getElementsByTagName('pre');
14+
if (preTags) {
15+
for (let tag of preTags) {
16+
console.log(tag);
17+
tag.style.display = showExamples ? 'block' : 'none';
1818
}
1919
}
2020
});

0 commit comments

Comments
 (0)