Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Include jquery in the theme #1299

Closed
wants to merge 6 commits into from
Closed
Show file tree
Hide file tree
Changes from all 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
10 changes: 5 additions & 5 deletions docs/_static/debug.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Add debug actions to flyout menu

$(function () {
$("[data-toggle='rst-debug-badge']").on("click", function () {
// Add debug actions to flyout menu.
document.addEventListener("DOMContentLoaded", function () {
Copy link
Member

Choose a reason for hiding this comment

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

Shouldn't we create a domReady() helper function as we are doing in the community repository?

Copy link
Member Author

Choose a reason for hiding this comment

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

seems simpler to just use the event listener? If you mean to try to load jquery here as well, there is no need, since jquery isn't used till you press the "toggle" button, at that point jquery is already included/loaded.

Copy link
Member

Choose a reason for hiding this comment

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

I'm just saying that instead of repeating over and over the document.addEventListener("DOMContentLoaded", function () { part we could create a helper function and reuse on the whole file.

let element = document.querySelector("[data-toggle='rst-debug-badge']");
element.addEventListener("click", function () {
$("[data-toggle='rst-versions']").toggleClass("rst-badge");
});
})
});
Loading