Skip to content

Commit 09d48ab

Browse files
Un-hide TryExamples buttons based on regex
1 parent 37fa0ca commit 09d48ab

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

jupyterlite_sphinx/jupyterlite_sphinx.js

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -180,15 +180,18 @@ window.loadTryExamplesConfig = async (configFilePath) => {
180180
tryExamplesGlobalMinHeight = parseInt(data.global_min_height);
181181
}
182182

183-
// Disable interactive examples if file matches one of the ignore patterns
184-
// by hiding try_examples_buttons.
183+
// Selectively enable interactive examples if file matches one of the ignore patterns
184+
// by un-hiding try_examples_buttons.
185185
Patterns = data.ignore_patterns;
186186
for (let pattern of Patterns) {
187187
let regex = new RegExp(pattern);
188-
if (regex.test(currentPageUrl)) {
189-
var buttons = document.getElementsByClassName("try_examples_button");
188+
if (!regex.test(currentPageUrl)) {
189+
var buttons = document.getElementsByClassName(
190+
"try_examples_button hidden",
191+
);
190192
for (var i = 0; i < buttons.length; i++) {
191-
buttons[i].classList.add("hidden");
193+
console.log(buttons[i]);
194+
buttons[i].classList.remove("hidden");
192195
}
193196
break;
194197
}

0 commit comments

Comments
 (0)