-
Notifications
You must be signed in to change notification settings - Fork 1
/
index.html
135 lines (130 loc) · 2.63 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
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="width=device-width,initial-scale=1.0">
<title></title>
<style type="text/css">
@import url('https://fonts.googleapis.com/css2?family=Encode+Sans+Semi+Expanded:wght@500&display=swap');
body{
font-family: 'Encode Sans Semi Expanded', sans-serif;
}
div{
background-color:#FAF1F4;
width:90%;
height:auto;
margin:0px;
padding:0px 0px 4px 0px;
border-radius:20px;
}
#label{
background-color:#FFDAD2;
podition:relative;
width:100%;
height:auto;
padding-top:10px;
padding-bottom:10px;
border-radius:20px 20px 0px 0px;
}
#iptool{
background-color:#FFDAD2;
padding:5px;
}
img{
border-radius:20px;
}
p{
font-size:20px;
}
input{
background-color:#FAF1F4;
border-radius:20px;
width:60%;
height:50px;
border:none;
font-size:20px;
font-family: 'Encode Sans Semi Expanded', sans-serif;
}
button{
background-color:#FFDAD2;
height:50px;
border:none;
border-radius:20px;
font-family: 'Encode Sans Semi Expanded', sans-serif;
font-size:15px;
}
</style>
</head>
<body onload="myip()" bgcolor="#FFFBFF">
<center>
<div id="iptool">
<h1 id="query">IP TOOL</h1>
</div>
<br>
<img id="flag" width="180" height="120">
<br><br>
<div>
<div id="label"><label>Country</label></div><p id="country"></p>
</div>
<br>
<div>
<div id="label"><label>Region</label></div><p id="region"></p>
</div>
<br>
<div>
<div id="label"><label>City</label></div><p id="city"></p>
</div>
<br>
<div>
<div id="label"><label>ISP</label></div><p id="isp"></p>
</div>
<br>
<div>
<div id="label"><label>Your IP</label></div><p id="myip"></p>
</div>
<br><br>
<input id="ip" type="ip">
<button onclick="customIP()"> Lookup </button>
</center>
<script type="text/javascript">
function id(x){ var y = document.getElementById(x); return y;}
function customIP(){
var cip = id("ip").value;
checkip(cip);
}
function myip(){
var ipapi = "https://api.ipify.org?format=json";
fetch(ipapi)
.then(res => res.json())
.then((out) => {
var ip = out.ip;
id("myip").innerHTML = ip;
checkip(ip);
})
.catch(err => {
throw err
});
}
function flag(x){
var flagapi = "https://countryflagsapi.com/png/" + x;
return flagapi;
}
function checkip(x){
var api = "http://ip-api.com/json/"
var url = api + x;
fetch(url)
.then(res => res.json())
.then((out) => {
id("country").innerHTML = out.country;
id("region").innerHTML = out.regionName;
id("city").innerHTML = out.city;
id("isp").innerHTML = out.isp;
id("query").innerHTML = out.query;
id("flag").setAttribute("src", flag(out.countryCode));
})
.catch(err => {
throw err
});
}
</script>
</body>
</html>