forked from ProxyPanel/VNet-SSR
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy patherror_formatting.html
51 lines (51 loc) · 1.49 KB
/
error_formatting.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport"
content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>错误格式化</title>
<style type="text/css">
*{
padding:0;
margin:0;
}
.input-textarea textarea{
width: 80%;
height: 300px;
display: block;
box-sizing: content-box;
}
button{
padding: 5px 10px;
background: skyblue;
color:#FFF;
border: 1px deepskyblue solid;
margin: 10px 0;
}
</style>
</head>
<body>
<div>
<div class="input-textarea">
<textarea id="raw"></textarea>
</div>
<button id="convert">格式化</button>
<div class="input-textarea">
<textarea id="formate"></textarea>
</div>
<script type="text/javascript">
var button = document.querySelector("#convert")
button.addEventListener("click",function(){
const rawText = document.querySelector("#raw").value;
const formatText = rawText.replace(/\\r/g, "\r").replace(/\\n/g, "\n").replace(/\\t/g, "\t");
var formateNode = document.querySelector("#formate");
if(formateNode != null){
formateNode.value = formatText;
}
})
</script>
</div>
</body>
</html>