nav box size/toggle patch

This commit is contained in:
2023-02-01 21:56:03 -06:00
parent 3474891c2c
commit 8193a6109e
6 changed files with 30 additions and 35 deletions

View File

@@ -149,6 +149,7 @@ a {
font-size: 1.2rem; font-size: 1.2rem;
font-size: 1rem; font-size: 1rem;
background-color: rgb(156, 49, 45, .4); background-color: rgb(156, 49, 45, .4);
cursor: pointer;
} }
.navElement:hover { .navElement:hover {

View File

@@ -1,4 +1,4 @@
function toggle(dir) { function toggleCheckbox(dir) {
let toggles = document.querySelectorAll( let toggles = document.querySelectorAll(
".checkbox-wrapper input[type=checkbox]" ".checkbox-wrapper input[type=checkbox]"
); );

View File

@@ -4,13 +4,6 @@ window.onload = function () {
function onLoaded() { function onLoaded() {
document.body.scrollTop = 0; // For Safari document.body.scrollTop = 0; // For Safari
document.documentElement.scrollTop = 0; // For Chrome, Firefox, IE and Opera document.documentElement.scrollTop = 0; // For Chrome, Firefox, IE and Opera
let navs = document.querySelectorAll(".navElement");
navs.forEach(function (element) {
element.onclick = function () {
window.scrollTo(0, 0);
toggleMenu();
};
});
window.onresize = function () { window.onresize = function () {
resizer(); resizer();
@@ -88,11 +81,9 @@ function toggleMenu() {
} }
} }
const loc = "https://asimonson.com" async function goto(location, {push=true, toggle=true}={}) {
// const loc = 'http://127.0.0.1:5000' console.log(toggle)
let a = await fetch("/api/goto/" + location, {
async function goto(location, push=true) {
let a = await fetch(loc + "/api/goto/" + location, {
credentials: "include", credentials: "include",
method: "GET", method: "GET",
mode: "cors", mode: "cors",
@@ -106,6 +97,10 @@ async function goto(location, push=true) {
eval(x.innerHTML); eval(x.innerHTML);
}); });
document.querySelector("title").textContent = metadata['title']; document.querySelector("title").textContent = metadata['title'];
window.scrollTo(0, 0);
if(toggle){
toggleMenu();
}
if(push){ if(push){
history.pushState(null, null, metadata['canonical']); history.pushState(null, null, metadata['canonical']);
} }
@@ -113,5 +108,5 @@ async function goto(location, push=true) {
function backButton() { function backButton() {
const location = window.location.pathname; const location = window.location.pathname;
goto(location.substring(1), push=false); // remove slash, goto already does that goto(location.substring(1), {push:false}); // remove slash, goto already does that
} }

View File

@@ -90,7 +90,7 @@
<input <input
type="checkbox" type="checkbox"
id="pinned" id="pinned"
onClick='toggle("up")' onClick='toggleCheckbox("up")'
checked checked
/> />
<div class="slider round"></div> <div class="slider round"></div>
@@ -99,20 +99,20 @@
</div> </div>
<div class="flex start"> <div class="flex start">
<label class="switch" htmlFor="education"> <label class="switch" htmlFor="education">
<input type="checkbox" id="education" onClick="toggle('up')" /> <input type="checkbox" id="education" onClick="toggleCheckbox('up')" />
<div class="slider round"></div> <div class="slider round"></div>
<strong>Education</strong> <strong>Education</strong>
</label> </label>
</div> </div>
<div class="flex start"> <div class="flex start">
<label class="switch" htmlFor="experience" onClick="toggle('up')"> <label class="switch" htmlFor="experience" onClick="toggleCheckbox('up')">
<input type="checkbox" id="experience" /> <input type="checkbox" id="experience" />
<div class="slider round"></div> <div class="slider round"></div>
<strong>Work Experience</strong> <strong>Work Experience</strong>
</label> </label>
</div> </div>
<div class="flex start"> <div class="flex start">
<label class="switch" htmlFor="technical" onClick="toggle('up')"> <label class="switch" htmlFor="technical" onClick="toggleCheckbox('up')">
<input type="checkbox" id="technical" /> <input type="checkbox" id="technical" />
<div class="slider round"></div> <div class="slider round"></div>
<strong>Technical</strong> <strong>Technical</strong>
@@ -125,7 +125,7 @@
{{ timeitem(i, var["timeline"][i]["classes"], var["timeline"][i]["date"], var["timeline"][i]["content"])}} {{ timeitem(i, var["timeline"][i]["classes"], var["timeline"][i]["date"], var["timeline"][i]["content"])}}
{% endfor %} {% endfor %}
</div> </div>
<script>toggle('up')</script> <script>toggleCheckbox('up')</script>
</div> </div>
</div> </div>
{% endblock %} {% endblock %}

View File

@@ -65,8 +65,7 @@
<noscript>You need to enable JavaScript to run this app.</noscript> <noscript>You need to enable JavaScript to run this app.</noscript>
<div class="App"> <div class="App">
<div class="header"> <div class="header">
<div id="name-container" onclick="goto('home', {toggle:false})">
<div id="name-container" onclick="goto('home')">
<div class="glitch"> <div class="glitch">
{% for i in range(9) %} {% for i in range(9) %}
<div class="line name"> <div class="line name">
@@ -84,18 +83,18 @@
/> />
<div class="navControl"> <div class="navControl">
<div class="navBar"> <div class="navBar">
<div class="navElement"> <div onClick="goto('home')" class="navElement">
<p onclick="goto('home')">Home</p> <p>Home</p>
</div> </div>
<div class="navElement"> <a href="Resume.pdf" target="_blank" class="navElement">
<a href="Resume.pdf" target="_blank"> Resume </a> <span>Resume</span>
</div> </a>
<div class="navElement"> <div onclick="goto('projects')" class="navElement">
<p onclick="goto('projects')">Projects</p> <p>Projects</p>
</div> </div>
<!-- <a href="/activities">Activities</a> --> <!-- <a href="/activities">Activities</a> -->
<div class="navElement"> <div onclick="goto('about')" class="navElement">
<p onclick="goto('about')">About Me</p> <p>About Me</p>
</div> </div>
</div> </div>
</div> </div>

View File

@@ -15,20 +15,20 @@
<div class="checkbox-wrapper"> <div class="checkbox-wrapper">
<div class="flex start"> <div class="flex start">
<label class="switch" htmlFor="pinned"> <label class="switch" htmlFor="pinned">
<input type="checkbox" id="pinned" onClick="toggle('')" checked/> <input type="checkbox" id="pinned" onClick="toggleCheckbox('')" checked/>
<div class="slider round"></div> <div class="slider round"></div>
<strong>Pinned</strong> <strong>Pinned</strong>
</label> </label>
</div> </div>
<div class="flex start"> <div class="flex start">
<label class="switch" htmlFor="programming"> <label class="switch" htmlFor="programming">
<input type="checkbox" id="programming" onClick="toggle('')" /> <input type="checkbox" id="programming" onClick="toggleCheckbox('')" />
<div class="slider round"></div> <div class="slider round"></div>
<strong>Programming</strong> <strong>Programming</strong>
</label> </label>
</div> </div>
<div class="flex start"> <div class="flex start">
<label class="switch" htmlFor="geospacial" onClick="toggle('')"> <label class="switch" htmlFor="geospacial" onClick="toggleCheckbox('')">
<input type="checkbox" id="geospacial" /> <input type="checkbox" id="geospacial" />
<div class="slider round"></div> <div class="slider round"></div>
<strong>Geospacial</strong> <strong>Geospacial</strong>
@@ -42,5 +42,5 @@
{% endfor %} {% endfor %}
</div> </div>
</div> </div>
<script>toggle('')</script> <script>toggleCheckbox('')</script>
{% endblock %} {% endblock %}