Skip to content

Commit

Permalink
changelog and sidebar fix
Browse files Browse the repository at this point in the history
  • Loading branch information
adpare committed Oct 4, 2023
1 parent d0e0f93 commit 276dcb5
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 8 deletions.
21 changes: 15 additions & 6 deletions attack-theme/static/scripts/sidebar-load-all.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,20 @@ $("#sidebars").load(mod_entry, function() {
let navElements = document.querySelectorAll('.sidenav-head > a');
let winlocation;
navElements.forEach(function(element){
if(!window.location.href.endsWith("/")){
winlocation = window.location.href + "/";
if(!element.href.includes('changelog.html')){
if(!window.location.href.endsWith("/")){
winlocation = window.location.href + "/";
}
else{
winlocation = window.location.href
}
if(!element.href.endsWith("/")){
element.href = element.href + "/";
}
}
else{
winlocation = window.location.href
}
if(!element.href.endsWith("/")){
element.href = element.href + "/";
}
if(element.href == winlocation){
$(element.parentNode).addClass("active")
}});
Expand All @@ -35,7 +40,11 @@ $("#sidebars").load(mod_entry, function() {
let sidenav = $(".sidenav-list");
let sidenav_active_elements = $(".sidenav .active");
if (sidenav_active_elements.length > 0) setTimeout(() => { //setTimeout gives bootstrap time to execute first
sidenav[0].scrollTop = sidenav_active_elements[0].offsetTop - 60;
let offsetValue = sidenav_active_elements[0].offsetTop;
if (offsetValue <= 0){
offsetValue = sidenav_active_elements[sidenav_active_elements.length - 1].offsetTop;
}
sidenav[0].scrollTop = offsetValue - 60;
});
});

Expand Down
2 changes: 1 addition & 1 deletion data/resources_navigation.json
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@
{
"name": "Changelog",
"id": "changelog",
"path": "/resources/changelog.html/",
"path": "/resources/changelog.html",
"children": []
},
{
Expand Down
2 changes: 1 addition & 1 deletion modules/website_build/website_build_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,4 +71,4 @@
website_build_templates_path = "modules/website_build/templates/"

# CHANGELOG md
changelog_md = "Title: Changelog\n" "Template: website_build/changelog\n" "save_as: resources/changelog.html/\n\n"
changelog_md = "Title: Changelog\n" "Template: website_build/changelog\n" "save_as: resources/changelog.html\n\n"

0 comments on commit 276dcb5

Please sign in to comment.