Skip to content
Draft
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@ docs/build
build
dist
.jupyterlite.doit.db
/.vscode/
11 changes: 7 additions & 4 deletions jupyterlite_sphinx/jupyterlite_sphinx.js
Original file line number Diff line number Diff line change
Expand Up @@ -180,15 +180,18 @@ window.loadTryExamplesConfig = async (configFilePath) => {
tryExamplesGlobalMinHeight = parseInt(data.global_min_height);
}

// Disable interactive examples if file matches one of the ignore patterns
// by hiding try_examples_buttons.
// Selectively enable interactive examples if file matches one of the ignore patterns
// by un-hiding try_examples_buttons.
Patterns = data.ignore_patterns;
for (let pattern of Patterns) {
let regex = new RegExp(pattern);
if (regex.test(currentPageUrl)) {
var buttons = document.getElementsByClassName("try_examples_button");
var buttons = document.getElementsByClassName(
"try_examples_button hidden",
);
for (var i = 0; i < buttons.length; i++) {
buttons[i].classList.add("hidden");
console.log(buttons[i]);
buttons[i].classList.remove("hidden");
}
break;
}
Expand Down
6 changes: 3 additions & 3 deletions jupyterlite_sphinx/jupyterlite_sphinx.py
Original file line number Diff line number Diff line change
Expand Up @@ -468,14 +468,14 @@ def run(self):

# Button with the onclick event to swap embedded notebook back to examples.
go_back_button_html = (
'<button class="try_examples_button" '
'<button class="try_examples_button hidden" '

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

From what I can tell, these buttons are already within a .hidden container.

Suggested change
'<button class="try_examples_button hidden" '
'<button class="try_examples_button" '

f"onclick=\"window.tryExamplesHideIframe('{examples_div_id}',"
f"'{iframe_parent_div_id}')\">"
"Go Back</button>"
)

full_screen_button_html = (
'<button class="try_examples_button" '
'<button class="try_examples_button hidden" '

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
'<button class="try_examples_button hidden" '
'<button class="try_examples_button" '

f"onclick=\"window.openInNewTab('{examples_div_id}',"
f"'{iframe_parent_div_id}')\">"
"Open In Tab</button>"
Expand All @@ -484,7 +484,7 @@ def run(self):
# Button with the onclick event to swap examples with embedded notebook.
try_it_button_html = (
'<div class="try_examples_button_container">'
'<button class="try_examples_button" '
'<button class="try_examples_button hidden" '

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
'<button class="try_examples_button hidden" '
'<button class="try_examples_button hidden transparent" '

(see other suggestions above)

f"onclick=\"window.tryExamplesShowIframe('{examples_div_id}',"
f"'{iframe_div_id}','{iframe_parent_div_id}','{iframe_src}',"
f"'{height}')\">"
Expand Down