Skip to content

Commit

Permalink
Prettier
Browse files Browse the repository at this point in the history
  • Loading branch information
svenbledt committed Nov 29, 2022
1 parent 3b16675 commit 09c7117
Show file tree
Hide file tree
Showing 10 changed files with 9,542 additions and 4,900 deletions.
369 changes: 192 additions & 177 deletions about.html

Large diffs are not rendered by default.

1,804 changes: 928 additions & 876 deletions assets/css/style.css

Large diffs are not rendered by default.

11,137 changes: 7,725 additions & 3,412 deletions assets/img/game/Johnny_Silverhand.html

Large diffs are not rendered by default.

172 changes: 92 additions & 80 deletions assets/js/main.js
Original file line number Diff line number Diff line change
@@ -1,179 +1,191 @@
(function() {
(function () {
"use strict";

/**
* Easy selector helper function
*/
const select = (el, all = false) => {
el = el.trim()
el = el.trim();
if (all) {
return [...document.querySelectorAll(el)]
return [...document.querySelectorAll(el)];
} else {
return document.querySelector(el)
return document.querySelector(el);
}
}
};

/**
* Easy event listener function
*/
const on = (type, el, listener, all = false) => {
let selectEl = select(el, all)
let selectEl = select(el, all);
if (selectEl) {
if (all) {
selectEl.forEach(e => e.addEventListener(type, listener))
selectEl.forEach((e) => e.addEventListener(type, listener));
} else {
selectEl.addEventListener(type, listener)
selectEl.addEventListener(type, listener);
}
}
}
};

/**
* Easy on scroll event listener
* Easy on scroll event listener
*/
const onscroll = (el, listener) => {
el.addEventListener('scroll', listener)
}
el.addEventListener("scroll", listener);
};

/**
* Navbar links active state on scroll
*/
let navbarlinks = select('#navbar .scrollto', true)
let navbarlinks = select("#navbar .scrollto", true);
const navbarlinksActive = () => {
let position = window.scrollY + 200
navbarlinks.forEach(navbarlink => {
if (!navbarlink.hash) return
let section = select(navbarlink.hash)
if (!section) return
if (position >= section.offsetTop && position <= (section.offsetTop + section.offsetHeight)) {
navbarlink.classList.add('active')
let position = window.scrollY + 200;
navbarlinks.forEach((navbarlink) => {
if (!navbarlink.hash) return;
let section = select(navbarlink.hash);
if (!section) return;
if (
position >= section.offsetTop &&
position <= section.offsetTop + section.offsetHeight
) {
navbarlink.classList.add("active");
} else {
navbarlink.classList.remove('active')
navbarlink.classList.remove("active");
}
})
}
window.addEventListener('load', navbarlinksActive)
onscroll(document, navbarlinksActive)
});
};
window.addEventListener("load", navbarlinksActive);
onscroll(document, navbarlinksActive);

/**
* Scrolls to an element with header offset
*/
const scrollto = (el) => {
let header = select('#header')
let offset = header.offsetHeight
let header = select("#header");
let offset = header.offsetHeight;

let elementPos = select(el).offsetTop
let elementPos = select(el).offsetTop;
window.scrollTo({
top: elementPos - offset,
behavior: 'smooth'
})
}
behavior: "smooth",
});
};

/**
* Toggle .header-scrolled class to #header when page is scrolled
*/
let selectHeader = select('#header')
let selectTopbar = select('#topbar')
let selectHeader = select("#header");
let selectTopbar = select("#topbar");
if (selectHeader) {
const headerScrolled = () => {
if (window.scrollY > 100) {
selectHeader.classList.add('header-scrolled')
selectHeader.classList.add("header-scrolled");
if (selectTopbar) {
selectTopbar.classList.add('topbar-scrolled')
selectTopbar.classList.add("topbar-scrolled");
}
} else {
selectHeader.classList.remove('header-scrolled')
selectHeader.classList.remove("header-scrolled");
if (selectTopbar) {
selectTopbar.classList.remove('topbar-scrolled')
selectTopbar.classList.remove("topbar-scrolled");
}
}
}
window.addEventListener('load', headerScrolled)
onscroll(document, headerScrolled)
};
window.addEventListener("load", headerScrolled);
onscroll(document, headerScrolled);
}

