-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
205 lines (191 loc) · 13 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
<!DOCTYPE html>
<html class="h-full">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Truncanator</title>
<link rel="stylesheet" href="https://rsms.me/inter/inter.css">
<link href="/public/css/style.css" rel="stylesheet">
<script defer src="//unpkg.com/@alpinejs/[email protected]/dist/cdn.min.js"></script>
<script defer src="//unpkg.com/[email protected]/dist/cdn.min.js"></script>
</head>
<body class="h-full">
<div class="min-h-full">
<nav class="bg-white border-b border-gray-200">
<div class="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8">
<div class="flex justify-between h-16">
<div class="flex">
<div class="flex-shrink-0 flex items-center">
<img class="block lg:block h-12 sm:h-24 w-auto" src="/public/img/axe.png" alt="Truncanator">
<h1 class="ml-3 text-2xl sm:text-3xl font-bold uppercase"><span class="text-blue-500">Trunc</span><span
class="text-blue-700">anator</span></h1>
</div>
</div>
</div>
</div>
</nav>
<div class="py-10">
<main x-data="truncanator()" x-cloak>
<div class="max-w-7xl mx-auto sm:px-6 lg:px-8">
<div class="bg-gray-50 rounded-lg rounded-lg">
<div class="max-w-2xl mx-auto pt-6 pb-12 px-4 sm:px-6 lg:max-w-7xl lg:px-8">
<h2 class="sr-only">Process image filenames</h2>
<form class="lg:grid lg:grid-cols-2 lg:gap-x-12 xl:gap-x-16" :class="processing ? 'pointer-events-none' : ''">
<!-- Input -->
<div class="mt-10 lg:mt-0">
<h2 class="text-lg font-medium text-gray-900">Input</h2>
<p class="text-sm text-gray-400 mb-2">One line per file path</p>
<label for="input" class="sr-only block text-sm font-medium text-gray-700 sm:mt-px sm:pt-2">Image
filenames</label>
<div class="mt-1 sm:mt-0">
<textarea x-model="input" id="input" name="input" rows="10"
class="shadow-sm block w-full focus:ring-blue-300 focus:border-blue-300 sm:text-sm bg-white border border-gray-200 rounded-lg shadow-sm rounded-md"></textarea>
</div>
</div>
<!-- Output -->
<div class="mt-10 lg:mt-0">
<h2 class="text-lg font-medium text-gray-900">Output</h2>
<p class="text-sm text-gray-400 mb-2">Extracted filenames</p>
<label for="output" class="sr-only block text-sm font-medium text-gray-700 sm:mt-px sm:pt-2">Image
filenames</label>
<div class="mt-1 sm:mt-0">
<textarea x-model="output" readonly id="output" name="output" rows="10"
class="shadow-sm block w-full focus:ring-blue-300 focus:border-blue-300 sm:text-sm border bg-gray-50 border border-gray-200 rounded-lg shadow-sm rounded-md"></textarea>
</div>
</div>
<!-- Truncation options -->
<div class="mt-10 col-span-2">
<div class="space-y-8 divide-y divide-gray-200">
<fieldset>
<legend class="sr-only">Truncation options</legend>
<div class="text-base font-medium text-gray-900" aria-hidden="true">
<svg xmlns="http://www.w3.org/2000/svg" class="h-6 w-6 inline-block" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2">
<path stroke-linecap="round" stroke-linejoin="round" d="M12 6V4m0 2a2 2 0 100 4m0-4a2 2 0 110 4m-6 8a2 2 0 100-4m0 4a2 2 0 110-4m0 4v2m0-6V4m6 6v10m6-2a2 2 0 100-4m0 4a2 2 0 110-4m0 4v2m0-6V4" />
</svg>
Truncation options
</div>
<div class="mt-4 space-y-4">
<!-- Prefixes -->
<div>
<div class="relative flex items-start">
<div class="flex items-center">
<button @click="removePrefix = !removePrefix"
id="removePrefix" name="removePrefix" value="removePrefix"
type="button"
:class="removePrefix ? 'bg-blue-400' : 'bg-gray-200'"
class="relative inline-flex flex-shrink-0 h-6 w-11 border-2 border-transparent rounded-full cursor-pointer transition-colors ease-in-out duration-200 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-blue-400"
role="switch" :aria-checked="removePrefix" aria-labelledby="removePrefix-label">
<span aria-hidden="true"
:class="removePrefix ? 'translate-x-5' : 'translate-x-0'"
class="pointer-events-none inline-block h-5 w-5 rounded-full bg-white shadow transform ring-0 transition ease-in-out duration-200"></span>
</button>
<span class="ml-3 flex-grow flex flex-col" id="removePrefix-label">
<span class="text-sm font-medium text-gray-900">Remove prefixes</span>
<span class="text-sm text-gray-400">Can be a comma separated list of text. (<em>e.g. "image-, file-"</em>)</span>
</span>
</div>
</div>
<div class="ml-14 grid grid-cols-6" x-show="removePrefix" x-collapse>
<label for="prefixes" class="sr-only block text-sm font-medium text-gray-700"
aria-hidden="true">Prefixes</label>
<div class="mt-1 col-span-4">
<input type="text" name="prefixes" id="prefixes" x-model="prefixes"
class="shadow-sm focus:ring-blue-400 focus:border-blue-400 block w-full sm:text-sm border-gray-300 rounded-md">
</div>
</div>
</div>
<!-- Suffixes -->
<div>
<div class="relative flex items-start">
<div class="flex items-center">
<button @click="removeSuffix = !removeSuffix"
id="removeSuffix" name="removeSuffix" value="removeSuffix"
type="button"
:class="removeSuffix ? 'bg-blue-400' : 'bg-gray-200'"
class="relative inline-flex flex-shrink-0 h-6 w-11 border-2 border-transparent rounded-full cursor-pointer transition-colors ease-in-out duration-200 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-blue-400"
role="switch" :aria-checked="removeSuffix" aria-labelledby="removeSuffix-label">
<span aria-hidden="true"
:class="removeSuffix ? 'translate-x-5' : 'translate-x-0'"
class="pointer-events-none inline-block h-5 w-5 rounded-full bg-white shadow transform ring-0 transition ease-in-out duration-200"></span>
</button>
<span class="ml-3 flex-grow flex flex-col" id="removeSuffix-label">
<span class="text-sm font-medium text-gray-900">Remove suffixes</span>
<span class="text-sm text-gray-400">Can be a comma separated list of text. (<em>e.g. "-m, -c"</em>)</span>
</span>
</div>
</div>
<div class="ml-14 grid grid-cols-6" x-show="removeSuffix" x-collapse>
<label for="suffixes" class="sr-only block text-sm font-medium text-gray-700"
aria-hidden="true">Suffixes</label>
<div class="mt-1 col-span-4">
<input type="text" name="suffixes" id="suffixes" x-model="suffixes"
class="shadow-sm focus:ring-blue-400 focus:border-blue-400 block w-full sm:text-sm border-gray-300 rounded-md">
</div>
</div>
</div>
<!-- Duplicates -->
<div class="relative flex items-start">
<div class="flex items-center">
<button @click="removeDuplicates = !removeDuplicates"
id="removeDuplicates" name="removeDuplicates" value="removeDuplicates"
type="button"
:class="removeDuplicates ? 'bg-blue-400' : 'bg-gray-200'"
class="relative inline-flex flex-shrink-0 h-6 w-11 border-2 border-transparent rounded-full cursor-pointer transition-colors ease-in-out duration-200 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-blue-400"
role="switch" :aria-checked="removeDuplicates" aria-labelledby="removeDuplicates-label">
<span aria-hidden="true"
:class="removeDuplicates ? 'translate-x-5' : 'translate-x-0'"
class="pointer-events-none inline-block h-5 w-5 rounded-full bg-white shadow transform ring-0 transition ease-in-out duration-200"></span>
</button>
<span class="ml-3 flex-grow flex flex-col" id="removeDuplicates-label">
<span class="text-sm font-medium text-gray-900">Remove duplicates</span>
<span class="text-sm text-gray-400">Duplicates removed after truncation.</span>
</span>
</div>
</div>
</div>
</fieldset>
<!-- Process -->
<div class="pt-5">
<div class="flex justify-center">
<button @click="truncate()" x-html="processBtn" type="button"
class="ml-3 inline-flex justify-center py-2 px-4 border border-transparent shadow-sm text-sm font-medium rounded-md text-white bg-blue-500 hover:bg-blue-600 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-blue-400">
</button>
</div>
</div>
</div>
</div>
</form>
</div>
</div>
</div>
</main>
</div>
<footer class="bg-white">
<div class="max-w-7xl mx-auto py-12 px-4 sm:px-6 md:flex md:items-center md:justify-between lg:px-8">
<div class="flex justify-center space-x-6 md:order-2">
<a href="https://github.com/yetti/truncanator" title="Truncanator" class="text-gray-400 hover:text-gray-500">
<span class="sr-only">GitHub</span>
<svg class="h-6 w-6" fill="currentColor" viewBox="0 0 24 24" aria-hidden="true">
<path fill-rule="evenodd" d="M12 2C6.477 2 2 6.484 2 12.017c0 4.425 2.865 8.18 6.839 9.504.5.092.682-.217.682-.483 0-.237-.008-.868-.013-1.703-2.782.605-3.369-1.343-3.369-1.343-.454-1.158-1.11-1.466-1.11-1.466-.908-.62.069-.608.069-.608 1.003.07 1.531 1.032 1.531 1.032.892 1.53 2.341 1.088 2.91.832.092-.647.35-1.088.636-1.338-2.22-.253-4.555-1.113-4.555-4.951 0-1.093.39-1.988 1.029-2.688-.103-.253-.446-1.272.098-2.65 0 0 .84-.27 2.75 1.026A9.564 9.564 0 0112 6.844c.85.004 1.705.115 2.504.337 1.909-1.296 2.747-1.027 2.747-1.027.546 1.379.202 2.398.1 2.651.64.7 1.028 1.595 1.028 2.688 0 3.848-2.339 4.695-4.566 4.943.359.309.678.92.678 1.855 0 1.338-.012 2.419-.012 2.747 0 .268.18.58.688.482A10.019 10.019 0 0022 12.017C22 6.484 17.522 2 12 2z" clip-rule="evenodd" />
</svg>
</a>
</div>
<div class="mt-8 md:mt-0 md:order-1">
<p class="text-center text-base text-gray-400">
Built with
<a href="https://alpinejs.dev/" title="Alpine.js">
<img class="inline-block lg:inline-block h-3 w-auto mb-1 hover:opacity-100 opacity-50" src="/public/img/alpinejs.svg" alt="Tailwind" aria-hidden="true"><span class="sr-only">Alpine.js</span>
</a>
and
<a href="https://tailwindcss.com/" title="TailwindCSS">
<img class="inline-block lg:inline-block h-3 w-auto mb-1 hover:opacity-100 opacity-50" src="/public/img/tailwindcss.svg" alt="Tailwind" aria-hidden="true"><span class="sr-only">TailwindCSS</span>
</a>.
<a href="https://www.flaticon.com/free-icons/cultures">Cultures icons created by Freepik - Flaticon</a>
</p>
</div>
</div>
</footer>
</div>
<script src="/public/js/main.js"></script>
</body>
</html>