Skip to content

Commit

Permalink
updates to navbar index + add vertical scrolling
Browse files Browse the repository at this point in the history
  • Loading branch information
dylansdaniels committed Jan 16, 2025
1 parent 6bea6c8 commit 4b20329
Show file tree
Hide file tree
Showing 88 changed files with 6,703 additions and 43 deletions.
7 changes: 7 additions & 0 deletions content/01_overview/01_challange.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<!--
# Title: 1.1 Challenge in Connecting EEG MEG to Neural Circuits
# Updated: 2024-01-16
#
# Contributors:
# Dylan Daniels
-->
7 changes: 7 additions & 0 deletions content/01_overview/02_using_hnn.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<!--
# Title: 1.2 How HNN solve the Challenge by Bridging Scales
# Updated: 2024-01-16
#
# Contributors:
# Dylan Daniels
-->
7 changes: 7 additions & 0 deletions content/01_overview/03_sample_workflow.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<!--
# Title: 1.3 Overview of the Simulation Workflow
# Updated: 2024-01-16
#
# Contributors:
# Dylan Daniels
-->
7 changes: 7 additions & 0 deletions content/01_overview/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<!--
# Title: 1. Overview
# Updated: 2024-01-16
#
# Contributors:
# Dylan Daniels
-->
264 changes: 264 additions & 0 deletions content/01_overview/challange.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,264 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>HNN Textbook</title>
<!-- <base href="/website_redesign/"> -->
<link href="https://fonts.googleapis.com/css2?family=Fira+Sans:wght@400&display=swap" rel="stylesheet">
<link rel="stylesheet" href="../assets/styles.css">
</head>
<body>