/**
* Back to top button
*/
let backtotop = select('.back-to-top')
let backtotop = select(".back-to-top");
if (backtotop) {
const toggleBacktotop = () => {
if (window.scrollY > 100) {
backtotop.classList.add('active')
backtotop.classList.add("active");
} else {
backtotop.classList.remove('active')
backtotop.classList.remove("active");
}
}
window.addEventListener('load', toggleBacktotop)
onscroll(document, toggleBacktotop)
};
window.addEventListener("load", toggleBacktotop);
onscroll(document, toggleBacktotop);
}

/**
* Mobile nav toggle
*/
on('click', '.mobile-nav-toggle', function(e) {
select('#navbar').classList.toggle('navbar-mobile')
this.classList.toggle('bi-list')
this.classList.toggle('bi-x')
})
on("click", ".mobile-nav-toggle", function (e) {
select("#navbar").classList.toggle("navbar-mobile");
this.classList.toggle("bi-list");
this.classList.toggle("bi-x");
});

/**
* Mobile nav dropdowns activate
*/
on('click', '.navbar .dropdown > a', function(e) {
if (select('#navbar').classList.contains('navbar-mobile')) {
e.preventDefault()
this.nextElementSibling.classList.toggle('dropdown-active')
}
}, true)
on(
"click",
".navbar .dropdown > a",
function (e) {
if (select("#navbar").classList.contains("navbar-mobile")) {
e.preventDefault();
this.nextElementSibling.classList.toggle("dropdown-active");
}
},
true
);

/**
* Scrool with ofset on links with a class name .scrollto
*/
on('click', '.scrollto', function(e) {
if (select(this.hash)) {
e.preventDefault()
on(
"click",
".scrollto",
function (e) {
if (select(this.hash)) {
e.preventDefault();

let navbar = select('#navbar')
if (navbar.classList.contains('navbar-mobile')) {
navbar.classList.remove('navbar-mobile')
let navbarToggle = select('.mobile-nav-toggle')
navbarToggle.classList.toggle('bi-list')
navbarToggle.classList.toggle('bi-x')
let navbar = select("#navbar");
if (navbar.classList.contains("navbar-mobile")) {
navbar.classList.remove("navbar-mobile");
let navbarToggle = select(".mobile-nav-toggle");
navbarToggle.classList.toggle("bi-list");
navbarToggle.classList.toggle("bi-x");
}
scrollto(this.hash);
}
scrollto(this.hash)
}
}, true)
},
true
);

/**
* Scroll with ofset on page load with hash links in the url
*/
window.addEventListener('load', () => {
window.addEventListener("load", () => {
if (window.location.hash) {
if (select(window.location.hash)) {
scrollto(window.location.hash)
scrollto(window.location.hash);
}
}
});

/**
* Preloader
*/
let preloader = select('#preloader');
let preloader = select("#preloader");
if (preloader) {
window.addEventListener('load', () => {
preloader.remove()
window.addEventListener("load", () => {
preloader.remove();
});
}
/**
* Animation on scroll
*/
window.addEventListener('load', () => {
window.addEventListener("load", () => {
AOS.init({
duration: 1000,
easing: 'ease-in-out',
easing: "ease-in-out",
once: true,
mirror: false
})
mirror: false,
});
});

})()
})();
11 changes: 9 additions & 2 deletions assets/vendor/bootstrap-icons/index.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<!doctype html>
<html lang="en">

<head>
<meta charset="utf-8">
<title>bootstrap-icons</title>
Expand All @@ -8,20 +9,24 @@
.icons {
display: grid;
max-width: 100%;
grid-template-columns: repeat(auto-fit, minmax(100px, 1fr) );
grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
gap: 1.25rem;
}

.icon {
background-color: var(--bs-light);
border-radius: .25rem;
}

.bi {
margin: .25rem;
font-size: 2.5rem;
}

.label {
font-family: var(--bs-font-monospace);
}

.label {
display: inline-block;
width: 100%;
Expand All @@ -36,6 +41,7 @@
<link rel="stylesheet" href="/assets/css/bootstrap.min.css">
<link rel="stylesheet" href="bootstrap-icons.css">
</head>

<body class="text-center">

<h1>bootstrap-icons</h1>
Expand Down Expand Up @@ -7288,4 +7294,5 @@ <h1>bootstrap-icons</h1>
</div>

</body>
</html>

</html>
Loading

0 comments on commit 09c7117

Please sign in to comment.