搜索用户工具
在洛谷首页,按F12,点里面的Console或控制台,把下面这段话粘贴到下面输入的框框。然后输入要搜索的用户即可。
(async () => {
const name = prompt("名字?");
if (name === null) {
return;
}
const res = await fetch(`/api/user/search?keyword=${encodeURIComponent(name)}`);
const { users: [user] } = await res.json();
if (user === null) {
alert(`找不到名为“${name}”的用户。`);
return;
}
location.href = `/user/${user.uid}`;
})();