mirror of
https://github.com/simplex-chat/simplex-chat.git
synced 2026-05-12 00:05:03 +00:00
remove extra Javascript
This commit is contained in:
@@ -11,42 +11,6 @@
|
||||
<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>
|
||||
<script>
|
||||
document.addEventListener("DOMContentLoaded", function () {
|
||||
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()}`);
|
||||
});
|
||||
|
||||
document.querySelectorAll("[id]").forEach((element) => {
|
||||
let str = element.getAttribute("id");
|
||||
str = str.split(":").join("");
|
||||
str = str.split("?").join("");
|
||||
str = str.split("/").join("");
|
||||
str = str.split("!").join("");
|
||||
str = str.split("'").join("");
|
||||
|
||||
element.setAttribute("id", str);
|
||||
});
|
||||
|
||||
const url = window.location.href;
|
||||
const hash = url.split("#")[1];
|
||||
if (hash) {
|
||||
console.log("entered")
|
||||
const element = document.getElementById(hash);
|
||||
const yOffset = 0; // Offset for fixed header
|
||||
const y = element.getBoundingClientRect().top + window.pageYOffset + yOffset;
|
||||
|
||||
window.scrollTo({
|
||||
top: y,
|
||||
behavior: 'smooth'
|
||||
});
|
||||
}
|
||||
});
|
||||
</script>
|
||||
</head>
|
||||
|
||||
<body class="sm:bg-gray-100">
|
||||
@@ -78,24 +42,6 @@
|
||||
</footer>
|
||||
|
||||
<script>
|
||||
window.addEventListener("click", (e) => {
|
||||
if (e.target.tagName === "A") {
|
||||
e.preventDefault();
|
||||
if (e.target.getAttribute("href").split("#")[0] == "") {
|
||||
const id = e.target.getAttribute("href").split("#")[1];
|
||||
const element = document.getElementById(id);
|
||||
const yOffset = 0; // Offset for fixed header
|
||||
const y = element.getBoundingClientRect().top + window.pageYOffset + yOffset;
|
||||
window.scrollTo({
|
||||
top: y,
|
||||
behavior: 'smooth'
|
||||
});
|
||||
} else {
|
||||
window.open(e.target.href, "_self");
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
// convert relative blog links to absolute links
|
||||
document.querySelectorAll("a").forEach((a) => {
|
||||
const dotSepList = a.getAttribute("href").split(".");
|
||||
|
||||
Reference in New Issue
Block a user