<div id="mySidebar" class="sidebar">
<a>
Human Neocortical Neurosolver
</a>
<br>
<a href="/website_redesign/content/preface.html">Preface</a>
<div class="sidebar-list">
<a id="sidebar-header" onclick="toggleSubmenu(event)">
<span class="toggle-icon">+</span>
1. Overview
</a>
<div class="submenu">
<a href="/website_redesign/content/01_overview/challange.html">1.1 Challenge in Connecting EEG MEG to Neural Circuits </a>
<a href="/website_redesign/content/01_overview/using_hnn.html">1.2 How HNN solve the Challenge by Bridging Scales</a>
<a href="/website_redesign/content/01_overview/sample_workflow.html">1.3 Overview of the Simulation Workflow</a>
</div>
</div>
<div class="sidebar-list">
<a id="sidebar-header" onclick="toggleSubmenu(event)">
<span class="toggle-icon">+</span>
2. Background
</a>
<div class="submenu">
<a href="/website_redesign/content/02_background/biophysical_modeling.html">2.1 Challenge in Connecting EEG MEG to Neural Circuits </a>
<a href="/website_redesign/content/02_background/signal_origins.html">2.2 The Origins of Source Localize MEG/EEG Primary Currents</a>
<a href="/website_redesign/content/02_background/glossary.html">2.3 Glossary of Terms</a>
</div>
</div>
<div class="sidebar-list">
<a id="sidebar-header" onclick="toggleSubmenu(event)">
<span class="toggle-icon">+</span>
3. Assumptions and Validation
</a>
<div class="submenu">
<a href="/website_redesign/content/03_assumptions/template_model.html">3.1 Template Model</a>
<a href="/website_redesign/content/03_assumptions/cortical_column_structure.html">3.2 Cortical Column Structure</a>
<a href="/website_redesign/content/03_assumptions/primary_electric_currents.html">3.3 Primary Electrical Currents</a>
<a href="/website_redesign/content/03_assumptions/neuron_morphology.html">3.4 Neuron Morphology and Physiology</a>
<a href="/website_redesign/content/03_assumptions/synaptic_connectivity.html">3.5 Synaptic Connectivity</a>
<a href="/website_redesign/content/03_assumptions/evoked_rhythmic_inputs.html">3.6 Evoked and Rhythmic Driving Inputs</a>
<a href="/website_redesign/content/03_assumptions/tonic_noisy.html">3.7 Tonic and Noisy Driving Inputs</a>
</div>
</div>
<div class="sidebar-list">
<a id="sidebar-header" onclick="toggleSubmenu(event)">
<span class="toggle-icon">+</span>
4. Using HNN
</a>
<div class="submenu">
<a href="/website_redesign/content/04_using_hnn/installation.html">4.1 Installation</a>
<a href="/website_redesign/content/04_using_hnn/network_parameters.html">4.2 Network Parameters</a>
<a href="/website_redesign/content/04_using_hnn/drive_parameters.html">4.3 Drive Parameters</a>
<a href="/website_redesign/content/04_using_hnn/loading_data.html">4.4 Loading Data</a>
<a href="/website_redesign/content/04_using_hnn/running_simulations.html">4.5 Running Simulations</a>
<a href="/website_redesign/content/04_using_hnn/plotting_firing_patterns.html">4.6 Plotting Firing Patterns</a>
<a href="/website_redesign/content/04_using_hnn/recording_lfp.html">4.7 Recording and Plotting LFP</a>
<a href="/website_redesign/content/04_using_hnn/animating_simulations.html">4.8 Animating Simulations</a>
<a href="/website_redesign/content/04_using_hnn/more_visualizations.html">4.9 Additional Visualizations</a>
<a href="/website_redesign/content/04_using_hnn/parallelizing.html">4.10 Running Parallel Simulations</a>
<a href="/website_redesign/content/04_using_hnn/optimization.html">4.11 Optimizing Evoked Responses and Rhythms</a>
<a href="/website_redesign/content/04_using_hnn/batch_simulation.html">4.12 Running Batch Simulations</a>
</div>
</div>
<div class="sidebar-list">
<a id="sidebar-header" onclick="toggleSubmenu(event)">
<span class="toggle-icon">+</span>
5. Simulating ERPs
</a>
<div class="submenu">
<a href="/website_redesign/content/05_erps/overview_of_erps.html">2.1 Review of ERPs</a>
</div>
</div>
<div class="sidebar-list">
<a id="sidebar-header" onclick="toggleSubmenu(event)">
<span class="toggle-icon">+</span>
6. Simulating Alpha/Beta Rhythms
</a>
<div class="submenu">
</div>
</div>
<div class="sidebar-list">
<a id="sidebar-header" onclick="toggleSubmenu(event)">
<span class="toggle-icon">+</span>
7. Simulating Gamma Rhythms
</a>
<div class="submenu">
</div>
</div>
<div class="sidebar-list">
<a id="sidebar-header" onclick="toggleSubmenu(event)">
<span class="toggle-icon">+</span>
8. From Data to Simulation
</a>
<div class="submenu">
</div>
</div>
<div class="sidebar-list">
<a id="sidebar-header" onclick="toggleSubmenu(event)">
<span class="toggle-icon">+</span>
9. Feature Demos
</a>
<div class="submenu">
</div>
</div>
</div>

<div id="main">
<div class="topbar">
<button class="openbtn" onclick="toggleNav()"></button>
<div class="dropdown">
<button id="dropdownButton" class="dropdown-button">
<span>A</span>
</button>
<div class="dropdown-content">
<button class="fontsize-btn" onclick="decreaseFontSize()">A-</button>
<button class="fontsize-btn" onclick="increaseFontSize()">A+</button>
</div>
</div>
<img src="https://hnn.brown.edu/wp-content/uploads/hnn-medium.png"></img>
</div>

<div id="content-wrapper">
<div id="content">

<!--
# Title: 1.1 Challenge in Connecting EEG MEG to Neural Circuits
# Updated: 2024-01-16
#
# Contributors:
# Dylan Daniels
-->
</div> <!-- close content wrapper -->
</div> <!-- close content -->
</div> <!-- close main -->

