-
-
Notifications
You must be signed in to change notification settings - Fork 66
Make the theme responsive #46
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
Merged
Merged
Changes from all commits
Commits
Show all changes
24 commits
Select commit
Hold shift + click to select a range
7aba474
Make theme responsive
obulat 203b40a
Address code review issues
obulat 10f4349
Use css for opening/closing menu
obulat ff61d60
Adjust font and selects
obulat 7640739
Add language and version switcher placeholders
obulat ecf73cf
Remove duplicate rootrellink declaration
obulat 43da2b4
Remove dublicate relbaritems block
obulat 51a0c7a
Update select styles
obulat efd1ec2
Add missing select styles
obulat 7953f1b
Change the search icon color
obulat 6daa876
Change caret color
obulat 250dbf6
Change hamburger color
obulat 5ffa114
Add an svg icon
obulat e1ee8bd
Add svg logo to layout
obulat 1e182f3
Merge remote-tracking branch 'upstream/master'
obulat 611a1dc
Add switchers to desktop view
obulat 783b19a
Fix toggler accessibility and select paddings
obulat d31371e
Fix html formatting
obulat 190931b
Add link to homepage in mobile version
obulat b6fc448
Add smaller padding to toctree
obulat cd92c8c
Add a different link to the logo
obulat ed7b948
Make logo in mobile version link to 'http://0.0.0.0:8000/3.9/'
obulat d96713e
Make logo in mobile version link to 'http://0.0.0.0:8000/3.9/'
obulat bd1d802
Make logo in mobile version link to theme root
obulat File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains hidden or 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 |
---|---|---|
@@ -0,0 +1,55 @@ | ||
document.addEventListener('DOMContentLoaded', function () { | ||
|
||
// Make tables responsive by wrapping them in a div and making them scrollable | ||
const tables = document.querySelectorAll('table.docutils'); | ||
tables.forEach(function(table){ | ||
table.outerHTML = '<div class="responsive-table__container">' + table.outerHTML + '</div>' | ||
}); | ||
|
||
const togglerInput = document.querySelector('.toggler__input'); | ||
const togglerLabel = document.querySelector('.toggler__label'); | ||
const sideMenu = document.querySelector('.menu-wrapper'); | ||
const menuItems = document.querySelectorAll('.menu') | ||
const doc = document.querySelector('.document'); | ||
const body = document.querySelector('body'); | ||
|
||
function closeMenu() { | ||
togglerInput.checked = false; | ||
sideMenu.setAttribute("aria-expanded", 'false'); | ||
sideMenu.setAttribute('aria-hidden', 'true'); | ||
togglerLabel.setAttribute('aria-pressed', 'false'); | ||
body.style.overflow = 'visible'; | ||
} | ||
function openMenu() { | ||
togglerInput.checked = true; | ||
sideMenu.setAttribute("aria-expanded", 'true'); | ||
sideMenu.setAttribute('aria-hidden', 'false'); | ||
togglerLabel.setAttribute('aria-pressed', 'true'); | ||
body.style.overflow = 'hidden'; | ||
} | ||
|
||
// Close menu when link on the sideMenu is clicked | ||
sideMenu.addEventListener('click', function (event) { | ||
let target = event.target; | ||
if (target.tagName.toLowerCase() !== 'a') return; | ||
closeMenu(); | ||
}) | ||
// Add accessibility data when sideMenu is opened/closed | ||
togglerInput.addEventListener('change', function (e) { | ||
togglerInput.checked ? openMenu() : closeMenu(); | ||
}); | ||
// Make sideMenu links tabbable only when visible | ||
for(let menuItem of menuItems) { | ||
if(togglerInput.checked) { | ||
menuItem.setAttribute('tabindex', '0'); | ||
} else { | ||
menuItem.setAttribute('tabindex', '-1'); | ||
} | ||
} | ||
// Close sideMenu when document body is clicked | ||
doc.addEventListener('click', function () { | ||
if (togglerInput.checked) { | ||
closeMenu(); | ||
} | ||
}) | ||
}) |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.