forked from josephfortune/wad-editor
-
Notifications
You must be signed in to change notification settings - Fork 1
/
index.html
278 lines (274 loc) · 11.1 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
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<link rel="canonical" href="https://waditor.pigeonivy.com" />
<meta
name="description"
content="Waditor helps you create, modify, and export Half-Life WAD3 (.wad) files online in the browser."
/>
<meta name="author" content="@rehhouari" />
<title>Waditor - Online Half-Life WAD Editor & Creator</title>
<!-- Social meta tags -->
<meta name="twitter:card" content="summary_large_image" />
<meta name="twitter:site" content="rehhouari" />
<meta name="twitter:title" content="Waditor - Online Half-Life WAD Editor & Creator" />
<meta name="twitter:description" content="Waditor helps you create, modify, and export Half-Life WAD3 (.wad) files online in the browser." />
<meta name="twitter:image" content="https://waditor.pigeonivy.com/images/twimage.png" />
<meta property="og:title" content="Waditor - Online Half-Life WAD Editor & Creator">
<meta property="og:site_name" content="Waditor">
<meta property="og:url" content="https://waditor.pigeonivy.com" itemprop="thumbnailUrl">
<meta property="og:description" content="Waditor helps you create, modify, and export Half-Life WAD3 (.wad) files online in the browser.">
<meta property="og:type" content="website">
<meta property="og:image" content="https://waditor.pigeonivy.com/waditor-ogimage.png">
<script src="/js/windicss.js" defer init></script>
<script type="module" src="/js/main.js"></script>
<link rel="icon" type="image/x-icon" href="/favicon.ico" />
</head>
<body class="bg-cool-gray-400 px-4 h-screen pt-4 block" hidden>
<!-- Main App -->
<div
id="app"
class="flex flex-col md:w-full sm:w-full lg:w-md xl:w-xl 2xl:w-2xl mx-auto !max-w-full rounded-t-xl bg-cool-gray-800 text-white tracking-tighter text-center shadow-lg"
>
<!-- Header -->
<div class="p-4 flex-col">
<p class="text-xl font-bold my-2">Waditor</p>
<p class="my-1 text-sm">
Create, modify, and export Half-Life (GoldSrc) WAD3 files.
</p>
</div>
<!-- Screens -->
<div
class="flex-col flex-grow bg-gray-100 text-cool-gray-800 children:p-4 py-4"
>
<!-- File Upload Zone Screen -->
<div v-if="!uploaded && !error">
<h5>
Drag & drop a Half-Life <span class="text-gray-600">WAD3</span
><sup
><a
target="_blank"
href="https://www.j0e.io/tutorials/wad3-format/"
>[1]</a
></sup
><sup
><a
target="_blank"
href="https://developer.valvesoftware.com/wiki/WAD"
>[2]</a
></sup
>
file or click to select it
</h5>
<input
id="upload"
type="file"
@input="onUpload"
class="max-w-full px-10 py-10 transparent bg-white rounded-lg shadow-lg"
/>
<h5>Or, create a new one</h5>
<input
type="text"
id="new_wad_name"
minlength="1"
v-model="newFileName"
autofocus
class="h-8 p-2 max-w-full rounded-lg font-semibold transition ring-2 ring-cool-gray-300 focus:outline-none focus:ring-cool-gray-800 focus:ring-inset"
/>
<button
class="h-8 px-3 font-semibold transition rounded-lg enabled:cursor-pointer bg-gray-300 focus:outline-none focus:ring-2 focus:ring-cool-gray-800 focus:ring-inset enabled:text-gray-800 hover:text-cool-gray-800"
@click="createEmpty()"
type="button"
>
Create
</button>
</div>
<!-- Error Screen -->
<div v-if="error">
<p class="mt-0 text-lg font-bold">Error</p>
<p class="text-md my-8">{{error}}</p>
<button
class="h-8 px-3 font-semibold transition rounded-lg enabled:cursor-pointer bg-gray-300 focus:outline-none focus:ring-2 focus:ring-cool-gray-800 focus:ring-inset enabled:text-gray-800 hover:text-cool-gray-800"
@click="clearError()"
type="button"
>
Go Back
</button>
</div>
<!-- WAD Screen -->
<div v-if="uploaded && !error" class="flex flex-col space-y-3 pt-0">
<div class="flex flex-row space-x-2">
<p class="text-sm flex-col flex-grow text-left">
Selected File: <span class="font-bold text-md">{{fileName}}</span>
</p>
<div class="flex-col self-center">
<button
:disabled="interfaceDisabled"
class="h-8 px-2 font-semibold transition rounded-lg enabled:cursor-pointer bg-gray-300 focus:outline-none focus:ring-2 focus:ring-cool-gray-800 focus:ring-inset enabled:text-gray-800 hover:text-cool-gray-800"
@click="reset()"
type="button"
>
Close
</button>
</div>
</div>
<hr class="border-b-2 h-1 w-full !mt-0 border-gray-300" />
<div class="flex flex-row">
<div class="self-start flex-col flex-grow text-left">
<button
:disabled="interfaceDisabled"
class="h-8 px-3 font-semibold transition rounded-lg enabled:cursor-pointer bg-gray-300 focus:outline-none focus:ring-2 focus:ring-cool-gray-800 focus:ring-inset enabled:text-gray-800 hover:text-cool-gray-800"
@click="saveZip()"
type="button"
>
Save ZIP
</button>
<button
:disabled="interfaceDisabled"
class="h-8 px-3 font-semibold transition rounded-lg enabled:cursor-pointer bg-gray-300 focus:outline-none focus:ring-2 focus:ring-cool-gray-800 focus:ring-inset enabled:text-gray-800 hover:text-cool-gray-800"
@click="saveWad()"
type="button"
>
Save WAD
</button>
</div>
<div class="text-right self-end">
<input
id="add_img"
type="file"
accept=".bmp, .png, .jpg, .gif"
@change="addTexture(event)"
hidden
/>
<button
:disabled="interfaceDisabled"
class="self-end h-8 px-3 font-semibold transition rounded-lg enabled:cursor-pointer bg-gray-300 focus:outline-none focus:ring-2 focus:ring-cool-gray-800 focus:ring-inset enabled:text-gray-800 hover:text-cool-gray-800"
@click="add_img.click()"
type="button"
>
Add Texture
</button>
</div>
</div>
<!-- Canvas Display -->
<div
class="rounded-lg bg-white shadow-lg p-2 w-full"
v-if="textures.length"
>
<div class="flex flex-row m-2">
<!-- Renaming -->
<div class="flex-col flex-grow text-left">
<input
:disabled="interfaceDisabled"
type="text"
name="rename"
id="rename"
:placeholder="textures[selected]?.name"
maxlength="12"
minlength="1"
v-model="renameInput"
v-effect="$el.value = textures[selected]?.name"
autofocus
class="h-8 p-2 w-32 max-w-full rounded-lg font-semibold transition ring-2 ring-cool-gray-300 focus:outline-none focus:ring-cool-gray-800 focus:ring-inset"
/>
<button
:disabled="interfaceDisabled || renameInput == textures[selected]?.name || renameInput < 1 || renameInput > 12"
class="self-end h-8 px-3 font-semibold transition rounded-lg enabled:cursor-pointer bg-gray-300 focus:outline-none focus:ring-2 focus:ring-cool-gray-800 focus:ring-inset enabled:text-gray-800 enabled:hover:text-cool-gray-800"
@click="rename()"
type="button"
>
Rename
</button>
</div>
<!-- Deleting -->
<div class="flex-col text-right">
<button
:disabled="interfaceDisabled"
class="h-8 px-3 font-semibold transition rounded-lg enabled:cursor-pointer bg-gray-300 focus:outline-none focus:ring-2 focus:ring-cool-gray-800 focus:ring-inset enabled:text-gray-800 hover:text-cool-gray-800"
@click="remove()"
type="button"
>
Delete
</button>
</div>
</div>
</div>
<canvas
v-effect="displayTexture($el)"
width="20"
height="20"
id="viewport"
class="m-1 mt-2 mx-auto"
style="image-rendering: pixelated"
></canvas>
<!-- Texture List-->
<div
class="rounded-lg bg-white shadow-lg flex-col"
v-if="textures.length > 0"
>
<input
:disabled="interfaceDisabled"
type="search"
name="search_textures"
v-model="search"
class="w-full bg-white p-3 font-semibold my-2 focus:outline-none"
placeholder="Search Textures"
v-init="focus()"
/>
<select
:disabled="interfaceDisabled"
id="texture_list"
size="5"
@change="selected = $el.selectedIndex"
v-effect="$el.selectedIndex = selected"
class="w-full text-center children:p-4 children:font-semibold focus:outline-none"
>
<option
:value="entry.name"
:name="entry.name"
v-for="entry in getEntries()"
:hidden="entry.name.toLowerCase().includes(search.toLowerCase().replace(' ', '').trim()) == false"
>
{{entry.name}}
</option>
</select>
</div>
<!-- No texture -->
<div
class="rounded-lg bg-white shadow-lg flex-col"
v-if="!textures.length"
>
<h3>No Textures.</h3>
</div>
</div>
</div>
<!-- Footer -->
<div class="p-4 text-sm flex-col">
<p>
by
<a href="https://github.com/rehhouari" class="text-gray-300"
>Rafik @rehhouari</a
>.
</p>
<p>
Forked from
<a href="https://github.com/josephfortune/wad-editor" class="text-gray-300"
>Joe's WAD editor</a
>.
</p>
<p>
<a
href="https://github.com/rehhouari/wad-editor"
class="text-gray-300 no-underline"
>Contribute on GitHub</a
>
</p>
</div>
</div>
<script src="/js/jszip.min.js"></script>
<script src="/js/FileSaver.min.js"></script>
</body>
</html>