-
Notifications
You must be signed in to change notification settings - Fork 36
/
index.html
288 lines (251 loc) · 10.5 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
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="description" content="Create torrent files directly in your web browser.">
<meta name="keywords" content="torrent,torrent file">
<title>Online Torrent Creator</title>
<style>
body
{
background: #323639;
color: white;
font-family: Sans-Serif;
}
button
{
background-color: #146dff;
border: none;
border-radius: 5px;
color: #ffffff;
padding: 10px 15px 10px 15px;
font-family: "Verdana";
font-size: 24px;
cursor: pointer;
transition: 0.15s;
outline: none;
}
button:hover
{
background-color: #54adff;
cursor: pointer;
}
button:disabled
{
background-color: #77abff;
cursor: not-allowed;
}
textarea
{
color: white;
background: #484848;
border: 1px solid #8a8a8a;
font-size: 22px;
margin: 15px;
padding: 10px;
resize: none;
white-space: nowrap;
font-family: Sans-Serif;
}
textarea::placeholder
{
color: #a7a7a7;
}
input[type="text"]
{
color: white;
background: #484848;
border: 1px solid #8a8a8a;
}
input[type="text"]::placeholder
{
color: #a7a7a7;
}
a
{
color: #32b2ff;
}
select
{
color: white;
background: #484848;
border: 1px solid #8a8a8a;
font-size: 22px;
padding: 2px;
border-radius: 4px;
}
.progress-bar-visible
{
visibility: visible;
opacity: 1;
height: 40px;
transition: opacity 0.3s linear, height 0.3s ease-in-out;
}
.progress-bar-hidden
{
visibility: hidden;
opacity: 0;
height: 0px;
transition: visibility 0s 0.3s, opacity 0.3s linear, height 0.2s ease-in-out;
}
label
{
white-space: nowrap;
}
#trackers_list_overlay
{
visibility: hidden;
opacity: 0;
position: fixed;
background: rgba(0, 0, 0, 0.95);
top: 0;
left: 0;
width: 100%;
height: 100%;
z-index: 1;
}
#trackers_list
{
display: block;
position: relative;
border: 2px solid #606060;
border-radius: 10px;
margin: 20px;
background: black;
opacity: 1;
width: calc(100% - 44px);
padding: 5px;
}
.trackers-list-element
{
margin: 5px;
font-size: 16px;
padding: 5px;
white-space: normal;
}
.tracker-list-element-hidden
{
visibility: hidden;
opacity: 0;
transition: opacity 0.15s ease-out, visibility 0s 0.15s;
}
.input-fullwidth
{
width: calc(100% - 60px);
font-family: Arial, Helvetica, sans-serif;
font-size: 22px;
padding: 5px;
margin-left: 20px;
}
</style>
</head>
<body>
<div id="no_worker_warning" style="display: none; margin: 20px; color: #ff3d58; font-size: 20px;">
Your browser does not support <a href="https://caniuse.com/#feat=webworkers">web workers</a>. Please use a newer browser.
</div>
<div id="page">
<a href="https://github.com/Kimbatt/torrent-creator" style="position: absolute; width: 32px; height: 32px; top:20px; right:20px;">
<svg role="img" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg">
<path fill="white" d="M12 .297c-6.63 0-12 5.373-12 12 0 5.303 3.438 9.8 8.205 11.385.6.113.82-.258.82-.577 0-.285-.01-1.04-.015-2.04-3.338.724-4.042-1.61-4.042-1.61C4.422 18.07 3.633 17.7 3.633 17.7c-1.087-.744.084-.729.084-.729 1.205.084 1.838 1.236 1.838 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3-5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523.105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873.12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92.42.36.81 1.096.81 2.22 0 1.606-.015 2.896-.015 3.286 0 .315.21.69.825.57C20.565 22.092 24 17.592 24 12.297c0-6.627-5.373-12-12-12"></path>
</svg>
</a>
<a id="download_link" style="display: none"></a>
<div style="font-size: 32px; margin: 5px 0px 15px 20px;">Create torrent files online</div>
<button style="width: 200px; margin: 5px 0px 5px 20px;" id="filechooserbutton" onclick="document.getElementById('filechooser').click()">Select file</button>
<button style="width: 200px; margin: 5px 0px 5px 20px;" id="folderchooserbutton" onclick="document.getElementById('folderchooser').click()">Select folder</button>
<div id="selected_file_info" style="display: inline; font-size: 22px; margin-left: 30px;"></div>
<br />
<input type="file" style="display: none" id="filechooser" onclick="this.value=null" onchange="FileSelected(this.files)">
<input type="file" style="display: none" id="folderchooser" webkitdirectory onclick="this.value=null" onchange="FolderSelected(this.files)">
<div id="no_folder_warning" style="display: none; margin: 20px; color: #ff3d58; font-size: 20px;">
Your browser does not support folder selection, so you can only create torrent files from single files. You can check which browsers support folder selection
<a href="https://caniuse.com/#feat=input-file-directory">here.</a>
<a href="javascript:void(0)" onclick="document.getElementById('no_folder_warning').style.display='none'">(hide warning)</a>
</div>
<div id="no_wasm_warning" style="display: none; margin-left: 20px; color: #ff3d58; font-size: 20px;">
Warning: your browser does not support webassembly. It can take a loooong time to read large files. You can check which browsers support webassembly
<a href="https://caniuse.com/#feat=wasm">here.</a>
<a href="javascript:void(0)" onclick="document.getElementById('no_wasm_warning').style.display='none'">(hide warning)</a>
</div>
<input type="text" id="torrent_name" class="input-fullwidth" style="margin: 20px;" placeholder="Torrent name" oninput="TorrentParamsChanged('name')">
<br />
<div style="display: flex; flex-wrap: wrap;">
<label style="display: inline; margin-left: 30px; font-size: 22px; border-right: 100px solid transparent;">Piece size:
<select id="torrent_block_size" style="width: 200px; margin-left: 20px; margin-bottom: 20px;" oninput="TorrentParamsChanged('blocksize')">
<option value="0">Automatic</option>
<option value="16384">16 kB</option>
<option value="32768">32 kB</option>
<option value="65536">64 kB</option>
<option value="131072">128 kB</option>
<option value="262144">256 kB</option>
<option value="524288">512 kB</option>
<option value="1048576">1 MB</option>
<option value="2097152">2 MB</option>
<option value="4194304">4 MB</option>
<option value="8388608">8 MB</option>
<option value="16777216">16 MB</option>
</select>
</label>
<label style="font-size: 22px; margin-left: 30px; margin-bottom: 20px;" oninput="TorrentParamsChanged('private')">
Private torrent
<input id="torrent_is_private" type="checkbox" style="transform:scale(2); background: white; margin-left: 20px;">
</label>
</div>
<label style="font-size: 22px; margin-left: 30px;">
Set creation date
<input id="torrent_creation_date" type="checkbox" style="transform:scale(2); background: white; margin-left: 20px;" checked
oninput="TorrentParamsChanged('creationdate')"></label>
<br />
<div id="trackers_list_overlay">
<div id="trackers_list">
<button style="position: absolute; margin: 10px 0px 0px 10px;" onclick="ShowTrackers(false)">Close</button>
<div style="left: 50%; font-size: 24px; text-align: center; margin-top: 10px; margin-bottom: 50px;">Click on a tracker to add it to the list!</div>
<div id="tracker_button_container"></div>
<div style="margin: 30px 0px 5px 5px; font-size: 20px;">Tracker list from
<a href="https://github.com/ngosang/trackerslist/">https://github.com/ngosang/trackerslist/</a>
</div>
</div>
</div>
<div style="position: relative;">
<textarea id="torrent_trackers" class="input-fullwidth" style="height: 130px; margin-top: 20px; white-space: pre-wrap;"
placeholder="Trackers, separated by space or newline (optional)" oninput="TorrentParamsChanged('trackers')" onchange="FormatTextareLines(this, false)"></textarea>
<button id="tracker_add_button" style="position: absolute; right: 35px; top: 30px; visibility: hidden; opacity: 0; transition: opacity 0.5s ease-in-out;"
onclick="ShowTrackers(true)">
Add some trackers
</button>
</div>
<br />
<textarea type="text" id="torrent_webseeds" class="input-fullwidth" style="margin-top: 0px; overflow: hidden;"
placeholder="Web seeds, separated by space or newline (optional)" oninput="ResizeTextarea(this);TorrentParamsChanged('url-list')"
onchange="FormatTextareLines(this)"></textarea>
<br />
<textarea type="text" id="torrent_comment" class="input-fullwidth" style="margin-top: 0px; overflow: hidden;"
placeholder="Comment (optional)" oninput="ResizeTextarea(this);TorrentParamsChanged('comment')"></textarea>
<br />
<input type="text" id="torrent_source" class="input-fullwidth" style="margin-bottom: 20px;" placeholder="Source (optional)"
oninput="TorrentParamsChanged('source')">
<br />
<div id="error_text" style="display: none; font-size: 25px; color: #ff3d58; margin-left: 20px; margin-bottom: 20px; white-space: pre-line;"></div>
<div id="progressbar_container" class="progress-bar-hidden" style="margin-left: 20px; border: 2px solid #bcbcbc; border-radius: 5px; width: calc(100% - 50px); position: relative;">
<div id="progressbar" style="background: #23b235; width: 0%; height: 100%; border-radius: 3px;"></div>
<div id="progressbar_text" style="display:block; position: absolute; bottom: 4px; font-size: 25px; padding-bottom: 2px; padding-left: 6px; text-shadow: 2px 2px 5px blue;"></div>
</div>
<div id="progressbar_processing_container" class="progress-bar-hidden"
style="margin-left: 20px; margin-top: 6px; border: 2px solid #bcbcbc; border-radius: 5px; width: calc(100% - 50px); position: relative;">
<div id="progressbar_processing" style="background: #23b235; width: 0%; height: 100%; border-radius: 3px;"></div>
<div id="progressbar_processing_text" style="display:block; position: absolute; bottom: 4px; font-size: 25px; padding-bottom: 2px; padding-left: 6px; text-shadow: 2px 2px 5px blue;"></div>
</div>
<button id="create_torrent_button" style="display: grid; margin: 20px 0px 0px 20px; width: calc(100% - 46px); max-width: 600px; height: 100px; font-size: 50px; line-height: 80px;"
onclick="CreateTorrent()" disabled>Create torrent</button>
</div>
<script src="dist/index.js"></script>
<script>
if (typeof Promise === "undefined")
{
var scriptElement = document.createElement("script");
scriptElement.src = "promise-polyfill.js";
document.body.appendChild(scriptElement);
}
</script>
</body>
</html>