
<!DOCTYPE html>
<html>

<head>
    <meta charset="utf-8">
    <meta http-equiv="x-dns-prefetch-control" content="on">
    <link rel="dns-prefetch" href="//cdn.jsdelivr.net">
    <link rel="dns-prefetch" href="//whois.pconline.com.cn">
    <link rel="dns-prefetch" href="//api-ipv4.ip.sb">
    <link rel="dns-prefetch" href="//myip.ipip.net">
    <link rel="dns-prefetch" href="//api.ipify.org">
    <link rel="dns-prefetch" href="//api.ttt.sh">
    <link rel="dns-prefetch" href="//api.skk.moe">
    <link rel="dns-prefetch" href="//d.skk.moe">
    <link rel="preconnect" href="https://whois.pconline.com.cn">
    <link rel="preconnect" href="https://api-ipv4.ip.sb">
    <link rel="preconnect" href="https://myip.ipip.net">
    <link rel="preconnect" href="https://api.ipify.org">
    <link rel="preconnect" href="https://api.ttt.sh">
    <link rel="preconnect" href="https://api.skk.moe">
    <link rel="preconnect" href="https://d.skk.moe">
    <meta name="referrer" content="no-referrer">
    <meta name="viewport" content="width=device-width,initial-scale=1,user-scalable=no,minimal-ui">
    <title>IP 地址查询</title>
    <style>
        .ip-title {
            font-weight: bold;
            color: #444;
            font-size:15px;
            display: inline-block;
            width: 25%;
            vertical-align:bottom;
        }
        
        .ip-state_title {
            font-weight: bold;
            color: #444;
            font-size:15px;
            display: inline-block;
            width: 52%;
            vertical-align:bottom;
            transform:translateY(5%);
        }
        
        .ip-result {
            color: #444;
            font-size:16px;
            margin:0px 0px 0px 30px;
            white-space: nowrap;  /*强制span不换行*/
            display: inline-block;  /*将span当做块级元素对待*/
            width: 29%;  /*限制宽度*/
            overflow: hidden;  /*超出宽度部分隐藏*/
            text-overflow: ellipsis;  /*超出部分以点号代替*/
            vertical-align:bottom;
            transform:translateY(8%);
        }
        
        .ip-geo {
            color: #444;
            font-size:15px;
            line-height:20px;
            white-space: nowrap;  /*强制span不换行*/
            display: inline-block;  /*将span当做块级元素对待*/
            width: 30%;  /*限制宽度*/
            overflow: hidden;  /*超出宽度部分隐藏*/
            text-overflow: ellipsis;  /*超出部分以点号代替*/
            vertical-align:bottom;
            transform:translateY(15%);
        }
        
        .ip-checking {
            color: #444;
            font-size:15px;
            line-height:20px;
            display: inline-block;
            vertical-align:bottom;
            width: 29%;
            white-space: nowrap;
            overflow: hidden;
            text-overflow: ellipsis;
            transform:translateY(12%);
        }

        .sk-text-success {
            color: #32b643;
            font-size:15px;
            line-height:20px;
            display: inline-block;
            vertical-align:bottom;
            width: 48%;
            white-space: nowrap;
            overflow: hidden;
            text-overflow: ellipsis;
            text-align: left;
            transform:translateY(12%);
        }

        .sk-text-error {
            color: #e85600;
            font-size:15px;
            line-height:20px;
            display: inline-block;
            vertical-align:bottom;
            width: 48%;
            white-space: nowrap;
            overflow: hidden;
            text-overflow: ellipsis;
            text-align: left;
            transform:translateY(12%);
        }

        h3 {
            margin: 5px 0 6px;
        }

        p {
            margin: 10px 0;
        }

        a {
            text-decoration: none;
            color: #666;
        }

    </style>
</head>
<fieldset class="cbi-section">
	<table width="100%">
     <tr><td width="100%">
