Skip to content

Commit c49fa70

Browse files
committed
添加手机安装开发环境指导
1 parent b040bb2 commit c49fa70

File tree

2 files changed

+62
-0
lines changed

2 files changed

+62
-0
lines changed

app.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,13 @@ app.use(bodyParser.urlencoded({
2020
}))
2121
app.use(bodyParser.json())
2222

23+
app.get("/", (req, res) => {
24+
let html = fs.readFileSync(path.join(WORK_DIR, "guide.html")).toString()
25+
let js = fs.readFileSync(path.join(WORK_DIR, "install-runtime.js")).toString()
26+
html = html.replace("@@code@@", js)
27+
res.send(html)
28+
})
29+
2330
app.get('/ping', (req, res) => {
2431
console.log('[-] ping..')
2532
setTimeout(() => {

guide.html

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="UTF-8">
5+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
6+
<title>手机安装「小件件」开发环境指导</title>
7+
</head>
8+
<body>
9+
<h1><a href="https://x.im3x.cn" style="text-decoration: none;color:#666;">「小件件」</a>开发环境安装</h1>
10+
<button id="copy" onclick="copy()">👇 1.点击复制下方代码</button>
11+
<textarea id="js" readonly>@@code@@</textarea>
12+
<p>打开 Scriptable,点击 ➕,粘贴,运行 ▶️</p>
13+
<a id="open" href="scriptable:///add?scriptName=hello">👉 2. 点击打开 Scriptable</a>
14+
</body>
15+
<style>
16+
body {
17+
display: flex;
18+
flex-direction: column;
19+
align-items: center;
20+
justify-content: center;
21+
}
22+
#copy, #open {
23+
width: 200px;
24+
height: 50px;
25+
background-color: green;
26+
color: #FFF;
27+
border-radius: 5px;
28+
display: flex;
29+
align-items: center;
30+
justify-content: center;
31+
text-decoration: none;
32+
font-size: 14px;
33+
}
34+
#open {
35+
background-color: darkred;
36+
}
37+
#js {
38+
width: 200px;
39+
height: 100px;
40+
margin: 20px;
41+
z-index: -1;
42+
}
43+
</style>
44+
<script>
45+
var copyOK = 0;
46+
function copy () {
47+
document.getElementById("js").select();
48+
document.execCommand("Copy");
49+
document.getElementById("copy").innerText = "复制成功!" + (copyOK > 0 ? '+'+copyOK :'')
50+
copyOK ++;
51+
document.getElementById("open").focus()
52+
}
53+
54+
</script>
55+
</html>

0 commit comments

Comments
 (0)