forked from RDCH106/Simple-RFC1738-Encoder
-
Notifications
You must be signed in to change notification settings - Fork 0
/
demo.html
162 lines (137 loc) · 5.16 KB
/
demo.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
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" type="text/css" href="css/bootstrap.min.css">
<link rel="stylesheet" type="text/css" href="css/style.css">
<title>Simple-RFC1738-Encoder by RDCH106</title>
<script src="js/SRE_API.js"></script>
<script>
function convertInput(){
var input = document.getElementById("input").value;
if(document.getElementById("mode-0").checked == true){
if(document.getElementById("utf8-0").checked == true){
document.getElementById("output").value = convertToURLWithUTF8(input);
}else{
document.getElementById("output").value = convertToURL(input);
}
}else{
if(document.getElementById("utf8-0").checked == true){
document.getElementById("output").value = convertToStringWithUTF8(input);
}else{
document.getElementById("output").value = convertToString(input);
}
}
}
function convertInputUTF8(){
var input = document.getElementById("input-UTF8").value;
if(document.getElementById("mode-0-UTF8").checked == true){
document.getElementById("output-UTF8").value = utf8_encode(input);
}else{
document.getElementById("output-UTF8").value = utf8_decode(input);
}
}
</script>
</head>
<body>
<div id="form-corpus">
<form id="generator-form" class="form-horizontal">
<fieldset>
<!-- Form Name -->
<legend>Simple-RFC1738-Encoder</legend>
<!-- Textarea -->
<div class="form-group">
<label class="col-md-4 control-label" for="input">Input</label>
<div class="col-md-4">
<textarea class="form-control" id="input" name="input"></textarea>
</div>
</div>
<!-- Multiple Radios (inline) -->
<div class="form-group">
<label class="col-md-4 control-label" for="mode">Mode</label>
<div class="col-md-4">
<label class="radio-inline" for="mode-0">
<input type="radio" name="mode" id="mode-0" value="encode" checked="checked">
Encode
</label>
<label class="radio-inline" for="mode-1">
<input type="radio" name="mode" id="mode-1" value="decode">
Decode
</label>
</div>
</div>
<!-- Multiple Radios (inline) -->
<div class="form-group">
<label class="col-md-4 control-label" for="utf8">UTF-8</label>
<div class="col-md-4">
<label class="radio-inline" for="utf8-0">
<input type="radio" name="utf8" id="utf8-0" value="on" checked="checked">
On
</label>
<label class="radio-inline" for="utf8-1">
<input type="radio" name="utf8" id="utf8-1" value="off">
Off
</label>
</div>
</div>
<!-- Button -->
<div class="form-group">
<label class="col-md-4 control-label" for="convert"></label>
<div class="col-md-4">
<button type="button" id="convert" name="convert" class="btn btn-primary" onclick="convertInput()">Convert</button>
</div>
</div>
<!-- Textarea -->
<div class="form-group">
<label class="col-md-4 control-label" for="output">Output</label>
<div class="col-md-4">
<textarea class="form-control" id="output" name="output"></textarea>
</div>
</div>
</fieldset>
</form>
</div>
<div id="form-corpus">
<form id="generator-form" class="form-horizontal">
<fieldset>
<!-- Form Name -->
<legend>UTF8-Encoder</legend>
<!-- Textarea -->
<div class="form-group">
<label class="col-md-4 control-label" for="input-UTF8">Input</label>
<div class="col-md-4">
<textarea class="form-control" id="input-UTF8" name="input"></textarea>
</div>
</div>
<!-- Multiple Radios (inline) -->
<div class="form-group">
<label class="col-md-4 control-label" for="mode">Mode</label>
<div class="col-md-4">
<label class="radio-inline" for="mode-0-UTF8">
<input type="radio" name="mode-UTF8" id="mode-0-UTF8" value="encode" checked="checked">
Encode
</label>
<label class="radio-inline" for="mode-1">
<input type="radio" name="mode-UTF8" id="mode-1-UTF8" value="decode">
Decode
</label>
</div>
</div>
<!-- Button -->
<div class="form-group">
<label class="col-md-4 control-label" for="convert-UTF8"></label>
<div class="col-md-4">
<button type="button" id="convert-UTF8" name="convert-UTF8" class="btn btn-primary" onclick="convertInputUTF8()">Convert</button>
</div>
</div>
<!-- Textarea -->
<div class="form-group">
<label class="col-md-4 control-label" for="output-UTF8">Output</label>
<div class="col-md-4">
<textarea class="form-control" id="output-UTF8" name="output-UTF8"></textarea>
</div>
</div>
</fieldset>
</form>
</div>
</body>
</html>