<body>
    <div style="display: flex;">
        <div style="width: 51%">
            <h3><%:IP Address%></h3>
            <p>
                <span class="ip-title">IPIP&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<%:Mainland%>:</span><span class="ip-result" id="ip-ipipnet"></span> <span class="ip-geo" id="ip-ipipnet-geo"></span>
            </p>
            <p>
                <span class="ip-title">IP.PC&nbsp;&nbsp;&nbsp;&nbsp;<%:Mainland%>:</span><span class="ip-result" id="ip-pcol"></span> <span class="ip-geo" id="ip-pcol-ipip"></span>
            </p>
            <p>
                <span class="ip-title">IP.SB&nbsp;&nbsp;&nbsp;&nbsp;<%:Abroad%>:</span><span class="ip-result" id="ip-ipsb"></span> <span class="ip-geo" id="ip-ipsb-geo"></span>
            </p>
            <p>
                <span class="ip-title">IPIFY&nbsp;&nbsp;&nbsp;&nbsp;<%:Abroad%>:</span><span class="ip-result" id="ip-ipify"></span> <span class="ip-geo" id="ip-ipify-ipip"></span>
            </p>
        </div>
        <div style="width: 49%">
            <h3><%:Website Access Check%></h3>
            <p>
                <span class="ip-state_title"><%:Baidu Search%>:</span><span id="http-baidu"></span>
            </p>
            <p>
                <span class="ip-state_title"><%:NetEase Music%>:</span><span id="http-163"></span>
            </p>
            <p>
                <span class="ip-state_title">GitHub:</span><span id="http-github"></span>
            </p>
            <p>
                <span class="ip-state_title">YouTube:</span><span id="http-youtube"></span>
            </p>
        </div>
    </div>
    <div>
        <p style="float: right; margin-top: 30px; font-size:15px; padding-right: 10px">Powered by <a onclick="return ip_skk()" href="javascript:void(0);">ip.skk.moe</a></p>
    </div>
    </td></tr>
	</table>
