This repository was archived by the owner on Oct 30, 2026. It is now read-only.
Repository navigation
Expand file tree
/
Copy pathindex.html
More file actions
726 lines (625 loc) · 20.4 KB
/
Copy pathindex.html
File metadata and controls
726 lines (625 loc) · 20.4 KB
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
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
<!DOCTYPE html>
<html lang="tr">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Trip Atma Zamanı!</title>
<style>
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
body {
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
min-height: 100vh;
display: flex;
justify-content: center;
align-items: center;
padding: 20px;
color: #333;
}
.container {
background: white;
border-radius: 20px;
padding: 40px;
box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
width: 100%;
max-width: 600px;
animation: fadeIn 0.5s ease-in;
}
@keyframes fadeIn {
from {
opacity: 0;
transform: translateY(-20px);
}
to {
opacity: 1;
transform: translateY(0);
}
}
h1 {
text-align: center;
color: #667eea;
margin-bottom: 10px;
font-size: 2.5em;
font-weight: 700;
}
.subtitle {
text-align: center;
color: #666;
margin-bottom: 30px;
font-size: 1.1em;
line-height: 1.6;
}
.form-group {
margin-bottom: 25px;
}
label {
display: block;
margin-bottom: 8px;
font-weight: 600;
color: #444;
font-size: 1em;
}
input[type="text"],
textarea {
width: 100%;
padding: 12px 16px;
border: 2px solid #e0e0e0;
border-radius: 10px;
font-size: 1em;
font-family: inherit;
transition: all 0.3s ease;
background-color: #f9f9f9;
}
input[type="text"]:focus,
textarea:focus {
outline: none;
border-color: #667eea;
background-color: white;
box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}
textarea {
min-height: 120px;
resize: vertical;
line-height: 1.5;
}
.char-count {
text-align: right;
font-size: 0.85em;
color: #999;
margin-top: 5px;
}
.button-group {
display: flex;
gap: 15px;
margin-top: 30px;
}
button {
flex: 1;
padding: 14px 24px;
border: none;
border-radius: 10px;
font-size: 1.1em;
font-weight: 600;
cursor: pointer;
transition: all 0.3s ease;
font-family: inherit;
}
.btn-primary {
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
color: white;
box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
}
.btn-primary:hover {
transform: translateY(-2px);
box-shadow: 0 6px 20px rgba(102, 126, 234, 0.6);
}
.btn-primary:active {
transform: translateY(0);
}
.btn-secondary {
background-color: #f5f5f5;
color: #666;
}
.btn-secondary:hover {
background-color: #e0e0e0;
}
.hidden {
display: none !important;
}
.result-container {
text-align: center;
animation: slideIn 0.5s ease-out;
}
@keyframes slideIn {
from {
opacity: 0;
transform: translateX(20px);
}
to {
opacity: 1;
transform: translateX(0);
}
}
.result-container h2 {
color: #667eea;
margin-bottom: 15px;
font-size: 2em;
}
.result-container p {
color: #666;
margin-bottom: 30px;
line-height: 1.6;
font-size: 1.1em;
}
.link-box {
background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
border-radius: 15px;
padding: 20px;
margin: 20px 0;
border: 2px dashed #667eea;
}
.link-box a {
color: #667eea;
text-decoration: none;
font-size: 1.2em;
font-weight: 600;
word-break: break-all;
display: inline-block;
transition: color 0.3s ease;
}
.link-box a:hover {
color: #764ba2;
text-decoration: underline;
}
.copy-btn {
margin-top: 15px;
background-color: #667eea;
color: white;
padding: 10px 20px;
border-radius: 8px;
font-size: 0.9em;
}
.copy-btn:hover {
background-color: #5568d3;
}
.success-message {
background-color: #d4edda;
color: #155724;
padding: 12px;
border-radius: 8px;
margin-top: 15px;
display: none;
}
.success-message.show {
display: block;
animation: fadeIn 0.3s ease-in;
}
.step-indicator {
display: flex;
justify-content: center;
margin-bottom: 30px;
gap: 10px;
}
.step {
width: 40px;
height: 40px;
border-radius: 50%;
display: flex;
align-items: center;
justify-content: center;
font-weight: 600;
background-color: #e0e0e0;
color: #999;
transition: all 0.3s ease;
}
.step.active {
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
color: white;
}
.step.completed {
background-color: #4CAF50;
color: white;
}
.trip-message-container {
text-align: center;
animation: fadeIn 0.5s ease-in;
}
.trip-message-container h2 {
color: #e74c3c;
margin-bottom: 20px;
font-size: 2.5em;
font-weight: 700;
}
.trip-person {
background: linear-gradient(135deg, #ff6b6b 0%, #ee5a6f 100%);
color: white;
padding: 20px;
border-radius: 15px;
margin: 20px 0;
font-size: 1.5em;
font-weight: 600;
box-shadow: 0 4px 15px rgba(238, 90, 111, 0.4);
}
.trip-reason {
background: linear-gradient(135deg, #ffeaa7 0%, #fdcb6e 100%);
padding: 25px;
border-radius: 15px;
margin: 20px 0;
font-size: 1.2em;
line-height: 1.8;
color: #2d3436;
border-left: 5px solid #e74c3c;
text-align: left;
}
.trip-reason-label {
font-weight: 600;
color: #e74c3c;
margin-bottom: 10px;
display: block;
}
.emoji-large {
font-size: 4em;
margin-bottom: 20px;
display: block;
}
@media (max-width: 600px) {
.container {
padding: 25px;
}
h1 {
font-size: 2em;
}
.button-group {
flex-direction: column;
}
button {
width: 100%;
}
}
</style>
</head>
<body>
<div class="container">
<h1>🚀 Trip Atma Zamanı!</h1>
<p class="subtitle">Birisi sana trip atıyorsa, bunu hemen öğren! Aşağıdaki formu doldurarak kendi isminizi, trip atmak istediğiniz kişinin adını ve sebebini belirtin, ardından linkini paylaşın!</p>
<div class="step-indicator">
<div class="step active" id="step1-indicator">1</div>
<div class="step" id="step2-indicator">2</div>
<div class="step" id="step3-indicator">3</div>
</div>
<!-- Adım 1: İsimler -->
<div id="step1">
<div class="form-group">
<label for="yourName">Kendi isminizi yazın:</label>
<input type="text" id="yourName" placeholder="Örn: Ahmet, Ayşe, Mehmet..." autocomplete="off">
</div>
<div class="form-group">
<label for="person">Trip atacağınız kişinin adını yazın:</label>
<input type="text" id="person" placeholder="Örn: Zeynep, Can, Elif..." autocomplete="off">
</div>
<div class="button-group">
<button class="btn-primary" onclick="nextStep()">Devam Et →</button>
</div>
</div>
<!-- Adım 2: Sebep Yazma -->
<div id="step2" class="hidden">
<div class="form-group">
<label for="reason">Trip sebebinizi yazın:</label>
<textarea id="reason" placeholder="Örn: Bugün çok geç kaldı, beni umursamıyor, hep benden bekliyor..." maxlength="500"></textarea>
<div class="char-count"><span id="charCount">0</span>/500</div>
</div>
<div class="button-group">
<button class="btn-secondary" onclick="previousStep()">← Geri</button>
<button class="btn-primary" onclick="generateLink()">Link Oluştur ✨</button>
</div>
</div>
<!-- Adım 3: Sonuç -->
<div id="result" class="hidden">
<div class="result-container">
<h2>🎉 Trip Mesajınız Hazır!</h2>
<p>Tebrikler, trip mesajınızı başarıyla oluşturduk. Aşağıdaki linke tıklayarak veya kopyalayarak trip mesajınızı paylaşabilirsiniz.</p>
<div class="link-box">
<a id="tripLink" href="#" target="_blank"></a>
</div>
<button class="copy-btn" onclick="copyLink()">📋 Linki Kopyala</button>
<div class="success-message" id="copySuccess">✓ Link panoya kopyalandı!</div>
<div class="button-group" style="margin-top: 30px;">
<button class="btn-primary" onclick="resetForm()">🔄 Yeni Trip Oluştur</button>
</div>
</div>
</div>
<!-- Trip Mesajı Görüntüleme -->
<div id="tripMessage" class="hidden">
<div class="trip-message-container">
<span class="emoji-large">😤</span>
<h2>Sana Trip Atıyor!</h2>
<div class="trip-reason" style="margin-bottom: 20px;">
<div style="font-size: 1.3em; line-height: 1.8; text-align: center;">
<strong id="tripFromName" style="color: #667eea;"></strong> kişisi,
<strong id="tripToName" style="color: #e74c3c;"></strong> kişisine trip atıyor!
</div>
</div>
<div class="trip-reason">
<span class="trip-reason-label">Trip Sebebi:</span>
<div id="tripReasonText"></div>
</div>
<div class="button-group" style="margin-top: 30px;">
<button class="btn-primary" onclick="goToHome()">🏠 Ana Sayfaya Dön</button>
</div>
</div>
</div>
</div>
<script>
let yourName = '';
let personName = '';
let reason = '';
let shortLink = '';
// Karakter sayacı
const reasonTextarea = document.getElementById('reason');
const charCount = document.getElementById('charCount');
reasonTextarea.addEventListener('input', function() {
const length = this.value.length;
charCount.textContent = length;
if (length > 450) {
charCount.style.color = '#e74c3c';
} else {
charCount.style.color = '#999';
}
});
// Adım 1: İsim kontrolü ve sonraki adıma geçiş
function nextStep() {
yourName = document.getElementById('yourName').value.trim();
personName = document.getElementById('person').value.trim();
if (!yourName) {
alert("⚠️ Lütfen kendi isminizi girin.");
document.getElementById('yourName').focus();
return;
}
if (yourName.length < 2) {
alert("⚠️ Lütfen en az 2 karakter uzunluğunda bir isim girin.");
document.getElementById('yourName').focus();
return;
}
if (!personName) {
alert("⚠️ Lütfen trip atacağınız kişinin adını girin.");
document.getElementById('person').focus();
return;
}
if (personName.length < 2) {
alert("⚠️ Lütfen en az 2 karakter uzunluğunda bir isim girin.");
document.getElementById('person').focus();
return;
}
// Adım göstergelerini güncelle
document.getElementById('step1-indicator').classList.remove('active');
document.getElementById('step1-indicator').classList.add('completed');
document.getElementById('step2-indicator').classList.add('active');
// Adımları değiştir
document.getElementById('step1').classList.add('hidden');
document.getElementById('step2').classList.remove('hidden');
// Textarea'ya odaklan
setTimeout(() => {
document.getElementById('reason').focus();
}, 100);
}
// Önceki adıma dön
function previousStep() {
// Adım göstergelerini güncelle
document.getElementById('step2-indicator').classList.remove('active');
document.getElementById('step1-indicator').classList.remove('completed');
document.getElementById('step1-indicator').classList.add('active');
// Adımları değiştir
document.getElementById('step2').classList.add('hidden');
document.getElementById('step1').classList.remove('hidden');
// İlk input'a odaklan
setTimeout(() => {
document.getElementById('yourName').focus();
}, 100);
}
// Link oluşturma fonksiyonu
function generateLink() {
reason = document.getElementById('reason').value.trim();
if (!reason) {
alert("⚠️ Lütfen trip sebebinizi yazın.");
document.getElementById('reason').focus();
return;
}
if (reason.length < 5) {
alert("⚠️ Lütfen en az 5 karakter uzunluğunda bir sebep yazın.");
document.getElementById('reason').focus();
return;
}
// Kısa link oluştur
shortLink = generateShortLink(yourName, personName, reason);
// Adım göstergelerini güncelle
document.getElementById('step2-indicator').classList.remove('active');
document.getElementById('step2-indicator').classList.add('completed');
document.getElementById('step3-indicator').classList.add('active');
// Sonuç ekranını göster
document.getElementById('step2').classList.add('hidden');
document.getElementById('result').classList.remove('hidden');
// Linki ayarla
const tripLink = document.getElementById('tripLink');
tripLink.href = shortLink;
tripLink.innerText = shortLink;
}
// Kısa link oluşturma fonksiyonu
function generateShortLink(fromName, toName, reason) {
// Kullanıcı adı, trip atılan kişi ve reason bilgilerini birleştirip Base64 ile encode et
const data = `${fromName}|${toName}|${reason}`;
// Mevcut sayfanın base URL'ini al (query string olmadan)
const baseUrl = window.location.href.split('?')[0];
// UTF-8 karakterleri için önce encodeURIComponent kullan, sonra Base64
const encoded = btoa(encodeURIComponent(data))
.replace(/\+/g, '-') // URL-safe karakterler
.replace(/\//g, '_')
.replace(/=+$/, ''); // Padding'i kaldır
return `${baseUrl}?t=${encoded}`;
}
// Linki kopyalama fonksiyonu
function copyLink() {
const linkText = document.getElementById('tripLink').innerText;
// Modern clipboard API kullan
if (navigator.clipboard && navigator.clipboard.writeText) {
navigator.clipboard.writeText(linkText).then(() => {
showCopySuccess();
}).catch(() => {
fallbackCopy(linkText);
});
} else {
fallbackCopy(linkText);
}
}
// Fallback kopyalama yöntemi
function fallbackCopy(text) {
const textArea = document.createElement('textarea');
textArea.value = text;
textArea.style.position = 'fixed';
textArea.style.opacity = '0';
document.body.appendChild(textArea);
textArea.select();
try {
document.execCommand('copy');
showCopySuccess();
} catch (err) {
alert('Kopyalama başarısız oldu. Lütfen linki manuel olarak kopyalayın.');
}
document.body.removeChild(textArea);
}
// Kopyalama başarı mesajı
function showCopySuccess() {
const successMsg = document.getElementById('copySuccess');
successMsg.classList.add('show');
setTimeout(() => {
successMsg.classList.remove('show');
}, 3000);
}
// Formu sıfırla
function resetForm() {
yourName = '';
personName = '';
reason = '';
shortLink = '';
document.getElementById('yourName').value = '';
document.getElementById('person').value = '';
document.getElementById('reason').value = '';
charCount.textContent = '0';
charCount.style.color = '#999';
// Adım göstergelerini sıfırla
document.getElementById('step1-indicator').classList.remove('completed');
document.getElementById('step1-indicator').classList.add('active');
document.getElementById('step2-indicator').classList.remove('active', 'completed');
document.getElementById('step3-indicator').classList.remove('active', 'completed');
// Adımları sıfırla
document.getElementById('result').classList.add('hidden');
document.getElementById('step2').classList.add('hidden');
document.getElementById('step1').classList.remove('hidden');
// İlk input'a odaklan
setTimeout(() => {
document.getElementById('yourName').focus();
}, 100);
}
// Enter tuşu ile form gönderimi
document.getElementById('yourName').addEventListener('keypress', function(e) {
if (e.key === 'Enter') {
e.preventDefault();
document.getElementById('person').focus();
}
});
document.getElementById('person').addEventListener('keypress', function(e) {
if (e.key === 'Enter') {
e.preventDefault();
nextStep();
}
});
document.getElementById('reason').addEventListener('keydown', function(e) {
if (e.key === 'Enter' && e.ctrlKey) {
e.preventDefault();
generateLink();
}
});
// Ana sayfaya dön fonksiyonu
function goToHome() {
window.location.href = window.location.pathname;
}
// URL parametrelerinden trip bilgisini oku ve göster
function checkTripMessage() {
const urlParams = new URLSearchParams(window.location.search);
let decodedFromName = '';
let decodedToName = '';
let decodedReason = '';
// Önce yeni kısa link formatını kontrol et (?t=...)
const tripParam = urlParams.get('t');
if (tripParam) {
try {
// Base64 decode ve URL-safe karakterleri geri çevir
const base64 = tripParam
.replace(/-/g, '+')
.replace(/_/g, '/');
// Padding ekle (gerekirse)
const padded = base64 + '='.repeat((4 - base64.length % 4) % 4);
// Decode et
const decoded = decodeURIComponent(atob(padded));
const parts = decoded.split('|');
if (parts.length === 3) {
// Yeni format: fromName|toName|reason
decodedFromName = parts[0];
decodedToName = parts[1];
decodedReason = parts[2];
} else if (parts.length === 2) {
// Eski format desteği (geriye dönük uyumluluk)
decodedFromName = parts[0];
decodedToName = parts[0]; // Eski linklerde sadece bir isim vardı
decodedReason = parts[1];
}
} catch (e) {
console.error('Link decode hatası:', e);
return false;
}
}
// Eski format desteği (geriye dönük uyumluluk için)
else {
const personParam = urlParams.get('person');
const reasonParam = urlParams.get('reason');
if (personParam && reasonParam) {
decodedFromName = decodeURIComponent(personParam);
decodedToName = decodeURIComponent(personParam);
decodedReason = decodeURIComponent(reasonParam);
} else {
return false;
}
}
if (decodedFromName && decodedToName && decodedReason) {
// Tüm form elemanlarını gizle
document.getElementById('step1').classList.add('hidden');
document.getElementById('step2').classList.add('hidden');
document.getElementById('result').classList.add('hidden');
document.querySelector('.step-indicator').classList.add('hidden');
document.querySelector('.subtitle').classList.add('hidden');
document.querySelector('h1').classList.add('hidden');
// Trip mesajını göster
document.getElementById('tripFromName').textContent = decodedFromName;
document.getElementById('tripToName').textContent = decodedToName;
document.getElementById('tripReasonText').textContent = decodedReason;
document.getElementById('tripMessage').classList.remove('hidden');
// Sayfa başlığını güncelle
document.title = `${decodedFromName} ${decodedToName}'e trip atıyor!`;
return true;
}
return false;
}
// Sayfa yüklendiğinde kontrol et
window.addEventListener('load', function() {
// Önce trip mesajı var mı kontrol et
if (!checkTripMessage()) {
// Trip mesajı yoksa normal formu göster
document.getElementById('yourName').focus();
}
});
</script>
</body>
</html>