Spaces:
Runtime error

geo / static /index.html
MetaQiu
feat
6137734
Raw History Blame Contribute Delete
30 kB
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>IP Geo API - IP 地理位置查询</title>
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=JetBrains+Mono:wght@400;500;600;700&family=Noto+Sans+SC:wght@300;400;500;600;700&display=swap" rel="stylesheet">
<style>
:root {
--bg-primary: #f8fafc;
--bg-card: #ffffff;
--bg-code: #1e293b;
--accent: #0891b2;
--accent-light: #ecfeff;
--accent-hover: #0e7490;
--green: #059669;
--green-light: #ecfdf5;
--text-primary: #0f172a;
--text-secondary: #475569;
--text-muted: #94a3b8;
--border: #e2e8f0;
--border-focus: #0891b2;
--shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
--shadow-md: 0 4px 12px rgba(0,0,0,0.08);
--shadow-lg: 0 12px 32px rgba(0,0,0,0.1);
--radius: 16px;
--radius-sm: 10px;
}
* { margin: 0; padding: 0; box-sizing: border-box; }
body {
font-family: 'Noto Sans SC', -apple-system, BlinkMacSystemFont, sans-serif;
background: var(--bg-primary);
color: var(--text-primary);
min-height: 100vh;
display: flex;
flex-direction: column;
align-items: center;
line-height: 1.6;
}
.bg-pattern {
position: fixed;
inset: 0;
background-color: #fafaf8;
background-image:
linear-gradient(rgba(0,0,0,0.03) 1px, transparent 1px),
linear-gradient(90deg, rgba(0,0,0,0.03) 1px, transparent 1px);
background-size: 24px 24px;
z-index: -1;
}
.container {
width: 100%;
max-width: 800px;
padding: 24px 20px;
display: flex;
flex-direction: column;
gap: 24px;
}
/* Header */
header {
text-align: center;
padding: 40px 0 8px;
animation: fadeIn 0.6s ease-out;
}
h1 {
font-size: 2rem;
font-weight: 700;
color: var(--text-primary);
margin-bottom: 8px;
letter-spacing: -0.5px;
}
.subtitle {
color: var(--text-secondary);
font-size: 1rem;
font-weight: 400;
}
@keyframes fadeIn {
from { opacity: 0; transform: translateY(-12px); }
to { opacity: 1; transform: translateY(0); }
}
/* Search */
.search-section {
animation: fadeIn 0.6s ease-out 0.1s backwards;
}
.search-box-wrapper {
background: var(--bg-card);
padding: 6px;
border-radius: var(--radius);
border: 1.5px solid var(--border);
box-shadow: var(--shadow-md);
transition: border-color 0.2s, box-shadow 0.2s;
display: flex;
align-items: center;
gap: 8px;
}
.search-box-wrapper:focus-within {
border-color: var(--border-focus);
box-shadow: 0 0 0 3px rgba(8,145,178,0.1), var(--shadow-md);
}
.search-icon {
padding-left: 14px;
color: var(--text-muted);
display: flex;
}
.search-icon svg { width: 20px; height: 20px; }
.search-input {
flex: 1;
background: transparent;
border: none;
padding: 14px 0;
font-size: 1.05rem;
color: var(--text-primary);
font-family: 'JetBrains Mono', monospace;
outline: none;
min-width: 0;
}
.search-input::placeholder {
color: var(--text-muted);
font-family: 'Noto Sans SC', sans-serif;
font-weight: 400;
}
.search-actions {
display: flex;
gap: 6px;
padding-right: 6px;
}
.action-btn {
background: var(--bg-primary);
border: 1px solid var(--border);
padding: 10px 14px;
border-radius: var(--radius-sm);
color: var(--text-secondary);
font-size: 0.875rem;
font-weight: 500;
cursor: pointer;
transition: all 0.2s;
white-space: nowrap;
display: flex;
align-items: center;
gap: 6px;
}
.action-btn svg { width: 16px; height: 16px; }
.action-btn:hover {
background: var(--accent-light);
color: var(--accent);
border-color: var(--accent);
}
.search-btn {
background: var(--accent);
border: none;
padding: 10px 22px;
border-radius: var(--radius-sm);
color: white;
font-size: 0.9rem;
font-weight: 600;
cursor: pointer;
transition: all 0.2s;
display: flex;
align-items: center;
justify-content: center;
min-width: 76px;
}
.search-btn:hover {
background: var(--accent-hover);
box-shadow: 0 2px 8px rgba(8,145,178,0.3);
}
.search-btn:active { transform: scale(0.97); }
.search-btn.loading { pointer-events: none; opacity: 0.7; }
.spinner {
width: 18px;
height: 18px;
border: 2.5px solid rgba(255,255,255,0.3);
border-top-color: white;
border-radius: 50%;
animation: spin 0.7s linear infinite;
display: none;
}
.search-btn.loading .spinner { display: block; }
.search-btn.loading .btn-text { display: none; }
@keyframes spin { to { transform: rotate(360deg); } }
/* Results */
.result-section {
min-height: 200px;
animation: fadeIn 0.4s ease-out;
}
.result-card {
background: var(--bg-card);
border: 1px solid var(--border);
border-radius: var(--radius);
overflow: hidden;
box-shadow: var(--shadow-lg);
animation: slideUp 0.4s ease-out;
}
@keyframes slideUp {
from { opacity: 0; transform: translateY(16px); }
to { opacity: 1; transform: translateY(0); }
}
.result-header {
padding: 28px 32px;
background: linear-gradient(135deg, var(--accent-light) 0%, #f0fdfa 100%);
display: flex;
flex-direction: column;
align-items: center;
gap: 8px;
border-bottom: 1px solid var(--border);
}
.result-ip {
font-family: 'JetBrains Mono', monospace;
font-size: 2rem;
font-weight: 700;
color: var(--accent);
letter-spacing: 0.5px;
}
.result-subnet {
font-family: 'JetBrains Mono', monospace;
color: var(--text-muted);
font-size: 0.85rem;
background: rgba(8,145,178,0.08);
padding: 3px 12px;
border-radius: 20px;
}
.result-body {
padding: 32px;
display: grid;
grid-template-columns: repeat(2, 1fr);
gap: 28px;
}
.info-group {
display: flex;
flex-direction: column;
gap: 20px;
}
.info-item {
display: flex;
flex-direction: column;
gap: 6px;
}
.info-label {
color: var(--text-muted);
font-size: 0.75rem;
font-weight: 600;
text-transform: uppercase;
letter-spacing: 0.5px;
display: flex;
align-items: center;
gap: 6px;
}
.info-label svg { width: 14px; height: 14px; color: var(--accent); }
.info-value {
font-size: 1.05rem;
color: var(--text-primary);
font-weight: 500;
}
.info-value.mono { font-family: 'JetBrains Mono', monospace; }
.info-value.highlight {
color: var(--accent);
font-weight: 600;
}
.location-path {
display: flex;
flex-wrap: wrap;
align-items: center;
gap: 6px;
}
.loc-pill {
background: var(--accent-light);
color: var(--accent-hover);
padding: 4px 12px;
border-radius: 6px;
font-size: 0.9rem;
font-weight: 500;
}
.loc-sep {
color: var(--text-muted);
font-size: 0.75rem;
}
.map-btn {
margin-top: auto;
background: var(--bg-primary);
border: 1px dashed var(--border);
border-radius: var(--radius-sm);
padding: 10px;
text-align: center;
color: var(--text-secondary);
font-size: 0.875rem;
font-family: 'JetBrains Mono', monospace;
cursor: pointer;
transition: all 0.2s;
}
.map-btn:hover {
border-color: var(--accent);
color: var(--accent);
background: var(--accent-light);
}
/* Map */
.map-section {
display: none;
animation: slideUp 0.4s ease-out;
}
.map-container {
background: var(--bg-card);
border: 1px solid var(--border);
border-radius: var(--radius);
overflow: hidden;
box-shadow: var(--shadow-md);
}
.map-header {
padding: 12px 20px;
border-bottom: 1px solid var(--border);
display: flex;
align-items: center;
gap: 8px;
color: var(--text-secondary);
font-size: 0.875rem;
font-weight: 500;
}
.map-header svg { width: 16px; height: 16px; color: var(--accent); }
.map-frame {
width: 100%;
height: 400px;
border: none;
display: block;
}
/* Error */
.error-state {
text-align: center;
padding: 40px;
background: #fef2f2;
border: 1px solid #fecaca;
border-radius: var(--radius);
color: #dc2626;
}
.error-state svg {
width: 32px;
height: 32px;
margin: 0 auto 12px;
color: #f87171;
}
/* Welcome */
.welcome-state {
text-align: center;
padding: 48px 20px;
color: var(--text-muted);
font-weight: 400;
}
.welcome-state p:first-child { font-size: 1rem; }
.welcome-state p:last-child { font-size: 0.85rem; margin-top: 8px; opacity: 0.7; }
/* Footer */
footer {
margin-top: auto;
padding: 32px 20px;
text-align: center;
color: var(--text-muted);
font-size: 0.8rem;
}
.credits { margin-top: 6px; }
.credits a {
color: var(--accent);
text-decoration: none;
font-weight: 500;
transition: color 0.2s;
}
.credits a:hover { color: var(--accent-hover); text-decoration: underline; }
/* API Docs */
.api-docs {
background: var(--bg-card);
border: 1px solid var(--border);
border-radius: var(--radius);
padding: 28px;
box-shadow: var(--shadow-sm);
}
.docs-title {
font-size: 1.05rem;
font-weight: 600;
margin-bottom: 16px;
color: var(--text-primary);
display: flex;
align-items: center;
gap: 8px;
}
.docs-title svg { width: 18px; height: 18px; color: var(--accent); }
.code-block {
background: var(--bg-code);
border-radius: var(--radius-sm);
margin-bottom: 12px;
overflow: hidden;
}
.code-block:last-child { margin-bottom: 0; }
.code-header {
background: rgba(255,255,255,0.06);
padding: 8px 16px;
display: flex;
justify-content: space-between;
align-items: center;
border-bottom: 1px solid rgba(255,255,255,0.08);
}
.code-lang {
font-size: 0.75rem;
color: #94a3b8;
font-weight: 600;
font-family: 'JetBrains Mono', monospace;
}
.copy-btn {
background: rgba(255,255,255,0.08);
border: none;
color: #94a3b8;
padding: 4px 10px;
border-radius: 6px;
font-size: 0.75rem;
cursor: pointer;
transition: all 0.2s;
font-family: 'Noto Sans SC', sans-serif;
}
.copy-btn:hover {
background: rgba(255,255,255,0.15);
color: white;
}
code {
display: block;
padding: 14px 16px;
font-family: 'JetBrains Mono', monospace;
font-size: 0.85rem;
color: #e2e8f0;
overflow-x: auto;
white-space: pre;
line-height: 1.6;
}
/* Responsive */
@media (max-width: 768px) {
.container { padding: 16px; }
header { padding: 24px 0 0; }
h1 { font-size: 1.6rem; }
.search-box-wrapper {
flex-direction: column;
padding: 10px;
gap: 10px;
}
.search-icon { display: none; }
.search-input {
padding: 10px;
text-align: center;
width: 100%;
}
.search-actions {
width: 100%;
justify-content: center;
padding: 0;
}
.action-btn, .search-btn {
flex: 1;
justify-content: center;
}
.result-body {
grid-template-columns: 1fr;
padding: 24px;
gap: 20px;
}
.result-ip { font-size: 1.5rem; }
.map-frame { height: 300px; }
}
/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
*, *::before, *::after {
animation-duration: 0.01ms !important;
transition-duration: 0.01ms !important;
}
}
.hidden { display: none !important; }
</style>
</head>
<body>
<div class="bg-pattern"></div>
<div class="container">
<header>
<h1>IP Geo API</h1>
<p class="subtitle">IP 地理位置与归属地查询</p>
</header>
<section class="search-section">
<div class="search-box-wrapper">
<span class="search-icon">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><circle cx="11" cy="11" r="8"/><path d="m21 21-4.3-4.3"/></svg>
</span>
<input
type="text"
class="search-input"
id="ipInput"
placeholder="输入 IP 地址..."
autocomplete="off"
spellcheck="false"
aria-label="IP 地址输入"
>
<div class="search-actions">
<button class="action-btn" onclick="queryMyIP()" title="查询本机IP" aria-label="查询本机IP">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M20 10c0 6-8 12-8 12s-8-6-8-12a8 8 0 0 1 16 0Z"/><circle cx="12" cy="10" r="3"/></svg>
<span class="btn-label">我的 IP</span>
</button>
<button class="search-btn" id="searchBtn" onclick="queryIP()" aria-label="查询">
<span class="btn-text">查询</span>
<div class="spinner"></div>
</button>
</div>
</div>
</section>
<section class="result-section" id="resultSection">
<div class="welcome-state">
<p>输入 IP 地址开始查询</p>
<p>支持 IPv4 和 IPv6</p>
</div>
</section>
<section class="map-section" id="mapSection">
<div class="map-container">
<div class="map-header">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><polygon points="3 6 9 3 15 6 21 3 21 18 15 21 9 18 3 21"/><line x1="9" x2="9" y1="3" y2="18"/><line x1="15" x2="15" y1="6" y2="21"/></svg>
<span>位置标注</span>
</div>
<iframe class="map-frame" id="mapFrame" sandbox="allow-scripts allow-same-origin" title="地图"></iframe>
</div>
</section>
<section class="api-docs">
<h2 class="docs-title">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="m16 18 2 2 4-4"/><path d="M21 12V8.5C21 5.46 18.54 3 15.5 3h-7C5.46 3 3 5.46 3 8.5v7C3 18.54 5.46 21 8.5 21H12"/><path d="M8 8h8"/><path d="M8 12h4"/></svg>
API 使用说明
</h2>
<div class="code-block">
<div class="code-header">
<span class="code-lang">Shell</span>
<button class="copy-btn" onclick="copyCode('curl')">复制</button>
</div>
<code id="code-curl"># 基础查询
curl https://geo.metaqiu.cn/api/8.8.8.8
# 精确定位(美团数据源)
curl https://geo.metaqiu.cn/api/locate/8.8.8.8</code>
</div>
<div class="code-block">
<div class="code-header">
<span class="code-lang">Python</span>
<button class="copy-btn" onclick="copyCode('py')">复制</button>
</div>
<code id="code-py">import requests
# 基础查询
response = requests.get('https://geo.metaqiu.cn/api/8.8.8.8')
print(response.json())
# 精确定位(美团数据源)
response = requests.get('https://geo.metaqiu.cn/api/locate/8.8.8.8')
print(response.json())</code>
</div>
</section>
</div>
<footer>
<p>Powered by MaxMind GeoLite2 &amp; GeoCN</p>
<p class="credits">Made by <a href="https://metaqiu.cn" target="_blank" rel="noopener">MetaQiu</a></p>
</footer>
<script>
const ipInput = document.getElementById('ipInput');
const searchBtn = document.getElementById('searchBtn');
const resultSection = document.getElementById('resultSection');
const mapSection = document.getElementById('mapSection');
const mapFrame = document.getElementById('mapFrame');
// SVG icon helpers
const icons = {
globe: '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><circle cx="12" cy="12" r="10"/><path d="M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20"/><path d="M2 12h20"/></svg>',
building: '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><rect x="4" y="2" width="16" height="20" rx="2" ry="2"/><path d="M9 22v-4h6v4"/><path d="M8 6h.01"/><path d="M16 6h.01"/><path d="M12 6h.01"/><path d="M12 10h.01"/><path d="M12 14h.01"/><path d="M16 10h.01"/><path d="M16 14h.01"/><path d="M8 10h.01"/><path d="M8 14h.01"/></svg>',
hash: '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><line x1="4" x2="20" y1="9" y2="9"/><line x1="4" x2="20" y1="15" y2="15"/><line x1="10" x2="8" y1="3" y2="21"/><line x1="16" x2="14" y1="3" y2="21"/></svg>',
tag: '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M12 2H2v10l9.29 9.29c.94.94 2.48.94 3.42 0l6.58-6.58c.94-.94.94-2.48 0-3.42L12 2Z"/><path d="M7 7h.01"/></svg>',
clipboard: '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><rect width="8" height="4" x="8" y="2" rx="1" ry="1"/><path d="M16 4h2a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h2"/></svg>',
mapPin: '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M20 10c0 6-8 12-8 12s-8-6-8-12a8 8 0 0 1 16 0Z"/><circle cx="12" cy="10" r="3"/></svg>',
alertTriangle: '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3Z"/><path d="M12 9v4"/><path d="M12 17h.01"/></svg>',
};
// WGS84 → GCJ02
function outOfChina(lng, lat) {
return lng < 72.004 || lng > 137.8347 || lat < 0.8293 || lat > 55.8271;
}
function transformLat(x, y) {
let r = -100.0 + 2.0*x + 3.0*y + 0.2*y*y + 0.1*x*y + 0.2*Math.sqrt(Math.abs(x));
r += (20.0*Math.sin(6.0*x*Math.PI) + 20.0*Math.sin(2.0*x*Math.PI)) * 2.0/3.0;
r += (20.0*Math.sin(y*Math.PI) + 40.0*Math.sin(y/3.0*Math.PI)) * 2.0/3.0;
r += (160.0*Math.sin(y/12.0*Math.PI) + 320*Math.sin(y*Math.PI/30.0)) * 2.0/3.0;
return r;
}
function transformLng(x, y) {
let r = 300.0 + x + 2.0*y + 0.1*x*x + 0.1*x*y + 0.1*Math.sqrt(Math.abs(x));
r += (20.0*Math.sin(6.0*x*Math.PI) + 20.0*Math.sin(2.0*x*Math.PI)) * 2.0/3.0;
r += (20.0*Math.sin(x*Math.PI) + 40.0*Math.sin(x/3.0*Math.PI)) * 2.0/3.0;
r += (150.0*Math.sin(x/12.0*Math.PI) + 300.0*Math.sin(x/30.0*Math.PI)) * 2.0/3.0;
return r;
}
function wgs84ToGcj02(lng, lat) {
const a = 6378245.0, ee = 0.00669342162296594323;
if (outOfChina(lng, lat)) return { lng, lat };
let dLat = transformLat(lng - 105.0, lat - 35.0);
let dLng = transformLng(lng - 105.0, lat - 35.0);
const radLat = lat / 180.0 * Math.PI;
let magic = Math.sin(radLat);
magic = 1 - ee * magic * magic;
const sq = Math.sqrt(magic);
dLat = (dLat * 180.0) / ((a * (1 - ee)) / (magic * sq) * Math.PI);
dLng = (dLng * 180.0) / (a / sq * Math.cos(radLat) * Math.PI);
return { lat: lat + dLat, lng: lng + dLng };
}
function updateMap(lat, lng) {
if (!lat || !lng) { mapSection.style.display = 'none'; return; }
const c = wgs84ToGcj02(parseFloat(lng), parseFloat(lat));
const ak = 'nSxiPohfziUaCuONe4ViUP2N';
mapFrame.src = `https://api.map.baidu.com/marker?location=${c.lat},${c.lng}&title=IP位置&content=IP位置&output=html&coord_type=gcj02&zoom=13&ak=${ak}`;
mapSection.style.display = 'block';
}
function copyCode(type) {
const el = document.getElementById(`code-${type}`);
navigator.clipboard.writeText(el.innerText).then(() => {
const btn = el.parentElement.querySelector('.copy-btn');
const orig = btn.innerText;
btn.innerText = '已复制';
setTimeout(() => btn.innerText = orig, 2000);
});
}
ipInput.focus();
ipInput.addEventListener('keypress', e => { if (e.key === 'Enter') queryIP(); });
window.addEventListener('load', () => queryMyIP());
function queryMyIP() { ipInput.value = ''; queryIP(true); }
async function queryIP(isMyIP = false) {
const ip = ipInput.value.trim();
if (!isMyIP && !ip) return;
const url = (!ip || isMyIP) ? '/api/' : `/api/${ip}`;
searchBtn.classList.add('loading');
try {
const start = Date.now();
const res = await fetch(url);
const data = await res.json();
const elapsed = Date.now() - start;
if (elapsed < 300) await new Promise(r => setTimeout(r, 300 - elapsed));
if (data.error) { showError(data.error); }
else {
if (isMyIP && data.ip) ipInput.value = data.ip;
showResult(data);
}
} catch { showError('无法连接到服务器,请检查网络'); }
finally { searchBtn.classList.remove('loading'); }
}
function showError(msg) {
mapSection.style.display = 'none';
resultSection.innerHTML = `
<div class="error-state">
${icons.alertTriangle}
<div>${msg}</div>
</div>`;
}
function showResult(data) {
let locationHtml = '<span style="color:var(--text-muted)">未知位置</span>';
if (data.country || data.regions) {
const parts = [];
if (data.country) parts.push(data.country.name);
if (data.regions) parts.push(...data.regions);
locationHtml = parts.map(p => `<span class="loc-pill">${p}</span>`).join('<span class="loc-sep">/</span>');
}
let ispName = '未知', asn = 'N/A', ispType = '';
if (data.as) {
ispName = data.as.info || data.as.name;
asn = `AS${data.as.number}`;
if (data.type) ispType = `<span class="result-subnet" style="margin-left:6px">${data.type}</span>`;
}
let regHtml = '';
if (data.registered_country && (!data.country || data.registered_country.code !== data.country.code)) {
regHtml = `<div class="info-item">
<div class="info-label">${icons.clipboard} 注册地</div>
<div class="info-value">${data.registered_country.name}</div>
</div>`;
}
let coordsHtml = '';
if (data.location) {
coordsHtml = `<div class="map-btn" onclick="updateMap(${data.location.latitude},${data.location.longitude})">
${data.location.latitude}, ${data.location.longitude}
</div>`;
}
resultSection.innerHTML = `
<div class="result-card">
<div class="result-header">
<div class="result-ip">${data.ip}</div>
<div class="result-subnet">${data.addr || '未知网段'}</div>
</div>
<div class="result-body">
<div class="info-group">
<div class="info-item">
<div class="info-label">${icons.globe} 地理位置</div>
<div class="location-path">${locationHtml}</div>
</div>
${data.detail ? `<div class="info-item">
<div class="info-label">${icons.mapPin} 详细位置</div>
<div class="info-value">${data.detail}</div>
</div>` : ''}
${regHtml}
${coordsHtml}
</div>
<div class="info-group">
<div class="info-item">
<div class="info-label">${icons.building} 运营商 / ISP</div>
<div class="info-value highlight">${ispName}${ispType}</div>
</div>
<div class="info-item">
<div class="info-label">${icons.hash} ASN</div>
<div class="info-value mono">${asn}</div>
</div>
${data.as && data.as.name !== ispName ? `<div class="info-item">
<div class="info-label">${icons.tag} 组织名称</div>
<div class="info-value">${data.as.name}</div>
</div>` : ''}
</div>
</div>
</div>`;
if (data.location) updateMap(data.location.latitude, data.location.longitude);
else mapSection.style.display = 'none';
}
</script>
</body>
</html>