-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
55 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<title>Example Domain</title> | ||
<meta charset="utf-8"> | ||
<meta http-equiv="Content-type" content="text/html; charset=utf-8"> | ||
<link type="text/css" rel="stylesheet" href="https://fonts.googleapis.com/css?family=Roboto:300,400,500,700|Google+Sans:400,500,700|Google+Sans+Text:400&lang=en"> | ||
</head> | ||
<body style="margin: 0; overflow: hidden;"> | ||
<iframe id="map" | ||
frameborder="0" scrolling="no" | ||
style="width: 100vw; height: 100vh;"/> | ||
</iframe> | ||
|
||
<div id="info" style=" | ||
display: none; | ||
position: absolute; left: 0; top: 110px; width: 279.5px; | ||
background-color: white; | ||
margin: 10px; padding: 9px 11px; | ||
border-radius: 2px; | ||
box-shadow: rgb(0 0 0 / 30%) 0px 1px 4px -1px; | ||
user-select: text; | ||
font-family: Roboto, Arial; | ||
"> | ||
<div id="ip" style="color: black; font-size: 14px; font-weight: 500;"></div> | ||
<div id="org" style="color: #5b5b5b; font-size: 12px; margin-top: 6px;"></div> | ||
</div> | ||
|
||
<script> | ||
(async function () { | ||
|
||
const ipInfo = await fetch('https://ipapi.co/json/').then(res => res.json()); | ||
console.info('ipInfo:', ipInfo) | ||
|
||
const infoElement = document.getElementById('info'); | ||
|
||
const ipElement = document.getElementById('ip'); | ||
ipElement.innerText = ipInfo.ip | ||
|
||
const orgElement = document.getElementById('org'); | ||
orgElement.innerText = ipInfo.org | ||
|
||
const mapIframe = document.getElementById('map'); | ||
const mapQuery = `${ipInfo.latitude},${ipInfo.longitude}`; | ||
|
||
mapIframe.onload = () => { | ||
setTimeout(() => { | ||
infoElement.style.display = ''; | ||
}, 500); | ||
} | ||
mapIframe.src = `https://maps.google.com/maps?q=${mapQuery}&z=10&output=embed`; | ||
})(); | ||
</script> | ||
</body> | ||
</html> |