</fieldset>
    <script>
        function ip_skk()
       {
        url2='https://ip.skk.moe';
        window.open(url2);
       }
        const $$ = document;
        $$.getElementById('ip-pcol').innerHTML = '<%:Querying...%>';
        $$.getElementById('ip-ipify').innerHTML = '<%:Querying...%>';
        $$.getElementById('ip-ipipnet').innerHTML = '<%:Querying...%>';
        $$.getElementById('ip-ipsb').innerHTML = '<%:Querying...%>';
        let random = parseInt(Math.random() * 100000000);
        let IP = {
            get: (url, type) =>
                fetch(url, { method: 'GET' }).then((resp) => {
                    if (type === 'text')
                        return Promise.all([resp.ok, resp.status, resp.text(), resp.headers]);
                    else {
                        return Promise.all([resp.ok, resp.status, resp.json(), resp.headers]);
                    }
                }).then(([ok, status, data, headers]) => {
                    if (ok) {
                        let json = {
                            ok,
                            status,
                            data,
                            headers
                        }
                        return json;
                    } else {
                        throw new Error(JSON.stringify(json.error));
                    }
                }).catch(error => {
                    throw error;
                }),
            parseIPIpip: (ip, elID) => {
            	  var meta = document.createElement('meta');
            	  meta.name = "referrer";
            	  meta.content = "no-referrer-when-downgrade";
            	  document.getElementsByTagName('head')[0].appendChild(meta);
            	  
                IP.get(`https://qqwry.api.skk.moe/${ip}`, 'json')
                    .then(resp => {
                        $$.getElementById(elID).innerHTML = resp.data.geo;
                        //$$.getElementById(elID).innerHTML = `${resp.data.country} ${resp.data.regionName} ${resp.data.city} ${resp.data.isp}`;
                    })
                    
                var meta = document.createElement('meta');
            	  meta.name = "referrer";
            	  meta.content = "no-referrer";
            	  document.getElementsByTagName('head')[0].appendChild(meta); 
            },
            getIpipnetIP: () => {
                IP.get(`https://myip.ipip.net/?z=${random}`, 'text')
                    .then((resp) => {
                        let data = resp.data.replace('当前 IP：', '').split(' 来自于：');
                        $$.getElementById('ip-ipipnet').innerHTML = `${data[0]}`;
                        $$.getElementById('ip-ipipnet-geo').innerHTML = `${data[1]}`;
                    });
            },
            getIPApiIP: () => {
                IP.get(`https://ipapi.co/json?z=${random}`, 'json')
                    .then(resp => {
                        $$.getElementById('ip-ipapi').innerHTML = resp.data.ip;
                        IP.parseIPIpip(resp.data.ip, 'ip-ipapi-geo');
                    })
            },
            getIpifyIP: () => {
                IP.get(`https://api.ipify.org/?format=json&z=${random}`, 'json')
                .then(resp => {
                $$.getElementById('ip-ipify').innerHTML = resp.data.ip;
                return resp.data.ip;
                })
                .then(ip => {
                IP.parseIPIpip(ip, 'ip-ipify-ipip');
                })
            }
        };
        
        $$.getElementById('http-baidu').innerHTML = '<span class="ip-checking"><%:Testing...%></span>';
        $$.getElementById('http-163').innerHTML =  '<span class="ip-checking"><%:Testing...%></span>';
        $$.getElementById('http-github').innerHTML = '<span class="ip-checking"><%:Testing...%></span>';
        $$.getElementById('http-youtube').innerHTML = '<span class="ip-checking"><%:Testing...%></span>';
        let HTTP = {
            checker: (domain, cbElID) => {
                let img = new Image;
                let timeout = setTimeout(() => {
                    img.onerror = img.onload = null;
                    $$.getElementById(cbElID).innerHTML = '<span class="sk-text-error"><%:Access Timed Out%></span>'
                }, 5000);

                img.onerror = () => {
                    clearTimeout(timeout);
                    $$.getElementById(cbElID).innerHTML = '<span class="sk-text-error"><%:Access Denied%></span>'
                }

                img.onload = () => {
                    clearTimeout(timeout);
                    $$.getElementById(cbElID).innerHTML = '<span class="sk-text-success"><%:Access Normal%></span>'
                }

                img.src = `https://${domain}/favicon.ico?${+(new Date)}`
            },
            runcheck: () => {
                HTTP.checker('www.baidu.com', 'http-baidu');
                HTTP.checker('s1.music.126.net/style', 'http-163');
                HTTP.checker('github.com', 'http-github');
                HTTP.checker('www.youtube.com', 'http-youtube');
            }
        };

	      HTTP.runcheck();
	      IP.getIpipnetIP();
	      IP.getIpifyIP();
	      
	      function getPcolIP(data){
                let pcisp = data.addr.split(' ');
                $$.getElementById('ip-pcol').innerHTML = data.ip;
                $$.getElementById('ip-pcol-ipip').innerHTML = `${data.pro} ${data.city} ${data.region} ${pcisp[1]}`;
        };

        function getIpsbIP(data){
                $$.getElementById('ip-ipsb').innerHTML = data.ip;
                IP.parseIPIpip(data.ip, 'ip-ipsb-geo');
        };

	      window.onload=myip_Load();
	      
	      function myip_Load()
	      {
	         var pcip = document.getElementsByTagName('HEAD').item(0);
	         var pcipScript= document.createElement("script");
	         pcipScript.defer = "defer";
	         pcipScript.src='https://whois.pconline.com.cn/ipJson.jsp?callback=getPcolIP';
	         pcip.appendChild(pcipScript);
	         
	         var sbip = document.getElementsByTagName('HEAD').item(0);
	         var sbipScript= document.createElement("script");
	         sbipScript.defer = "defer";
	         sbipScript.src='https://api-ipv4.ip.sb/jsonip?callback=getIpsbIP';
	         sbip.appendChild(sbipScript);
	         
	         const $$ = document;
	         random = parseInt(Math.random() * 100000000);
		       HTTP.runcheck();
		       IP.getIpipnetIP();
		       IP.getIpifyIP();
		       
           function getPcolIP(data){
                let pcisp = data.addr.split(' ');
                $$.getElementById('ip-pcol').innerHTML = data.ip;
                $$.getElementById('ip-pcol-ipip').innerHTML = `${data.pro} ${data.city} ${data.region} ${pcisp[1]}`;
           };

		       function getIpsbIP(data){
                $$.getElementById('ip-ipsb').innerHTML = data.ip;
                IP.parseIPIpip(data.ip, 'ip-ipsb-geo');
		       };

       	   setTimeout("myip_Load()",1000*10);
		   }

    </script>
    <script defer="defer" src="https://whois.pconline.com.cn/ipJson.jsp?callback=getPcolIP"></script>
    <script defer="defer" src="https://api-ipv4.ip.sb/jsonip?callback=getIpsbIP"></script>
</body>

</html>
