-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: support sphinx-book-theme (#66)
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
- Loading branch information
1 parent
a6a2592
commit d159549
Showing
5 changed files
with
60 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -129,13 +129,13 @@ under MIT license | |
|
||
.header-logo { | ||
height: 50px; | ||
width: 50px; | ||
background-image: url("https://unpkg.com/@njzjz/[email protected]/logos/deepmodeling.svg"); | ||
background-repeat: no-repeat; | ||
background-size: 50px 50px; | ||
display: block; | ||
float: left; | ||
z-index: 10; | ||
text-decoration: none; | ||
} | ||
|
||
.header-logo::after { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,37 +1,57 @@ | ||
/* The initial version is taken from | ||
https://github.com/pytorch/pytorch_sphinx_theme | ||
under MIT license | ||
rewrite to remove jQuery by ChatGPT | ||
*/ | ||
window.mobileMenu = { | ||
bind: function () { | ||
$("[data-behavior='open-mobile-menu']").on("click", function (e) { | ||
e.preventDefault(); | ||
$(".mobile-main-menu").addClass("open"); | ||
$("body").addClass("no-scroll"); | ||
|
||
mobileMenu.listenForResize(); | ||
}); | ||
|
||
$("[data-behavior='close-mobile-menu']").on("click", function (e) { | ||
e.preventDefault(); | ||
mobileMenu.close(); | ||
}); | ||
document | ||
.querySelectorAll("[data-behavior='open-mobile-menu']") | ||
.forEach(function (element) { | ||
element.addEventListener("click", function (e) { | ||
e.preventDefault(); | ||
document.querySelector(".mobile-main-menu").classList.add("open"); | ||
document.body.classList.add("no-scroll"); | ||
|
||
mobileMenu.listenForResize(); | ||
}); | ||
}); | ||
|
||
document | ||
.querySelectorAll("[data-behavior='close-mobile-menu']") | ||
.forEach(function (element) { | ||
element.addEventListener("click", function (e) { | ||
e.preventDefault(); | ||
mobileMenu.close(); | ||
}); | ||
}); | ||
}, | ||
|
||
listenForResize: function () { | ||
$(window).on("resize.ForMobileMenu", function () { | ||
if ($(this).width() > 768) { | ||
function resizeHandler() { | ||
if (window.innerWidth > 768) { | ||
mobileMenu.close(); | ||
} | ||
}); | ||
} | ||
|
||
window.addEventListener("resize", resizeHandler); | ||
|
||
// Store the handler so it can be removed later | ||
this.resizeHandler = resizeHandler; | ||
}, | ||
|
||
close: function () { | ||
$(".mobile-main-menu").removeClass("open"); | ||
$("body").removeClass("no-scroll"); | ||
$(window).off("resize.ForMobileMenu"); | ||
document.querySelector(".mobile-main-menu").classList.remove("open"); | ||
document.body.classList.remove("no-scroll"); | ||
|
||
// Remove the resize event listener | ||
if (this.resizeHandler) { | ||
window.removeEventListener("resize", this.resizeHandler); | ||
this.resizeHandler = null; | ||
} | ||
}, | ||
}; | ||
$(document).ready(function () { | ||
|
||
document.addEventListener("DOMContentLoaded", function () { | ||
mobileMenu.bind(); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
sphinx >=4.2 | ||
sphinx_rtd_theme >=0.6 | ||
sphinx-book-theme | ||
. | ||
myst_parser | ||
docutils >=0.17 | ||
|