-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
223 lines (221 loc) · 8.04 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
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
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
<!--JSON creation for appstore by pwsincd-->
<!doctype html>
<html lang="en">
<head>
<title>Appstore JSON creator</title>
<style>
body {
background-color: #414548;
font-family: "Helvetica Neue",Helvetica,Arial,sans-serif;
}
label{
color:white;
}
textarea {
width: 95%;
padding: 12px 20px;
margin: 8px 0;
display: inline-block;
border: 1px solid #ccc;
border-radius: 4px;
box-sizing: border-box;
}
input[type=text], select {
width: 95%;
padding: 12px 20px;
margin: 8px 0;
display: inline-block;
border: 1px solid #ccc;
border-radius: 4px;
box-sizing: border-box;
}
input[type=submit] {
width: 95%;
background-color: #303335;
color: white;
padding: 14px 20px;
margin: 8px 0;
border: none;
border-radius: 4px;
cursor: pointer;
}
button {
width: 95%;
background-color: #303335;
color: white;
padding: 14px 20px;
margin: 8px 0;
border: none;
border-radius: 4px;
cursor: pointer;
}
input[type=submit]:hover {
background-color: #ffffff;
color: #414548;
}
button:hover {
background-color: #ffffff;
color: #414548;
}
a {
display:block;
background-color: #303335;
color: white;
padding: 14px 20px;
margin: 8px 0;
border: none;
border-radius: 4px;
cursor: pointer;
overflow:auto;
text-decoration:none;
}
a:hover {
background-color: #ffffff;
color: #414548;
}
.form {
width:49%;
float:right;
}
.output {
position: fixed;
width:49%;
float:left;
}
.app{
width: 100%;
}
#download {
width:95%;
text-align:center;
}
</style>
</head>
<body>
<div class="app">
<div class="form">
<form id="hbform" action="#" method="post">
<div>
<label>Application Title</label>
<input type="text" name="title" id="title"/>
</div>
<div>
<label>Authors</label>
<input type="text" name="author" id="author"/>
</div>
<div>
<label>Category</label>
<select name="category" id="category">
<option value="none" selected="selected">None</option>
<option value="tool">Tools</option>
<option value="game">Games</option>
<option value="loader">Loaders</option>
<option value="emu">Emulators</option>
<option value="advanced">Advanced</option>
<option value="theme">Themes</option>
<option value="_misc">Misc</option>
</select>
</div>
<div>
<label>Version</label>
<input type="text" name="version" id="version"/>
</div>
<div>
<label>Source URL</label>
<input type="text" name="url" id="url"/>
</div>
<div>
<label>License</label>
<select name="license" id="license">
<option value="n/a" selected>None</option>
<option value="Affero GPLv3">Affero GPLv3</option>
<option value="Apache v2">Apache v2</option>
<option value="BSD v2">BSD v2</option>
<option value="BSD v3">BSD v3</option>
<option value="Eclipse v2">Eclipse v2</option>
<option value="GPLv2">GPL v2</option>
<option value="GPLv3">GPL v3</option>
<option value="Lesser GPLv2.1">Lesser GPLv2.1</option>
<option value="Lesser GPLv3">Lesser GPLv3</option>
<option value="MIT">MIT</option>
<option value="Mozilla PLv2">Mozilla PLv2</option>
<option value="The Unlicense">The Unlicense</option>
</select>
</div>
<div>
<label>Short Description</label>
<input type="text" name="description" id="description"/>
</div>
<div>
<label>Long Description</label>
<textarea id="details" name="details" rows="20"></textarea>
</div>
<div>
<label>Changelog</label>
<textarea id="changelog" name="changelog" rows="20"></textarea>
</div>
</div>
<div class="output">
<img id="icon" src="https://www.wiiubru.com/images/switch_ftu_icon.png" alt="For The Users" width=20% height=20%>
<textarea id="output" rows="20"></textarea>
<label>JSON Output</label>
<input type="submit" value="CREATE JSON"/>
<div id="copybutton"></div>
<div id="download"></div>
</div>
</div>
</body>
<script>
function toJSONString(form) {
/*Function to poll input areas and write to an object
Modifying the object to be appsotre compatible*/
var obj = {};
var elements = form.querySelectorAll( "input, select, textarea" );
for( var i = 0; i < elements.length; ++i ) {
var element = elements[i];
var name = element.name;
var value = element.value;
if(name) {
obj[name] = value;
}
}
/*Modify object to be appstore compatible*/
deets = document.getElementById("details");
var formdeets = deets.value.replace(/\n/g, '\\n');
obj["details"] = formdeets;
chlog = document.getElementById("changelog");
var formlog = chlog.value.replace(/\n/g, '\\n');
obj["changelog"] = formlog;
return JSON.stringify(obj,undefined,2);
}
/*Listen for form submission*/
document.addEventListener( "DOMContentLoaded", function() {
var form = document.getElementById( "hbform" );
var output = document.getElementById( "output" );
form.addEventListener( "submit", function(e) {
e.preventDefault();
var json = toJSONString(this);
output.innerHTML = json;
//clear download button incase of repeat CREATE presses
document.getElementById("download").innerHTML = "";
//Create Copy Text button of textarea
var copybutton = '<button onclick="copytext()">COPY JSON</button>';
document.getElementById("copybutton").innerHTML = copybutton;
//Create download button from json object
var blob = new Blob([json], {type: "application/json"});
var url = URL.createObjectURL(blob);
var a = document.createElement('a');
a.download = "info.json";
a.href = url;
a.textContent = "DOWNLOAD info.json";
document.getElementById('download').appendChild(a);
}, false);
});
function copytext() {
var copyText = document.getElementById("output");
copyText.select();
document.execCommand("copy");
alert("Your JSON has been Copied to your Clipboard");
}
</script>
</html>