forked from steveseguin/vdo.ninja
-
Notifications
You must be signed in to change notification settings - Fork 0
/
electroncapture.html
394 lines (343 loc) · 12.5 KB
/
electroncapture.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
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>ElectronCapture Deep Link Generator</title>
<script src="https://cdnjs.cloudflare.com/ajax/libs/tailwindcss/2.2.19/tailwind.min.js"></script>
<style>
/* Modern Grey Theme */
:root {
--primary-color: #2A2A2A;
--secondary-color: #404040;
--accent-color: #6366F1;
--accent-hover: #4F46E5;
--success-color: #22C55E;
--success-hover: #16A34A;
--text-primary: #E5E7EB;
--text-secondary: #9CA3AF;
--background-primary: #1A1A1A;
--background-secondary: #262626;
--background-tertiary: #333333;
--border-color: #404040;
}
body {
background-color: var(--background-primary);
color: var(--text-primary);
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
line-height: 1.5;
min-height: 100vh;
max-width: 640px;
margin: auto auto;
}
.max-w-4xl {
background-color: var(--background-secondary);
border: 1px solid var(--border-color);
box-shadow: 0 4px 6px rgba(0, 0, 0, 0.2);
backdrop-filter: blur(10px);
}
h1 {
color: var(--text-primary);
font-weight: 700;
border-bottom: 2px solid var(--accent-color);
padding-bottom: 0.5rem;
margin-bottom: 2rem;
}
label {
color: var(--text-secondary);
font-weight: 500;
}
input[type="url"],
input[type="number"],
input[type="text"] {
background-color: var(--background-tertiary);
border: 1px solid var(--border-color);
color: var(--text-primary);
transition: all 0.2s ease-in-out;
}
input[type="number"]{
width: 50px;
}
input[type="url"]{
width: 98%;
padding: 5px;
margin: 5px 0;
font-size: 1.1em;
}
input[type="url"]:focus,
input[type="number"]:focus,
input[type="text"]:focus {
border-color: var(--accent-color);
box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.2);
background-color: var(--background-secondary);
}
input[type="checkbox"] {
accent-color: var(--accent-color);
width: 1.2rem;
height: 1.2rem;
border-radius: 4px;
cursor: pointer;
}
.bg-gray-50 {
background-color: var(--background-tertiary);
border: 1px solid var(--border-color);
}
#generatedLink {
background-color: var(--background-secondary);
color: var(--text-primary);
font-family: monospace;
font-size: 0.9rem;
padding: 0.75rem;
border: 1px solid var(--border-color);
}
/* Button Styles */
#copyBtn, #testLink {
padding: 0.5rem 1rem;
font-weight: 500;
transition: all 0.2s ease-in-out;
border: none;
cursor: pointer;
}
#copyBtn {
background-color: var(--accent-color);
color: white;
}
#copyBtn:hover {
background-color: var(--accent-hover);
transform: translateY(-1px);
}
#testLink {
background-color: var(--success-color);
color: white;
}
#testLink:hover {
background-color: var(--success-hover);
transform: translateY(-1px);
}
/* Form Layout Improvements */
.space-y-6 > * {
margin-bottom: 1.5rem;
}
.grid {
gap: 1.5rem;
}
/* Modern Scrollbar */
::-webkit-scrollbar {
width: 8px;
height: 8px;
}
::-webkit-scrollbar-track {
background: var(--background-primary);
}
::-webkit-scrollbar-thumb {
background: var(--border-color);
border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
background: var(--secondary-color);
}
/* Responsive Improvements */
@media (max-width: 768px) {
body {
padding: 1rem;
}
.max-w-4xl {
padding: 1.5rem;
}
.grid {
gap: 1rem;
}
#generatedLink {
font-size: 0.8rem;
}
}
/* Animations */
@keyframes fadeIn {
from {
opacity: 0;
transform: translateY(10px);
}
to {
opacity: 1;
transform: translateY(0);
}
}
.max-w-4xl {
animation: fadeIn 0.3s ease-out;
}
/* Focus Outline */
:focus {
outline: none;
}
/* Copy Button Success State */
#copyBtn.bg-green-500 {
background-color: var(--success-color);
}
#copyBtn.bg-green-500:hover {
background-color: var(--success-hover);
}
</style>
</head>
<body class="bg-gray-100 p-8">
<div class="max-w-4xl mx-auto bg-white rounded-lg shadow-lg p-6" style="padding:20px;">
<h1 class="text-3xl font-bold mb-6 text-gray-800">ElectronCapture Deep Link Generator</h1>
<form id="linkForm" class="space-y-6">
<!-- URL Input -->
<div>
<label class="block text-sm font-medium text-gray-700 mb-2">
Target URL (https://...)
</label>
<input type="url" id="url" required
class="w-full px-3 py-2 border border-gray-300 rounded-md shadow-sm focus:outline-none focus:ring-2 focus:ring-blue-500"
placeholder="https://example.com">
</div>
<!-- Window Size -->
<div class="grid grid-cols-1 md:grid-cols-2 gap-4">
<div>
<label class="block text-sm font-medium text-gray-700 mb-2">
Window Width (pixels)
</label>
<input type="number" id="width"
class="w-full px-3 py-2 border border-gray-300 rounded-md shadow-sm focus:outline-none focus:ring-2 focus:ring-blue-500"
placeholder="1280">
</div>
<div>
<label class="block text-sm font-medium text-gray-700 mb-2">
Window Height (pixels)
</label>
<input type="number" id="height"
class="w-full px-3 py-2 border border-gray-300 rounded-md shadow-sm focus:outline-none focus:ring-2 focus:ring-blue-500"
placeholder="720">
</div>
</div>
<!-- Window Position -->
<div class="grid grid-cols-1 md:grid-cols-2 gap-4">
<div>
<label class="block text-sm font-medium text-gray-700 mb-2">
X Position (pixels)
</label>
<input type="number" id="x"
class="w-full px-3 py-2 border border-gray-300 rounded-md shadow-sm focus:outline-none focus:ring-2 focus:ring-blue-500"
placeholder="100">
</div>
<div>
<label class="block text-sm font-medium text-gray-700 mb-2">
Y Position (pixels)
</label>
<input type="number" id="y"
class="w-full px-3 py-2 border border-gray-300 rounded-md shadow-sm focus:outline-none focus:ring-2 focus:ring-blue-500"
placeholder="100">
</div>
</div>
<!-- Window Title -->
<div>
<label class="block text-sm font-medium text-gray-700 mb-2">
Window Title
</label>
<input type="text" id="title"
class="w-full px-3 py-2 border border-gray-300 rounded-md shadow-sm focus:outline-none focus:ring-2 focus:ring-blue-500"
placeholder="My Window">
</div>
<!-- Checkboxes -->
<div class="grid grid-cols-1 md:grid-cols-3 gap-4">
<div class="flex items-center">
<input type="checkbox" id="pin" class="h-4 w-4 text-blue-600 rounded">
<label class="ml-2 text-sm text-gray-700">
Always on Top
</label>
</div>
<div class="flex items-center">
<input type="checkbox" id="full" class="h-4 w-4 text-blue-600 rounded">
<label class="ml-2 text-sm text-gray-700">
Start Fullscreen
</label>
</div>
<div class="flex items-center">
<input type="checkbox" id="min" class="h-4 w-4 text-blue-600 rounded">
<label class="ml-2 text-sm text-gray-700">
Start Minimized
</label>
</div>
</div>
</form>
<!-- Generated Link Section -->
<div class="mt-8 p-4 bg-gray-50 rounded-lg">
<div class="flex justify-between items-center mb-2">
<label class="block text-sm font-medium text-gray-700">
Generated Deep Link:
</label>
</div>
<div class="flex space-x-4">
<input type="text" id="generatedLink" style="width: calc(100% - 1.5rem - 1px);" readonly
class="w-full px-3 py-2 bg-white border border-gray-300 rounded-md shadow-sm text-gray-700"
value="electroncapture://">
<div class="flex gap-2"> <!-- Added container for buttons -->
<button id="copyBtn" class="px-3 py-1 bg-blue-500 text-white rounded hover:bg-blue-600 text-sm">
Copy Link
</button>
<button id="testLink" class="px-3 py-1 bg-green-500 text-white rounded hover:bg-green-600 text-sm">
Test Link
</button>
</div>
</div>
</div>
</div>
<br />
<small style="color:#888;">Note: You can download <a href="https://github.com/steveseguin/electroncapture/releases/" style="color:#888;" target="_blank"> ElectronCapture here</a> if needed.</small>
<script>
function generateLink() {
const url = document.getElementById('url').value.trim();
if (!url) return;
// Remove 'https://' if present
const cleanUrl = url.replace(/^https?:\/\//, '');
let params = new URLSearchParams();
// Add parameters only if they have values
const width = document.getElementById('width').value;
const height = document.getElementById('height').value;
const x = document.getElementById('x').value;
const y = document.getElementById('y').value;
const title = document.getElementById('title').value;
const pin = document.getElementById('pin').checked;
const full = document.getElementById('full').checked;
const min = document.getElementById('min').checked;
if (width) params.append('w', width);
if (height) params.append('h', height);
if (x) params.append('x', x);
if (y) params.append('y', y);
if (title) params.append('title', title);
if (pin) params.append('pin', 'true');
if (full) params.append('full', 'true');
if (min) params.append('min', 'true');
const paramsString = params.toString();
const deepLink = `electroncapture://${cleanUrl}${paramsString ? '?' + paramsString : ''}`;
document.getElementById('generatedLink').value = deepLink;
document.getElementById('testLink').href = deepLink;
}
// Add event listeners to all form elements
document.querySelectorAll('#linkForm input').forEach(input => {
input.addEventListener('input', generateLink);
input.addEventListener('change', generateLink);
});
document.getElementById('testLink').addEventListener('click', () => {
window.location.href = document.getElementById('generatedLink').value;
});
// Copy button functionality
document.getElementById('copyBtn').addEventListener('click', () => {
const linkInput = document.getElementById('generatedLink');
linkInput.select();
document.execCommand('copy');
// Visual feedback
const copyBtn = document.getElementById('copyBtn');
const originalText = copyBtn.textContent;
copyBtn.textContent = 'Copied!';
copyBtn.classList.add('bg-green-500');
copyBtn.classList.remove('bg-blue-500');
setTimeout(() => {
copyBtn.textContent = originalText;
copyBtn.classList.remove('bg-green-500');
copyBtn.classList.add('bg-blue-500');
}, 2000);
});
</script>
</body>
</html>