<script>
let isSidebarOpen = true; // Sidebar is initially open

function toggleNav() {
const sidebar = document.getElementById("mySidebar");
const main = document.getElementById("main");

// Toggle sidebar state
if (isSidebarOpen) {
sidebar.style.width = "0";
main.style.marginLeft = "0";
} else {
sidebar.style.width = "350px"; // Adjust width as needed
main.style.marginLeft = "350px"; // Match margin to new width
}

// Toggle the sidebar state
isSidebarOpen = !isSidebarOpen;
}

// Open the sidebar on page load
window.onload = function() {
// Set initial styles for open state without animation
const sidebar = document.getElementById("mySidebar");
const main = document.getElementById("main");

sidebar.style.transition = "none";
main.style.transition = "none";
sidebar.style.width = "350px";
main.style.marginLeft = "350px";

// Re-enable transition for subsequent toggles
setTimeout(() => {
sidebar.style.transition = "width 0.5s";
main.style.transition = "margin-left 0.5s";
}, 10);
}

function increaseFontSize() {
event.stopPropagation(); // Prevent dropdown from closing
const content = document.getElementById("content");
const currentSize = window.getComputedStyle(content).fontSize;
content.style.fontSize = (parseFloat(currentSize) + 2) + "px";
}

function decreaseFontSize() {
event.stopPropagation(); // Prevent dropdown from closing
const content = document.getElementById("content");
const currentSize = window.getComputedStyle(content).fontSize;
content.style.fontSize = (parseFloat(currentSize) - 2) + "px";
}

// Dropdown for font buttons
function toggleDropdown() {
const dropdownContent = document.querySelector('.dropdown-content');
dropdownContent.style.display = dropdownContent.style.display === 'block' ? 'none' : 'block';
}

// Open/close dropdown on click of the button
document.getElementById('dropdownButton').onclick = function(event) {
event.stopPropagation(); // Prevent the click from triggering the window.onclick event
toggleDropdown();
};

// Close dropdown if clicking outside
window.onclick = function(event) {
const dropdownContent = document.querySelector('.dropdown-content');
if (!event.target.closest('.dropdown')) { // Close if click outside the dropdown
dropdownContent.style.display = 'none';
}
};

function toggleSubmenu(event) {
const header = event.target.closest('#sidebar-header'); // Get the clicked header
const submenu = header.nextElementSibling; // Get the submenu
const toggleIcon = header.querySelector('.toggle-icon'); // Get the icon

if (submenu && submenu.classList.contains('submenu')) {
submenu.classList.toggle('open'); // Toggle the 'open' class to control visibility
toggleIcon.textContent = submenu.classList.contains('open') ? '-' : '+'; // Update icon
}
}

// This function will add the full text to the title attribute for all anchor tags
document.querySelectorAll('.sidebar a').forEach(anchor => {
anchor.setAttribute('title', anchor.textContent);
});

// This function will update the sidebar links when a page is loaded
// locally so that sidebar naivagation remains functional without the
// need for a server
// Note: This should work for Mac/Linux but may not on Windows
document.addEventListener("DOMContentLoaded", function() {
if (window.location.protocol === "file:") {
// get the current local directory path
const currentDir = window.location.pathname.substring(0, window.location.pathname.lastIndexOf('/'));

// get 'absolute' links with root of 'website_redesign'
const links = document.querySelectorAll("#mySidebar a");
links.forEach(link => {
const href = link.getAttribute("href");

if (href && href.startsWith("/")) {
// extract the local root directory
const rootPath = currentDir.split("/website_redesign/")[0];
// prepend root path to link
const resolvedHref = "file://" + rootPath + href;
link.setAttribute("href", resolvedHref);
}
});
}
});

</script>

</body>
</html>
Loading

0 comments on commit 4b20329

Please sign in to comment.