Spaces:
Running
Running
create a similar page but more stylish https://whatismyipaddress.com/
Browse files- README.md +7 -4
- components/theme-toggle.js +85 -0
- index.html +202 -19
- script.js +79 -0
- style.css +48 -19
README.md
CHANGED
|
@@ -1,10 +1,13 @@
|
|
| 1 |
---
|
| 2 |
-
title:
|
| 3 |
-
emoji: 👁
|
| 4 |
colorFrom: blue
|
| 5 |
-
colorTo:
|
|
|
|
| 6 |
sdk: static
|
| 7 |
pinned: false
|
|
|
|
|
|
|
| 8 |
---
|
| 9 |
|
| 10 |
-
|
|
|
|
|
|
| 1 |
---
|
| 2 |
+
title: IP Revealer Pro 🕵️♂️
|
|
|
|
| 3 |
colorFrom: blue
|
| 4 |
+
colorTo: gray
|
| 5 |
+
emoji: 🐳
|
| 6 |
sdk: static
|
| 7 |
pinned: false
|
| 8 |
+
tags:
|
| 9 |
+
- deepsite-v3
|
| 10 |
---
|
| 11 |
|
| 12 |
+
# Welcome to your new DeepSite project!
|
| 13 |
+
This project was created with [DeepSite](https://huggingface.co/deepsite).
|
components/theme-toggle.js
ADDED
|
@@ -0,0 +1,85 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
class ThemeToggle extends HTMLElement {
|
| 2 |
+
connectedCallback() {
|
| 3 |
+
this.attachShadow({ mode: 'open' });
|
| 4 |
+
this.shadowRoot.innerHTML = `
|
| 5 |
+
<style>
|
| 6 |
+
.toggle-container {
|
| 7 |
+
display: inline-flex;
|
| 8 |
+
align-items: center;
|
| 9 |
+
cursor: pointer;
|
| 10 |
+
}
|
| 11 |
+
.toggle {
|
| 12 |
+
position: relative;
|
| 13 |
+
width: 44px;
|
| 14 |
+
height: 24px;
|
| 15 |
+
background-color: #e2e8f0;
|
| 16 |
+
border-radius: 12px;
|
| 17 |
+
margin: 0 8px;
|
| 18 |
+
transition: background-color 0.3s;
|
| 19 |
+
}
|
| 20 |
+
.toggle.dark {
|
| 21 |
+
background-color: #4a5568;
|
| 22 |
+
}
|
| 23 |
+
.slider {
|
| 24 |
+
position: absolute;
|
| 25 |
+
width: 20px;
|
| 26 |
+
height: 20px;
|
| 27 |
+
background-color: white;
|
| 28 |
+
border-radius: 50%;
|
| 29 |
+
top: 2px;
|
| 30 |
+
left: 2px;
|
| 31 |
+
transition: transform 0.3s;
|
| 32 |
+
}
|
| 33 |
+
.dark .slider {
|
| 34 |
+
transform: translateX(20px);
|
| 35 |
+
}
|
| 36 |
+
.icon {
|
| 37 |
+
width: 16px;
|
| 38 |
+
height: 16px;
|
| 39 |
+
}
|
| 40 |
+
.light-icon {
|
| 41 |
+
color: #f59e0b;
|
| 42 |
+
}
|
| 43 |
+
.dark-icon {
|
| 44 |
+
color: #a0aec0;
|
| 45 |
+
}
|
| 46 |
+
</style>
|
| 47 |
+
<div class="toggle-container">
|
| 48 |
+
<i data-feather="sun" class="icon light-icon"></i>
|
| 49 |
+
<div class="toggle">
|
| 50 |
+
<div class="slider"></div>
|
| 51 |
+
</div>
|
| 52 |
+
<i data-feather="moon" class="icon dark-icon"></i>
|
| 53 |
+
</div>
|
| 54 |
+
`;
|
| 55 |
+
|
| 56 |
+
const toggle = this.shadowRoot.querySelector('.toggle');
|
| 57 |
+
const slider = this.shadowRoot.querySelector('.slider');
|
| 58 |
+
|
| 59 |
+
// Check for saved theme preference or use system preference
|
| 60 |
+
const savedTheme = localStorage.getItem('darkMode');
|
| 61 |
+
const systemDark = window.matchMedia('(prefers-color-scheme: dark)').matches;
|
| 62 |
+
|
| 63 |
+
if (savedTheme === null ? systemDark : savedTheme === 'true') {
|
| 64 |
+
document.documentElement.classList.add('dark');
|
| 65 |
+
toggle.classList.add('dark');
|
| 66 |
+
slider.classList.add('dark');
|
| 67 |
+
}
|
| 68 |
+
|
| 69 |
+
// Add click event listener
|
| 70 |
+
this.shadowRoot.querySelector('.toggle-container').addEventListener('click', () => {
|
| 71 |
+
const isDark = document.documentElement.classList.toggle('dark');
|
| 72 |
+
toggle.classList.toggle('dark');
|
| 73 |
+
slider.classList.toggle('dark');
|
| 74 |
+
localStorage.setItem('darkMode', isDark);
|
| 75 |
+
|
| 76 |
+
// Dispatch event for other components to listen to
|
| 77 |
+
document.dispatchEvent(new CustomEvent('themeChanged', { detail: { isDark } }));
|
| 78 |
+
});
|
| 79 |
+
|
| 80 |
+
// Initialize feather icons
|
| 81 |
+
feather.replace();
|
| 82 |
+
}
|
| 83 |
+
}
|
| 84 |
+
|
| 85 |
+
customElements.define('theme-toggle', ThemeToggle);
|
index.html
CHANGED
|
@@ -1,19 +1,202 @@
|
|
| 1 |
-
<!
|
| 2 |
-
<html>
|
| 3 |
-
|
| 4 |
-
|
| 5 |
-
|
| 6 |
-
|
| 7 |
-
|
| 8 |
-
|
| 9 |
-
|
| 10 |
-
|
| 11 |
-
|
| 12 |
-
|
| 13 |
-
|
| 14 |
-
|
| 15 |
-
|
| 16 |
-
|
| 17 |
-
|
| 18 |
-
|
| 19 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<!DOCTYPE html>
|
| 2 |
+
<html lang="en" class="dark">
|
| 3 |
+
<head>
|
| 4 |
+
<meta charset="UTF-8">
|
| 5 |
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
| 6 |
+
<title>IP Revealer Pro | Discover Your Digital Identity</title>
|
| 7 |
+
<script src="https://cdn.tailwindcss.com"></script>
|
| 8 |
+
<script src="https://cdn.jsdelivr.net/npm/feather-icons/dist/feather.min.js"></script>
|
| 9 |
+
<script src="https://unpkg.com/feather-icons"></script>
|
| 10 |
+
<link rel="stylesheet" href="style.css">
|
| 11 |
+
<script>
|
| 12 |
+
tailwind.config = {
|
| 13 |
+
darkMode: 'class',
|
| 14 |
+
theme: {
|
| 15 |
+
extend: {
|
| 16 |
+
colors: {
|
| 17 |
+
primary: {
|
| 18 |
+
500: '#6366f1',
|
| 19 |
+
600: '#4f46e5',
|
| 20 |
+
},
|
| 21 |
+
secondary: {
|
| 22 |
+
500: '#f43f5e',
|
| 23 |
+
600: '#e11d48',
|
| 24 |
+
}
|
| 25 |
+
}
|
| 26 |
+
}
|
| 27 |
+
}
|
| 28 |
+
}
|
| 29 |
+
</script>
|
| 30 |
+
</head>
|
| 31 |
+
<body class="bg-gray-100 dark:bg-gray-900 min-h-screen">
|
| 32 |
+
<main class="container mx-auto px-4 py-8">
|
| 33 |
+
<div class="max-w-4xl mx-auto">
|
| 34 |
+
<!-- Header -->
|
| 35 |
+
<header class="mb-12 text-center">
|
| 36 |
+
<h1 class="text-4xl md:text-5xl font-bold text-gray-800 dark:text-white mb-4">
|
| 37 |
+
IP Revealer <span class="text-primary-500">Pro</span>
|
| 38 |
+
</h1>
|
| 39 |
+
<p class="text-lg text-gray-600 dark:text-gray-300">
|
| 40 |
+
Discover your digital identity in one click
|
| 41 |
+
</p>
|
| 42 |
+
</header>
|
| 43 |
+
|
| 44 |
+
<!-- Main Card -->
|
| 45 |
+
<div class="bg-white dark:bg-gray-800 rounded-xl shadow-xl overflow-hidden mb-8 transition-all duration-300 hover:shadow-2xl">
|
| 46 |
+
<!-- Card Header -->
|
| 47 |
+
<div class="bg-gradient-to-r from-primary-500 to-secondary-500 p-4">
|
| 48 |
+
<div class="flex items-center">
|
| 49 |
+
<i data-feather="globe" class="text-white mr-2"></i>
|
| 50 |
+
<h2 class="text-xl font-semibold text-white">Your IP Information</h2>
|
| 51 |
+
</div>
|
| 52 |
+
</div>
|
| 53 |
+
|
| 54 |
+
<!-- Card Content -->
|
| 55 |
+
<div class="p-6">
|
| 56 |
+
<div class="grid grid-cols-1 md:grid-cols-2 gap-6">
|
| 57 |
+
<!-- Left Column -->
|
| 58 |
+
<div class="space-y-6">
|
| 59 |
+
<div class="flex items-center">
|
| 60 |
+
<div class="bg-primary-100 dark:bg-gray-700 p-3 rounded-full mr-4">
|
| 61 |
+
<i data-feather="map-pin" class="text-primary-500 dark:text-primary-400"></i>
|
| 62 |
+
</div>
|
| 63 |
+
<div>
|
| 64 |
+
<p class="text-sm text-gray-500 dark:text-gray-400">IP Address</p>
|
| 65 |
+
<p id="ip-address" class="text-lg font-medium text-gray-800 dark:text-gray-200">Loading...</p>
|
| 66 |
+
</div>
|
| 67 |
+
</div>
|
| 68 |
+
|
| 69 |
+
<div class="flex items-center">
|
| 70 |
+
<div class="bg-primary-100 dark:bg-gray-700 p-3 rounded-full mr-4">
|
| 71 |
+
<i data-feather="navigation" class="text-primary-500 dark:text-primary-400"></i>
|
| 72 |
+
</div>
|
| 73 |
+
<div>
|
| 74 |
+
<p class="text-sm text-gray-500 dark:text-gray-400">Location</p>
|
| 75 |
+
<p id="location" class="text-lg font-medium text-gray-800 dark:text-gray-200">Loading...</p>
|
| 76 |
+
</div>
|
| 77 |
+
</div>
|
| 78 |
+
|
| 79 |
+
<div class="flex items-center">
|
| 80 |
+
<div class="bg-primary-100 dark:bg-gray-700 p-3 rounded-full mr-4">
|
| 81 |
+
<i data-feather="compass" class="text-primary-500 dark:text-primary-400"></i>
|
| 82 |
+
</div>
|
| 83 |
+
<div>
|
| 84 |
+
<p class="text-sm text-gray-500 dark:text-gray-400">Country</p>
|
| 85 |
+
<p id="country" class="text-lg font-medium text-gray-800 dark:text-gray-200">Loading...</p>
|
| 86 |
+
</div>
|
| 87 |
+
</div>
|
| 88 |
+
</div>
|
| 89 |
+
|
| 90 |
+
<!-- Right Column -->
|
| 91 |
+
<div class="space-y-6">
|
| 92 |
+
<div class="flex items-center">
|
| 93 |
+
<div class="bg-primary-100 dark:bg-gray-700 p-3 rounded-full mr-4">
|
| 94 |
+
<i data-feather="cpu" class="text-primary-500 dark:text-primary-400"></i>
|
| 95 |
+
</div>
|
| 96 |
+
<div>
|
| 97 |
+
<p class="text-sm text-gray-500 dark:text-gray-400">ISP</p>
|
| 98 |
+
<p id="isp" class="text-lg font-medium text-gray-800 dark:text-gray-200">Loading...</p>
|
| 99 |
+
</div>
|
| 100 |
+
</div>
|
| 101 |
+
|
| 102 |
+
<div class="flex items-center">
|
| 103 |
+
<div class="bg-primary-100 dark:bg-gray-700 p-3 rounded-full mr-4">
|
| 104 |
+
<i data-feather="clock" class="text-primary-500 dark:text-primary-400"></i>
|
| 105 |
+
</div>
|
| 106 |
+
<div>
|
| 107 |
+
<p class="text-sm text-gray-500 dark:text-gray-400">Timezone</p>
|
| 108 |
+
<p id="timezone" class="text-lg font-medium text-gray-800 dark:text-gray-200">Loading...</p>
|
| 109 |
+
</div>
|
| 110 |
+
</div>
|
| 111 |
+
|
| 112 |
+
<div class="flex items-center">
|
| 113 |
+
<div class="bg-primary-100 dark:bg-gray-700 p-3 rounded-full mr-4">
|
| 114 |
+
<i data-feather="shield" class="text-primary-500 dark:text-primary-400"></i>
|
| 115 |
+
</div>
|
| 116 |
+
<div>
|
| 117 |
+
<p class="text-sm text-gray-500 dark:text-gray-400">Security</p>
|
| 118 |
+
<p id="security" class="text-lg font-medium text-gray-800 dark:text-gray-200">Loading...</p>
|
| 119 |
+
</div>
|
| 120 |
+
</div>
|
| 121 |
+
</div>
|
| 122 |
+
</div>
|
| 123 |
+
</div>
|
| 124 |
+
|
| 125 |
+
<!-- Map Visualization -->
|
| 126 |
+
<div id="map-container" class="h-64 bg-gray-200 dark:bg-gray-700 relative">
|
| 127 |
+
<div class="absolute inset-0 flex items-center justify-center">
|
| 128 |
+
<i data-feather="map" class="text-gray-400 dark:text-gray-500 w-16 h-16"></i>
|
| 129 |
+
</div>
|
| 130 |
+
</div>
|
| 131 |
+
|
| 132 |
+
<!-- Card Footer -->
|
| 133 |
+
<div class="bg-gray-50 dark:bg-gray-700 p-4 border-t border-gray-200 dark:border-gray-600">
|
| 134 |
+
<button id="refresh-btn" class="flex items-center justify-center w-full py-2 px-4 bg-primary-500 hover:bg-primary-600 text-white rounded-lg transition-colors duration-300">
|
| 135 |
+
<i data-feather="refresh-cw" class="mr-2 animate-spin hidden"></i>
|
| 136 |
+
Refresh Information
|
| 137 |
+
</button>
|
| 138 |
+
</div>
|
| 139 |
+
</div>
|
| 140 |
+
|
| 141 |
+
<!-- Additional Info Section -->
|
| 142 |
+
<section class="bg-white dark:bg-gray-800 rounded-xl shadow-md p-6 mb-8">
|
| 143 |
+
<h2 class="text-xl font-semibold text-gray-800 dark:text-white mb-4">About Your IP Address</h2>
|
| 144 |
+
<div class="prose dark:prose-invert max-w-none">
|
| 145 |
+
<p>Your IP address is like your digital fingerprint online. It reveals information about your approximate location and internet service provider.</p>
|
| 146 |
+
<p class="mt-2">This information is used by websites to deliver localized content and for security purposes. You can use a VPN to mask your real IP address if desired.</p>
|
| 147 |
+
</div>
|
| 148 |
+
</section>
|
| 149 |
+
|
| 150 |
+
<!-- Features Grid -->
|
| 151 |
+
<div class="grid grid-cols-1 md:grid-cols-3 gap-6 mb-12">
|
| 152 |
+
<div class="bg-white dark:bg-gray-800 rounded-xl shadow-md p-6">
|
| 153 |
+
<div class="bg-primary-100 dark:bg-gray-700 p-3 rounded-full w-12 h-12 flex items-center justify-center mb-4">
|
| 154 |
+
<i data-feather="lock" class="text-primary-500 dark:text-primary-400"></i>
|
| 155 |
+
</div>
|
| 156 |
+
<h3 class="text-lg font-semibold text-gray-800 dark:text-white mb-2">Privacy Check</h3>
|
| 157 |
+
<p class="text-gray-600 dark:text-gray-300">Discover if your IP is exposed and learn how to protect it.</p>
|
| 158 |
+
</div>
|
| 159 |
+
|
| 160 |
+
<div class="bg-white dark:bg-gray-800 rounded-xl shadow-md p-6">
|
| 161 |
+
<div class="bg-primary-100 dark:bg-gray-700 p-3 rounded-full w-12 h-12 flex items-center justify-center mb-4">
|
| 162 |
+
<i data-feather="map" class="text-primary-500 dark:text-primary-400"></i>
|
| 163 |
+
</div>
|
| 164 |
+
<h3 class="text-lg font-semibold text-gray-800 dark:text-white mb-2">Geo Location</h3>
|
| 165 |
+
<p class="text-gray-600 dark:text-gray-300">See where your internet connection is originating from.</p>
|
| 166 |
+
</div>
|
| 167 |
+
|
| 168 |
+
<div class="bg-white dark:bg-gray-800 rounded-xl shadow-md p-6">
|
| 169 |
+
<div class="bg-primary-100 dark:bg-gray-700 p-3 rounded-full w-12 h-12 flex items-center justify-center mb-4">
|
| 170 |
+
<i data-feather="activity" class="text-primary-500 dark:text-primary-400"></i>
|
| 171 |
+
</div>
|
| 172 |
+
<h3 class="text-lg font-semibold text-gray-800 dark:text-white mb-2">Network Stats</h3>
|
| 173 |
+
<p class="text-gray-600 dark:text-gray-300">Get insights about your internet service provider.</p>
|
| 174 |
+
</div>
|
| 175 |
+
</div>
|
| 176 |
+
</div>
|
| 177 |
+
</main>
|
| 178 |
+
|
| 179 |
+
<footer class="bg-gray-200 dark:bg-gray-800 py-8">
|
| 180 |
+
<div class="container mx-auto px-4 text-center">
|
| 181 |
+
<p class="text-gray-600 dark:text-gray-300">© 2023 IP Revealer Pro. All rights reserved.</p>
|
| 182 |
+
<div class="flex justify-center space-x-4 mt-4">
|
| 183 |
+
<a href="#" class="text-gray-600 hover:text-primary-500 dark:text-gray-300 dark:hover:text-primary-400">
|
| 184 |
+
<i data-feather="github"></i>
|
| 185 |
+
</a>
|
| 186 |
+
<a href="#" class="text-gray-600 hover:text-primary-500 dark:text-gray-300 dark:hover:text-primary-400">
|
| 187 |
+
<i data-feather="twitter"></i>
|
| 188 |
+
</a>
|
| 189 |
+
<a href="#" class="text-gray-600 hover:text-primary-500 dark:text-gray-300 dark:hover:text-primary-400">
|
| 190 |
+
<i data-feather="mail"></i>
|
| 191 |
+
</a>
|
| 192 |
+
</div>
|
| 193 |
+
</div>
|
| 194 |
+
</footer>
|
| 195 |
+
|
| 196 |
+
<script src="script.js"></script>
|
| 197 |
+
<script>
|
| 198 |
+
feather.replace();
|
| 199 |
+
</script>
|
| 200 |
+
<script src="https://huggingface.co/deepsite/deepsite-badge.js"></script>
|
| 201 |
+
</body>
|
| 202 |
+
</html>
|
script.js
ADDED
|
@@ -0,0 +1,79 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
document.addEventListener('DOMContentLoaded', function() {
|
| 2 |
+
// Fetch IP information on page load
|
| 3 |
+
fetchIPInfo();
|
| 4 |
+
|
| 5 |
+
// Setup refresh button
|
| 6 |
+
const refreshBtn = document.getElementById('refresh-btn');
|
| 7 |
+
refreshBtn.addEventListener('click', function() {
|
| 8 |
+
const icon = this.querySelector('i');
|
| 9 |
+
icon.classList.remove('hidden');
|
| 10 |
+
this.disabled = true;
|
| 11 |
+
|
| 12 |
+
fetchIPInfo().finally(() => {
|
| 13 |
+
setTimeout(() => {
|
| 14 |
+
icon.classList.add('hidden');
|
| 15 |
+
this.disabled = false;
|
| 16 |
+
}, 500);
|
| 17 |
+
});
|
| 18 |
+
});
|
| 19 |
+
|
| 20 |
+
// Theme toggle functionality (if you want to add a toggle button later)
|
| 21 |
+
// const themeToggle = document.getElementById('theme-toggle');
|
| 22 |
+
// themeToggle.addEventListener('click', function() {
|
| 23 |
+
// document.documentElement.classList.toggle('dark');
|
| 24 |
+
// localStorage.setItem('darkMode', document.documentElement.classList.contains('dark'));
|
| 25 |
+
// });
|
| 26 |
+
});
|
| 27 |
+
|
| 28 |
+
async function fetchIPInfo() {
|
| 29 |
+
try {
|
| 30 |
+
// First get the IP address
|
| 31 |
+
const ipResponse = await fetch('https://api.ipify.org?format=json');
|
| 32 |
+
const ipData = await ipResponse.json();
|
| 33 |
+
const ipAddress = ipData.ip;
|
| 34 |
+
|
| 35 |
+
// Then get detailed information using the IP
|
| 36 |
+
const infoResponse = await fetch(`https://ipapi.co/${ipAddress}/json/`);
|
| 37 |
+
const infoData = await infoResponse.json();
|
| 38 |
+
|
| 39 |
+
// Update the UI with the fetched data
|
| 40 |
+
document.getElementById('ip-address').textContent = ipAddress;
|
| 41 |
+
document.getElementById('location').textContent =
|
| 42 |
+
`${infoData.city || 'Unknown'}, ${infoData.region || 'Unknown'}`;
|
| 43 |
+
document.getElementById('country').textContent =
|
| 44 |
+
`${infoData.country_name || 'Unknown'} (${infoData.country || 'XX'})`;
|
| 45 |
+
document.getElementById('isp').textContent = infoData.org || 'Unknown ISP';
|
| 46 |
+
document.getElementById('timezone').textContent = infoData.timezone || 'Unknown';
|
| 47 |
+
|
| 48 |
+
// Determine security status (simplified for demo)
|
| 49 |
+
const securityStatus = infoData.proxy === true || infoData.vpn === true ?
|
| 50 |
+
'⚠️ VPN/Proxy Detected' : '✅ Normal Connection';
|
| 51 |
+
document.getElementById('security').textContent = securityStatus;
|
| 52 |
+
|
| 53 |
+
// Simulate map loading (in a real app you would use Google Maps or similar)
|
| 54 |
+
const mapContainer = document.getElementById('map-container');
|
| 55 |
+
mapContainer.innerHTML = `
|
| 56 |
+
<div class="absolute inset-0 flex items-center justify-center">
|
| 57 |
+
<div class="text-center">
|
| 58 |
+
<i data-feather="map-pin" class="text-secondary-500 w-12 h-12 mb-2 mx-auto"></i>
|
| 59 |
+
<p class="text-gray-800 dark:text-gray-200 font-medium">${infoData.city || 'Your Location'}</p>
|
| 60 |
+
</div>
|
| 61 |
+
</div>
|
| 62 |
+
`;
|
| 63 |
+
feather.replace();
|
| 64 |
+
|
| 65 |
+
} catch (error) {
|
| 66 |
+
console.error('Error fetching IP information:', error);
|
| 67 |
+
|
| 68 |
+
// Show error state in UI
|
| 69 |
+
const elements = [
|
| 70 |
+
'ip-address', 'location', 'country',
|
| 71 |
+
'isp', 'timezone', 'security'
|
| 72 |
+
];
|
| 73 |
+
|
| 74 |
+
elements.forEach(id => {
|
| 75 |
+
document.getElementById(id).textContent = 'Failed to load';
|
| 76 |
+
document.getElementById(id).classList.add('text-red-500');
|
| 77 |
+
});
|
| 78 |
+
}
|
| 79 |
+
}
|
style.css
CHANGED
|
@@ -1,28 +1,57 @@
|
|
| 1 |
-
|
| 2 |
-
|
| 3 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 4 |
}
|
| 5 |
|
| 6 |
-
|
| 7 |
-
|
| 8 |
-
margin-top: 0;
|
| 9 |
}
|
| 10 |
|
| 11 |
-
|
| 12 |
-
|
| 13 |
-
font-size: 15px;
|
| 14 |
-
margin-bottom: 10px;
|
| 15 |
-
margin-top: 5px;
|
| 16 |
}
|
| 17 |
|
| 18 |
-
.
|
| 19 |
-
|
| 20 |
-
margin: 0 auto;
|
| 21 |
-
padding: 16px;
|
| 22 |
-
border: 1px solid lightgray;
|
| 23 |
-
border-radius: 16px;
|
| 24 |
}
|
| 25 |
|
| 26 |
-
.
|
| 27 |
-
|
| 28 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
/* Custom animations */
|
| 2 |
+
@keyframes fadeIn {
|
| 3 |
+
from { opacity: 0; transform: translateY(10px); }
|
| 4 |
+
to { opacity: 1; transform: translateY(0); }
|
| 5 |
+
}
|
| 6 |
+
|
| 7 |
+
/* Apply animation to card elements */
|
| 8 |
+
#ip-address, #location, #country, #isp, #timezone, #security {
|
| 9 |
+
animation: fadeIn 0.5s ease-out forwards;
|
| 10 |
+
}
|
| 11 |
+
|
| 12 |
+
.delay-100 { animation-delay: 0.1s; }
|
| 13 |
+
.delay-200 { animation-delay: 0.2s; }
|
| 14 |
+
.delay-300 { animation-delay: 0.3s; }
|
| 15 |
+
.delay-400 { animation-delay: 0.4s; }
|
| 16 |
+
.delay-500 { animation-delay: 0.5s; }
|
| 17 |
+
|
| 18 |
+
/* Custom scrollbar */
|
| 19 |
+
::-webkit-scrollbar {
|
| 20 |
+
width: 8px;
|
| 21 |
+
height: 8px;
|
| 22 |
+
}
|
| 23 |
+
|
| 24 |
+
::-webkit-scrollbar-track {
|
| 25 |
+
background: #f1f1f1;
|
| 26 |
+
}
|
| 27 |
+
|
| 28 |
+
::-webkit-scrollbar-thumb {
|
| 29 |
+
background: #888;
|
| 30 |
+
border-radius: 4px;
|
| 31 |
}
|
| 32 |
|
| 33 |
+
::-webkit-scrollbar-thumb:hover {
|
| 34 |
+
background: #555;
|
|
|
|
| 35 |
}
|
| 36 |
|
| 37 |
+
.dark ::-webkit-scrollbar-track {
|
| 38 |
+
background: #2d3748;
|
|
|
|
|
|
|
|
|
|
| 39 |
}
|
| 40 |
|
| 41 |
+
.dark ::-webkit-scrollbar-thumb {
|
| 42 |
+
background: #4a5568;
|
|
|
|
|
|
|
|
|
|
|
|
|
| 43 |
}
|
| 44 |
|
| 45 |
+
.dark ::-webkit-scrollbar-thumb:hover {
|
| 46 |
+
background: #718096;
|
| 47 |
}
|
| 48 |
+
|
| 49 |
+
/* Smooth transitions for dark mode */
|
| 50 |
+
html {
|
| 51 |
+
scroll-behavior: smooth;
|
| 52 |
+
transition: background-color 0.3s ease;
|
| 53 |
+
}
|
| 54 |
+
|
| 55 |
+
body {
|
| 56 |
+
transition: background-color 0.3s ease, color 0.3s ease;
|
| 57 |
+
}
|