@copoko/space
Version:
CoPoKo Space
98 lines (95 loc) • 3.7 kB
HTML
<!--
* ==========================================================================
* "CoPoKo Space" License
* GNU General Public License version 3.0 (GPLv3)
* ==========================================================================
* This file is part of "CoPoKo Space"
*
* "CoPoKo Space" is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* "CoPoKo Space" is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with "CoPoKo Space". If not, see <http://www.gnu.org/licenses/>.
* ==========================================================================
-->
<html lang="en">
<head>
<meta robots="noindex, nofollow" />
<meta charset="UTF-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>树洞 - Tree Hollow</title>
<meta name="keywords" content="树洞,Tree Hollow">
<meta name="description" content="树洞 - Tree Hollow">
<link rel="stylesheet" href="::CDN_NPM::/github-markdown-css@5/github-markdown-light.css">
<link href="::CDN_NPM::/bootstrap@5/dist/css/bootstrap.min.css" rel="stylesheet" />
<script src="::CDN_NPM::/bootstrap@5/dist/js/bootstrap.min.js"></script>
</head>
<body class="markdown-body">
<div id="wrap" class="container">
<br /><br />
<textarea class="form-control" id="TreeHollow" rows="15"></textarea>
<br />
<div class="d-grid gap-1">
<button type="button" onclick="post()" class="btn btn-primary btn-lg btn-block">Submit</button>
</div>
<br /><br />
<div id="TreeHollowBlock"></div>
<div class="d-grid gap-1">
<button id="more" type="button" onclick="get(window.TreeHollow.point)"
class="btn btn-primary btn-lg btn-block">MORE</button>
</div>
<br /><br />
</div>
<script src="::CDN_NPM::/marked@4/marked.min.js"></script>
<script src="::CDN_GH::/leizongmin/js-xss@1/dist/xss.min.js"></script>
<script type="text/javascript">
function addBlock(s) {
let div = document.createElement("div")
div.innerHTML = '<div class="card">' +
'<div class="card-body">' +
s +
'</div>' +
'</div>'
document.getElementById("TreeHollowBlock").appendChild(div)
}
window.TreeHollow = {}
window.TreeHollow.point = "top"
const get = (i) => {
if (!i) {
addBlock("是的,有底洞");
document.querySelector("#more").style.display = "none"
} else {
fetch("/tree-hollow/next?id=" + window.TreeHollow.point + "&t=" + new Date().getTime()).then(res => res.json()).then(res => {
addBlock(marked.parse(filterXSS(res["text"])), "success", 0);
console.log(res["point"]);
window.TreeHollow.point = res["point"]
})
}
}
get(window.TreeHollow.point)
const post = () => {
if (document.getElementById("TreeHollow").value) {
fetch("/tree-hollow", {
method: "POST",
headers: {
"Content-Type": "application/json"
},
body: document.getElementById("TreeHollow").value
}).then(res => res.json()).then(res => {
if (res.sucess) {
window.location.reload();
}
})
}
}
</script>
</body>
</html>