Something went wrong. Try again.
Something went wrong. Try again.
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168document.addEventListener("DOMContentLoaded", function () { // Page has finished loading. Now, do things. loadLayoutByPetraPixel();
// Import the time widget loader (the local time thingy in the sidebar) import("https://time.now/static/js/widget-loader.js")});
function loadLayoutByPetraPixel() { const mainEl = document.querySelector("main"); if (!mainEl) return; mainEl.insertAdjacentHTML("beforebegin", headerHTML()); mainEl.insertAdjacentHTML("afterend", footerHTML()); giveActiveClassToCurrentPage();}
const nesting = getNesting();
function headerHTML() { // ${nesting} outputs "./" or "../" depending on current page depth. // You can use it to refer to images etc. // Example: <img src="${nesting}img/logo.png"> might output <img src="../img/logo.png">
return ` <!-- =============================================== --> <!-- HEADER --> <!-- =============================================== -->
<header>
<div class="header-content"> <div class="header-title">Home of Charles</div> <!-- NAVIGATION --> <nav> <ul> <li><a href="/">Home</a></li> <li><a href="/contact">Contact me</a></li> <li><a href="/socials">Socials</a></li> <li><a href="https://blog.chaz.sk" target="_blank">Blog</a></li> <li><a href="https://wallpaper.chaz.sk" target="_blank">My Wallpapers</a></li> </ul> </nav> </div> </header>
<!-- For submenus : --> <!-- <strong>Submenu (hover to show)</strong> --> <!-- <ul> --> <!-- <li><a href="/page-a">Page A</a></li> --> <!-- <li><a href="/page-b">Page B</a></li> --> <!-- <li><a href="/page-c">Page C</a></li> --> <!-- <li><a href="/page-d">Page D</a></li> --> <!-- <li><a href="/page-e">Page E</a></li> --> <!-- </ul> --> <!-- =============================================== --> <!-- RIGHT SIDEBAR --> <!-- =============================================== -->
<aside class="right-sidebar">
<div class="sidebar-section"> <div class="sidebar-title">My local time</div> <center> <a href="https://time.now/" class="time-now-widget" data-widget-type="digital" data-timezone="Europe/Bratislava" data-style="minimalist" data-width="150" data-title="Slovakia (Central European Time)" data-bgColor="#ffffff" data-textColor="#000000" data-show-seconds="true" data-show-date="true" data-format-12-hour="false">Slovakia (Central European Time)</a> </center> </div> <div class="sidebar-section"> <div class="sidebar-title">My button</div> <p>If you want to link to my website, you can use this button!</p> <div class="site-button"> <a href="https://chaz.sk/" target="_blank"><img src="/button.png" alt="Chaz"></a> <textarea readonly><a href="https://chaz.sk/" target="_blank"><img src="https://chaz.sk/button.png" alt="Chaz"></a></textarea> </div> </div> </aside> `;}
function footerHTML() { // ${nesting} outputs "./" or "../" depending on current page depth. // You can use it to refer to images etc. // Example: <img src="${nesting}img/logo.png"> might output <img src="../img/logo.png">
return `
<!-- =============================================== --> <!-- FOOTER --> <!-- =============================================== -->
<footer> <center> <!-- Templates so i don't have to rewrite each time : --> <!-- Non-clickable : <img src="/buttons/" alt=""> --> <!-- Clickable : <a href="" target="_blank"><img src="/buttons/" alt=""></a> --> <!-- Actual buttons below : --> <img src="/buttons/pride.gif" alt="pride"> <img src="/buttons/coded_by_a_human.png" alt="coded by a human!"> <a href="https://www.firefox.com/" target="_blank"><img src="/buttons/tested_on_firefox.gif" alt="tested on Firefox"></a> <img src="/buttons/made_on_linux.gif" alt="made on Linux"> <a href="https://petrapixel.neocities.org/" target="_blank"><img src="/buttons/petrapixel.gif" alt="petrapixel"></a> <a href="javascript:alert('were on the web susie')"><img src="/buttons/kris_where_tf_are_we.png" alt="kris where tf are we"></a> <img src="/buttons/internet_privacy_now.gif" alt="internet privacy, NOW!"> <img src="/buttons/stop_microslop.gif" alt="stop Microslop!"> <a href="https://zac0511.com" target="_blank"><img src="/buttons/zac0511.png" alt="Zac0511"></a> <a href="https://petrapixel.neocities.org/indiewebdb/" target="_blank"><img src="/buttons/indiewebdb.png" alt="indie web database"></a> <a href="https://darkworld.download/" target="_blank"><img src="https://darkworld.download/button.gif" alt="Kris Dreemurr"></a> <a href="https://atproto.com" target="_blank"><img src="/buttons/atproto.jpg" alt="AT Protocol"></a> <a href="https://tangled.org/chaz.sk" target="_blank"><img src="/buttons/tangled.gif" alt="Tangled"></a> <a href="https://www.thegreenwebfoundation.org/green-web-check/?url=chaz.sk" target="_blank"><img src="/buttons/green.png" alt="Green web badge" height="50" width="88" width="88"></a> </center> <hr /> <div>© 2026 by Chaz.sk based on <a href="https://zac0511.com">Zac0511s website</a>. He is very cool, you should check him out!<br> This website is open source: <a href="https://tangled.org/chaz.sk/website">https://tangled.org/chaz.sk/website</a></div> <hr /> <div>Last update: 2/12/2026 18:40 CET</div> </footer>`;}
/* Do not edit anything below this line unless you know what you're doing. */
function giveActiveClassToCurrentPage() { const els = document.querySelectorAll("nav a"); [...els].forEach((el) => { const href = el.getAttribute("href").replace(".html", "").replace("#", ""); const pathname = window.location.pathname.replace("/public/", ""); const currentHref = window.location.href.replace(".html", "") + "END";
/* Homepage */ if (href == "/" || href == "/index.html") { if (pathname == "/") { el.classList.add("active"); } } else { /* Other pages */ if (currentHref.includes(href + "END")) { el.classList.add("active");
/* Subnavigation: */ if (el.closest("details")) { el.closest("details").setAttribute("open", "open"); el.closest("details").classList.add("active"); }
if (el.closest("ul")) { if (el.closest("ul").closest("ul")) { el.closest("ul").closest("ul").classList.add("active"); } } } } });}
function getNesting() { const numberOfSlashes = window.location.pathname.split("/").length - 1; if (numberOfSlashes == 1) return "./"; return "../".repeat(numberOfSlashes - 1);}