generated from t/malachite
add: user profiles and junk
This commit is contained in:
parent
6b8c33d27f
commit
2bd23f8214
28 changed files with 1139 additions and 108 deletions
|
@ -36,6 +36,10 @@ function media_theme_pref() {
|
|||
}
|
||||
|
||||
globalThis.temporary_set_theme = (theme) => {
|
||||
if (theme === "Auto") {
|
||||
return;
|
||||
}
|
||||
|
||||
document.documentElement.className = theme.toLowerCase();
|
||||
|
||||
if (theme === "Light") {
|
||||
|
@ -206,3 +210,39 @@ globalThis.submitter_load = (submitter) => {
|
|||
},
|
||||
};
|
||||
};
|
||||
|
||||
// users search
|
||||
let search_users_timeout;
|
||||
function search_users(e) {
|
||||
if (search_users_timeout) {
|
||||
clearTimeout(search_users_timeout);
|
||||
}
|
||||
|
||||
if (e.target.value.trim().length === 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
search_users_timeout = setTimeout(() => {
|
||||
fetch("/api/v1/auth/users/search", {
|
||||
method: "POST",
|
||||
headers: {
|
||||
"Content-Type": "application/json",
|
||||
},
|
||||
body: JSON.stringify({
|
||||
prefix: e.target.value.trim(),
|
||||
}),
|
||||
})
|
||||
.then((res) => res.json())
|
||||
.then((res) => {
|
||||
if (res.ok) {
|
||||
document.getElementById("users_search").innerHTML = "";
|
||||
for (const username of res.payload) {
|
||||
document.getElementById("users_search").innerHTML +=
|
||||
`<option value="${username}">${username}</option>`;
|
||||
}
|
||||
} else {
|
||||
show_message(res.message, res.ok);
|
||||
}
|
||||
});
|
||||
}, 1000);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue