Skip to content

Commit

Permalink
Remove references to some missing files and fix some invalid JavaScri…
Browse files Browse the repository at this point in the history
…pt (#292)

1. Remove references to `js/vendor`, which was removed in
#17
2. Remove reference to `css.theme.map`, which we never distribute since
we never minify `css.theme` to begin with
3. Remove invalid JavaScript references to `pytorch-shortcuts-wrapper`
and `header-holder`, which no longer exist in our HTML template and
caused the JavaScript to fail to run.

The main console error I still get is tracked by
#291. (FYI: to avoid
a bunch of console errors when developing, you need to serve the app
with e.g. `python3 -m http.server`, rather than opening `index.html`
directly.)

As a result of this change, the right page table of contents now shows
subheadings! You can click the + or - to expand it.

![Screenshot 2023-05-04 at 1 02 48
PM](https://user-images.githubusercontent.com/14852634/236303682-915ac4de-e500-4525-849a-062245e91762.png)
  • Loading branch information
Eric-Arellano authored May 4, 2023
1 parent f3cab33 commit 97f2029
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 26 deletions.
4 changes: 0 additions & 4 deletions qiskit_sphinx_theme/pytorch_base/layout.html
Original file line number Diff line number Diff line change
Expand Up @@ -161,14 +161,10 @@
{{ js_tag(scriptfile) }}
{%- endfor %}

<script type="text/javascript" src="{{ pathto('_static/js/vendor/popper.min.js', 1) }}"></script>
<script type="text/javascript" src="{{ pathto('_static/js/vendor/bootstrap.min.js', 1) }}"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/list.js/1.5.0/list.min.js"></script>
<script type="text/javascript" src="{{ pathto('_static/js/theme.js', 1) }}"></script>
<script type="text/javascript" src="{{ pathto('_static/js/utils.js', 1) }}"></script>

<script type="text/javascript" src="{{ pathto('_static/js/vendor/anchor.min.js', 1) }}"></script>

<!-- enable language dropdown menu expand -->
<script type="text/javascript">
jQuery(function () {
Expand Down
1 change: 0 additions & 1 deletion qiskit_sphinx_theme/pytorch_base/static/css/theme.css
Original file line number Diff line number Diff line change
Expand Up @@ -12757,4 +12757,3 @@ article.pytorch-article .tutorials-callout-container .btn.callout-button a {
text-transform: uppercase;
padding-right: 5px;
}
/*# sourceMappingURL=theme.css.map */
25 changes: 4 additions & 21 deletions qiskit_sphinx_theme/pytorch_base/static/js/theme.js
Original file line number Diff line number Diff line change
Expand Up @@ -87,12 +87,7 @@ window.utilities = {
},

headersHeight: function() {
if (document.getElementById("pytorch-left-menu").classList.contains("make-fixed")) {
return document.getElementById("pytorch-page-level-bar").offsetHeight;
} else {
return document.getElementById("header-holder").offsetHeight +
document.getElementById("pytorch-page-level-bar").offsetHeight;
}
return document.getElementById("pytorch-page-level-bar").offsetHeight;
},

windowHeight: function() {
Expand Down Expand Up @@ -240,8 +235,7 @@ window.highlightNavigation = {

var scrollPosition = utilities.scrollTop();
var OFFSET_TOP_PADDING = 25;
var offset = document.getElementById("header-holder").offsetHeight +
document.getElementById("pytorch-page-level-bar").offsetHeight +
var offset = document.getElementById("pytorch-page-level-bar").offsetHeight +
OFFSET_TOP_PADDING;

var sections = highlightNavigation.sections;
Expand Down Expand Up @@ -484,9 +478,6 @@ window.sideMenus = {
}

if (rightMenuHasLinks) {
// Don't show the Shortcuts menu title text unless there are menu items
document.getElementById("pytorch-shortcuts-wrapper").style.display = "block";

// We are hiding the titles of the pages in the right side menu but there are a few
// pages that include other pages in the right side menu (see 'torch.nn' in the docs)
// so if we exclude those it looks confusing. Here we add a 'title-link' class to these
Expand Down Expand Up @@ -577,16 +568,8 @@ window.sideMenus = {
},

handleNavBar: function() {
var mainHeaderHeight = document.getElementById('header-holder').offsetHeight;

// If we are scrolled past the main navigation header fix the sub menu bar to top of page
if (utilities.scrollTop() >= mainHeaderHeight) {
document.getElementById("pytorch-left-menu").classList.add("make-fixed");
document.getElementById("pytorch-page-level-bar").classList.add("left-menu-is-fixed");
} else {
document.getElementById("pytorch-left-menu").classList.remove("make-fixed");
document.getElementById("pytorch-page-level-bar").classList.remove("left-menu-is-fixed");
}
document.getElementById("pytorch-left-menu").classList.remove("make-fixed");
document.getElementById("pytorch-page-level-bar").classList.remove("left-menu-is-fixed");
},

expandClosestUnexpandedParentList: function (el) {
Expand Down

0 comments on commit 97f2029

Please sign in to comment.