onclick="closePopup()">
.connectionType.textContent = connection.type === 'wifi' ? 'Wi-Fi' : 'Mobile Data';
} else {
elements.connectionType.textContent = 'Unknown';
}
}
async function getLocationFromIP(ip) {
try {
const response = await fetch(`https://ipapi.co/${ip}/json/`);
const data = await response.json();
if (data.error) throw new Error(data.reason);
return { country: data.country_name || 'N/A', region: data.region || 'N/A', isp: data.org || 'N/A' };
} catch (error) {
console.error('Location fetch failed:', error);
return { country: 'Unknown', region: 'Unknown', isp: 'Unknown' };
}
}
function handleNewIP() {
let currentIpData = appData.ipHistory.find(ip => ip.ip === userIP);
if (!currentIpData) {
currentIpData = { ip: userIP, clicks: 0, visitCount: 1 };
appData.ipHistory.unshift(currentIpData);
if (appData.ipHistory.length > 10) appData.ipHistory.pop();
appData.videoAdCount = 0;
appData.webVisitCount = 0;
tg.HapticFeedback.notificationOccurred('success');
tg.showAlert('New IP Detected! Tasks have been reset.');
} else {
currentIpData.visitCount++;
}
currentIpData.lastSeen = Date.now();
saveData();
}
function recordClick() {
let ipData = appData.ipHistory.find(ip => ip.ip === userIP);
if (ipData) ipData.clicks++;
const today = new Date().toISOString().split('T')[0];
let todayEntry = appData.clickHistory.find(entry => entry.date === today);
if (todayEntry) todayEntry.clicks++;
else appData.clickHistory.push({ date: today, clicks: 1 });
saveData();
}
// --- Ad Logic ---
function onAdSuccess() {
tg.HapticFeedback.notificationOccurred('success');
recordClick();
}
function onAdError(error) {
tg.HapticFeedback.notificationOccurred('error');
console.error('Ad Error:', error);
}
function showSingleAd(type) {
elements.clickSound.play().catch(e => console.log("Sound play info:", e));
tg.HapticFeedback.impactOccurred('light');
return new Promise((resolve, reject) => {
const adFunction = type === 'video' ? show_9911414 : () => show_9911414('pop');
adFunction().then(() => {
resolve();
}).catch((err) => {
reject(err);
});
});
}
// --- Event Handlers ---
function setupEventListeners() {
elements.showAdsBtn.addEventListener('click', () => handleManualAdClick('video'));
elements.webVisitBtn.addEventListener('click', () => handleManualAdClick('web'));
āĻিāĻĄিāĻ āĻĻেāĻāϤে āĻāĻাāĻāύ্āĻ āϞাāĻāĻŦে!
āĻāĻŽাāĻĻেāϰ āĻĒ্āϞ্āϝাāĻāĻĢāϰ্āĻŽে āĻ
্āϝাāĻাāĻāύ্āĻ āĻাāĻĄ়া āĻিāĻĄিāĻ āĻĻেāĻা āϝাāĻŦে āύা।
āĻĻāϝ়া āĻāϰে āύিāĻেāϰ āĻāĻĒাāϝ়ে āϝেāĻোāύো āĻāĻāĻি āĻ
āĻĒāĻļāύ āĻŦেāĻে āύিāύ:
Comments
Post a Comment