fix: my bad chef
This commit is contained in:
parent
a254e5a0c2
commit
56edb7424c
@ -35,8 +35,16 @@ const getParams = match => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const navigateTo = async (uri) => {
|
const navigateTo = async (uri) => {
|
||||||
if (await router(uri) === 0)
|
if (await router(uri) !== 0)
|
||||||
history.pushState(null, null, uri);
|
return;
|
||||||
|
|
||||||
|
history.pushState(null, null, uri);
|
||||||
|
|
||||||
|
let link = document.querySelector('a[href=\'' + location.pathname + '\']');
|
||||||
|
if (link) {
|
||||||
|
document.querySelector('[data-link].active')?.classList.remove('active');
|
||||||
|
link.classList.add('active');
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
async function renderView(view)
|
async function renderView(view)
|
||||||
@ -117,8 +125,10 @@ document.addEventListener("DOMContentLoaded", () => {
|
|||||||
document.body.addEventListener("click", e => {
|
document.body.addEventListener("click", e => {
|
||||||
if (e.target.matches("[data-link]")) {
|
if (e.target.matches("[data-link]")) {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
document.querySelector('[data-link].active').classList.remove('active');
|
if (e.target.classList.contains('nav-link')) {
|
||||||
e.target.classList.add('active');
|
document.querySelector('[data-link].active')?.classList.remove('active');
|
||||||
|
e.target.classList.add('active');
|
||||||
|
}
|
||||||
navigateTo(e.target.href.slice(location.origin.length));
|
navigateTo(e.target.href.slice(location.origin.length));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -57,6 +57,7 @@ export default class extends AbstractView {
|
|||||||
|
|
||||||
// username
|
// username
|
||||||
let username = document.createElement("a");
|
let username = document.createElement("a");
|
||||||
|
username.setAttribute('data-link', '');
|
||||||
username.id = `username${user.id}`
|
username.id = `username${user.id}`
|
||||||
username.href = `/profiles/${user.id}`;
|
username.href = `/profiles/${user.id}`;
|
||||||
username.style.color = client.notice.online_users[user.id] !== undefined ? "green" : "red";
|
username.style.color = client.notice.online_users[user.id] !== undefined ? "green" : "red";
|
||||||
|
Loading…
Reference in New Issue
Block a user