mirror of
https://github.com/simplex-chat/simplex-chat.git
synced 2026-08-07 01:50:05 +00:00
add ids to headers & smooth scrolling
This commit is contained in:
@@ -1,67 +1,93 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||
<meta name="viewport" content="width=\, initial-scale=1.0">
|
||||
<title>{{ title }}</title>
|
||||
<link rel="icon" type="image/png" sizes="96x96" href="/img/favicon.ico">
|
||||
<link href="/css/tailwind.css" rel="stylesheet" />
|
||||
<link rel="stylesheet" href="/css/blogs.css">
|
||||
<link rel="stylesheet" href="/css/blog.css">
|
||||
<script async defer src="https://buttons.github.io/buttons.js"></script>
|
||||
<meta charset="UTF-8" />
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<title>{{ title }}</title>
|
||||
<link rel="icon" type="image/png" sizes="96x96" href="/img/favicon.ico" />
|
||||
<link href="/css/tailwind.css" rel="stylesheet" />
|
||||
<link rel="stylesheet" href="/css/blogs.css" />
|
||||
<link rel="stylesheet" href="/css/blog.css" />
|
||||
<script async defer src="https://buttons.github.io/buttons.js"></script>
|
||||
</head>
|
||||
|
||||
<body class="sm:bg-gray-100">
|
||||
<header>
|
||||
<nav class="container">
|
||||
<a href="/">
|
||||
<img alt="simplex logo" class="logo" src="/img/simplex.svg" />
|
||||
</a>
|
||||
|
||||
<div class="nav__buttons">
|
||||
<div class="github">
|
||||
<a
|
||||
class="github-button"
|
||||
href="https://github.com/simplex-chat/simplex-chat"
|
||||
data-size="large"
|
||||
data-show-count="true"
|
||||
aria-label="Star simplex-chat on GitHub"
|
||||
>Star</a>
|
||||
</div>
|
||||
|
||||
<div class="donate d-none-576">
|
||||
<a href="https://opencollective.com/simplex-chat" target="_blank">
|
||||
<span class="button">Donate</span></a>
|
||||
</div>
|
||||
</div>
|
||||
</nav>
|
||||
</header>
|
||||
<header>
|
||||
<nav class="container">
|
||||
<a href="/">
|
||||
<img alt="simplex logo" class="logo" src="/img/simplex.svg" />
|
||||
</a>
|
||||
|
||||
<section class="container">
|
||||
<div class="bg-white py-6 sm:py-12 sm:px-8 md:px-16 lg:px-20">
|
||||
{{ content | safe }}
|
||||
<div class="nav__buttons">
|
||||
<div class="github">
|
||||
<a class="github-button" href="https://github.com/simplex-chat/simplex-chat" data-size="large"
|
||||
data-show-count="true" aria-label="Star simplex-chat on GitHub">Star</a>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<footer>
|
||||
<div class="container">
|
||||
<img alt="simplex logo" class="logo d-none-992" src="/img/simplex.svg" />
|
||||
<p class="copyright">© 2020-22 SimpleX | Open-Source Project <span class="d-none-576">|</span>
|
||||
<a class="d-none-576" href="https://github.com/simplex-chat" target="_blank"><img
|
||||
src="/img/icons/github.svg"></a>
|
||||
<a class="d-none-576" href="https://www.reddit.com/r/SimpleXChat/" target="_blank"><img
|
||||
src="/img/icons/reddit.svg"></a>
|
||||
<a class="d-none-576" href="https://twitter.com/simplexchat" target="_blank"><img
|
||||
src="/img/icons/twitter.svg"></a>
|
||||
<a class="d-none-576" href="https://www.linkedin.com/company/simplex-chat/" target="_blank"><img
|
||||
src="/img/icons/linkedin.svg"></a>
|
||||
<a class="d-none-576" href="mailto:chat@simplex.chat" target="_blank"><img src="/img/icons/email.svg"></a>
|
||||
</p>
|
||||
<div class="github d-none-992">
|
||||
<a class="github-button" href="https://github.com/simplex-chat/protocol" data-size="large"
|
||||
data-show-count="true" aria-label="Star simplex-chat on GitHub">Star</a>
|
||||
</div>
|
||||
<div class="donate d-none-576">
|
||||
<a href="https://opencollective.com/simplex-chat" target="_blank"> <span class="button">Donate</span></a>
|
||||
</div>
|
||||
</footer>
|
||||
</div>
|
||||
</nav>
|
||||
</header>
|
||||
|
||||
<section class="container">
|
||||
<div class="bg-white py-6 sm:py-12 sm:px-8 md:px-16 lg:px-20">{{ content | safe }}</div>
|
||||
</section>
|
||||
|
||||
<footer>
|
||||
<div class="container">
|
||||
<img alt="simplex logo" class="logo d-none-992" src="/img/simplex.svg" />
|
||||
<p class="copyright">
|
||||
© 2020-22 SimpleX | Open-Source Project <span class="d-none-576">|</span>
|
||||
<a class="d-none-576" href="https://github.com/simplex-chat" target="_blank"><img
|
||||
src="/img/icons/github.svg" /></a>
|
||||
<a class="d-none-576" href="https://www.reddit.com/r/SimpleXChat/" target="_blank"><img
|
||||
src="/img/icons/reddit.svg" /></a>
|
||||
<a class="d-none-576" href="https://twitter.com/simplexchat" target="_blank"><img
|
||||
src="/img/icons/twitter.svg" /></a>
|
||||
<a class="d-none-576" href="https://www.linkedin.com/company/simplex-chat/" target="_blank"><img
|
||||
src="/img/icons/linkedin.svg" /></a>
|
||||
<a class="d-none-576" href="mailto:chat@simplex.chat" target="_blank"><img src="/img/icons/email.svg" /></a>
|
||||
</p>
|
||||
<div class="github d-none-992">
|
||||
<a class="github-button" href="https://github.com/simplex-chat/protocol" data-size="large"
|
||||
data-show-count="true" aria-label="Star simplex-chat on GitHub">Star</a>
|
||||
</div>
|
||||
</div>
|
||||
</footer>
|
||||
|
||||
<script>
|
||||
const h1 = document.querySelectorAll("h1");
|
||||
const h2 = document.querySelectorAll("h2");
|
||||
const h3 = document.querySelectorAll("h3");
|
||||
const h = [...h1, ...h2, ...h3];
|
||||
h.forEach((h) => {
|
||||
h.setAttribute("id", `${h.innerText.split(" ").join("-").toLowerCase()}`);
|
||||
});
|
||||
|
||||
window.addEventListener("click", (e) => {
|
||||
if (e.target.tagName === "A") {
|
||||
e.preventDefault();
|
||||
|
||||
if (e.target.href.split("#")[1]) {
|
||||
const id = e.target.href.split("#")[1];
|
||||
const element = document.getElementById(id);
|
||||
const yOffset = -80; // Offset for fixed header
|
||||
const y = element.getBoundingClientRect().top + window.pageYOffset + yOffset;
|
||||
|
||||
window.scrollTo({
|
||||
top: y,
|
||||
behavior: 'smooth'
|
||||
});
|
||||
} else {
|
||||
window.open(e.target.href, "_blank");
|
||||
}
|
||||
}
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
Reference in New Issue
Block a user