-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
98 lines (85 loc) · 2.2 KB
/
index.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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
<!DOCTYPE html>
<html lang="ja">
<head>
<meta charset="utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
<title>Descript.js</title>
<meta name="viewport" content="width=device-width" />
<script type="text/javascript" charset="utf-8" src="src/Descript.js"></script>
<script type="text/javascript">
window.addEventListener("load", function(){
document.getElementById("descript").addEventListener("keyup", convert);
convert();
function convert(){
var txt = document.getElementById("descript").value;
var descriptObj = new Descript(txt);
var json = JSON.stringify(descriptObj);
json = json.split(":").join(": ")
.split("{").join("{\n")
.split(",").join(",\n")
.split("}").join("\n}\n")
.split("}\n,").join("},");
var lines = json.split("\n").map((function(){
var spaces = 1;
return function(line){
var rslt;
if(line === "") return "";
if(/\{$/.test(line)){
rslt = Array(spaces).join(" ") + line;
spaces += 2;
}else if(/\}\,?$/.test(line)){
spaces -= 2;
rslt = Array(spaces).join(" ") + line;
}else{
rslt = Array(spaces).join(" ") + line;
}
return rslt;
};
})()).filter(function(line){
return line !== "";
});
document.getElementById("json").value = lines.join("\n");
}
});
</script>
<style type="text/css">
html,body,
#descript, #json{
box-sizing: border-box;
position: relative;
height: 100%;
margin: 0px;
}
#descript, #json{
float: left;
width: 50%;
border: 1px solid black;
}
</style>
</head>
<body>
<textarea id="descript">
charset,Shift_JIS
type,ghost
name,Emily/Phase4.5
sakura.name,Emily
kero.name,Teddy
balloon,emily4
id,Emily/Phase4.5
title,Slapstick Beauty
char2.seriko.defaultsurface,200
name.allowoverride,0
install.accept,Emily,エミリ,えみりぃ
craftmanurl,http://ssp.shillest.net/
craftman,[SSPBT/GL03B]Emily Development Team
updateurl,http://ssp.shillest.net/ghost/emily4/
sstp.allowunspecifiedsend,1
icon,icon.ico
icon.minimize,icon_minimize.ico
shiori,yaya.dll
shiori.version,SHIORI/3.0
</textarea>
<textarea id="json">
</textarea>
</body>
</html>