Greasy Fork is available in English.
查看评分。
当前为
// ==UserScript==
// @name 查看评分
// @version 0.1.2
// @include https://www.mcbbs.net/pinfen
// @author xmdhs
// @description 查看评分。
// @namespace xmdhs.top
// ==/UserScript==
(async function () {
try {
await fetch(`https://www.mcbbs.net/?new=no&mobile=no`)
} catch (error) {
console.error(error)
}
document.write(`<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width,initial-scale=1">
<title>查看评分</title>
<script src="https://cdn.jsdelivr.net/gh/golang/[email protected]/misc/wasm/wasm_exec.js"></script>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/gh/xmdhs/searchqanda/style.css">
<script>let go;
try {
go = new Go();
} catch (error) {
alert("请更新浏览器")
}
async function fetchAndInstantiate() {
const response = await fetch("https://cdn.jsdelivr.net/gh/xxmdhs/file/pinfen-10.wasm");
const buffer = await response.arrayBuffer();
const obj = await WebAssembly.instantiate(buffer, go.importObject)
go.run(obj.instance);
document.getElementById('q').removeAttribute("readOnly");
}
fetchAndInstantiate();
function Form(f) {
let text = document.querySelector("#q").value.toString();
if (text == "") {
return;
}
pinfen(text, (v) => {
let b = document.createElement("span")
b.innerText = v;
let a = document.getElementById("text");
a.appendChild(b)
a.appendChild(document.createElement("br"))
}, (v) => {
let a = document.getElementById("text");
a.innerHTML = '<textarea id="confirmationText" class="text" cols="86" rows="20" name="confirmationText" style="width: 100%;overflow: auto;word-break: break-all;"></textarea>'
let b = document.getElementById("confirmationText");
b.value = v;
f();
},location.href)
}
</script>
</head>
<body>
<div class="container-lg px-3 my-5 markdown-body">
<h1>主页</h1>
<p>总之懒得换了,就这样吧</p>
<p>在下面那个框中输入 uid,然后回车</p>
<form id="form"><input type="text" id="q" name="q" readonly="readonly" pattern="^\\d+$">
<input type="submit" value="查询">
</form>
<div id="text"></div>
</div>
</body>
</html>`)
document.close();
var t;
window.addEventListener("load", () => {
let f = document.getElementById("form");
f.addEventListener("submit", function (event) {
event.preventDefault();
if (!t) {
t = true;
Form(() => {
t = false;
});
} else {
alert("一次只能查询一个用户")
}
})
})
})();