-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathindex.html
159 lines (151 loc) · 6.19 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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Tracker Zone</title>
<link rel="icon" href="magnet.ico" type="image/x-icon">
<style>
body {
font-family: Arial, sans-serif;
margin: 0;
padding: 20px;
background-color: #f7f7f7;
}
.container {
max-width: 56%; /* Reduced by 20% from 70% */
margin: 0 auto;
background: white;
padding: 16px; /* Reduced padding */
border-radius: 8px;
box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
}
textarea {
width: calc(100% - 16px); /* Full width minus reduced padding */
height: 160px; /* Reduced height */
margin: 0 auto 16px; /* Center horizontally */
padding: 8px; /* Reduced padding */
border: 1px solid #ddd;
border-radius: 4px;
font-size: 12px; /* Reduced font size */
display: block; /* Block element to center */
box-sizing: border-box; /* Include padding and border in width calculation */
}
button {
display: block;
width: 100%;
padding: 8px; /* Reduced padding */
margin-bottom: 8px; /* Reduced margin */
background-color: #28a745;
border: none;
border-radius: 4px;
color: white;
font-size: 14px; /* Reduced font size */
cursor: pointer;
}
button:hover {
background-color: #218838;
}
.output {
margin-top: 16px; /* Reduced margin */
padding: 8px; /* Reduced padding */
background-color: #f1f1f1;
border: 1px solid #ddd;
border-radius: 4px;
white-space: pre-wrap;
}
.hidden {
display: none;
}
.popup {
position: fixed;
top: 20px;
left: 50%;
transform: translateX(-50%);
background-color: #28a745;
color: white;
padding: 8px 16px; /* Reduced padding */
border-radius: 4px;
z-index: 1000;
opacity: 0;
transition: opacity 0.5s ease-in-out;
}
.popup.show {
opacity: 1;
}
.tracker-count {
margin-top: 8px; /* Reduced margin */
font-size: 14px; /* Reduced font size */
font-weight: bold;
}
</style>
</head>
<body>
<div class="container">
<h1>Tracker Zone</h1>
<form id="tracker-form">
<textarea id="tracker-input" placeholder="Paste your tracker list here..."></textarea>
<button type="submit">Format Trackers</button>
</form>
<button id="fetch-button">Fetch Trackers from URL</button>
<button id="copy-button" class="hidden">Copy All</button>
<div class="tracker-count" id="tracker-count">Total Trackers: 0</div>
<div class="output" id="tracker-output"></div>
</div>
<div class="popup" id="popup-message"></div>
<script>
function showPopup(message) {
const popup = document.getElementById('popup-message');
popup.textContent = message;
popup.classList.add('show');
setTimeout(() => {
popup.classList.remove('show');
}, 3000); // Popup duration: 3 seconds
}
function formatTrackers(trackers) {
const uniqueTrackers = [...new Set(trackers.split(/\s+/).filter(Boolean))];
return uniqueTrackers.join('\n\n');
}
document.getElementById('tracker-form').addEventListener('submit', function (e) {
e.preventDefault();
const input = document.getElementById('tracker-input').value;
const formattedTrackers = formatTrackers(input);
document.getElementById('tracker-output').textContent = formattedTrackers;
document.getElementById('copy-button').classList.remove('hidden');
document.getElementById('tracker-count').textContent = `Total Trackers: ${formattedTrackers.split('\n\n').length}`;
showPopup('Trackers Formatted');
});
document.getElementById('fetch-button').addEventListener('click', function () {
const fetchTrackers = async () => {
try {
const [trackersListResponse, newTrackonResponse] = await Promise.all([
fetch('https://raw.githubusercontent.com/ngosang/trackerslist/master/trackers_all.txt'),
fetch('https://newtrackon.com/api/live')
]);
const trackersListText = await trackersListResponse.text();
const newTrackonText = await newTrackonResponse.text();
const trackersList = trackersListText.trim().split(/\s+/).filter(Boolean);
const newTrackonTrackers = newTrackonText.trim().split('\n').filter(Boolean);
const combinedTrackers = [...new Set([...trackersList, ...newTrackonTrackers])];
const formattedTrackers = combinedTrackers.join('\n\n');
document.getElementById('tracker-output').textContent = formattedTrackers;
document.getElementById('copy-button').classList.remove('hidden');
document.getElementById('tracker-count').textContent = `Total Trackers: ${formattedTrackers.split('\n\n').length}`;
showPopup('Fetched Latest Trackers');
} catch (err) {
console.error('Error fetching trackers:', err);
}
};
fetchTrackers();
});
document.getElementById('copy-button').addEventListener('click', function () {
const output = document.getElementById('tracker-output').textContent;
navigator.clipboard.writeText(output).then(() => {
showPopup('Trackers Copied');
}).catch(err => {
console.error('Failed to copy text: ', err);
});
});
</script>
</body>
</html>