address / index.html
ERROR418's picture
Update index.html
7eb443b verified
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8">
<title>API可用调用地址</title>
<style>
body {
font-family: Arial, sans-serif;
background-size: cover;
background-repeat: no-repeat;
transition: background-image 1s ease-in-out;
text-align: center;
padding: 50px;
}
.address {
margin: 40px;
padding: 10px;
border: 2px solid #ccc;
border-radius: 5px;
background-color: rgba(255, 255, 255, 0.6);
transition: transform 0.3s, background-color 0.3s, opacity 0.3s;
width: 400px; /* 增加宽度以适应长地址 */
display: block;
margin-left: auto;
margin-right: auto;
position: relative;
white-space: nowrap; /* 确保地址在一行显示 */
overflow: hidden;
text-overflow: ellipsis;
}
.address:hover {
transform: scale(1.05);
background-color: rgba(255, 255, 255, 0.85);
}
.unavailable {
text-decoration: line-through;
color: #999;
}
.available {
font-weight: bold;
color: #4CAF50;
}
.address a {
color: black;
text-decoration: none;
opacity: 1;
}
.status {
position: absolute;
top: 10px;
left: 10px;
padding: 2px 5px;
border-radius: 5px;
color: white;
font-size: 12px;
}
.usable {
background-color: #4CAF50;
}
.disable {
background-color: #f44336;
}
</style>
</head>
<body>
<h1>API可用调用地址</h1>
<div id="address1" class="address unavailable">
<span class="status disable">disable</span>
<p>地址1:<a href="#" onclick="copyToClipboard('https://api.hongshi-app.us.kg/')">https://api.hongshi-app.us.kg/</a></p>
</div>
<div id="address2" class="address unavailable">
<span class="status disable">disable</span>
<p>地址2:<a href="#" onclick="copyToClipboard('https://error418-new-api/ai')">https://error418-new-api/ai</a></p>
</div>
<div id="address3" class="address unavailable">
<span class="status disable">disable</span>
<p>地址3:<a href="#" onclick="copyToClipboard('https://new-api.hongshi-app.us.kg/')">https://new-api.hongshi-app.us.kg/</a></p>
</div>
<script>
// 修改这里以选择可用的地址
var availableAddress = 2; // 选择1, 2, 或 3
var addressElement = document.getElementById('address' + availableAddress);
addressElement.classList.remove('unavailable');
addressElement.classList.add('available');
var statusElement = addressElement.querySelector('.status');
statusElement.classList.remove('disable');
statusElement.classList.add('usable');
statusElement.textContent = 'usable';
// 设置可变背景
var backgroundIndex = 1;
function changeBackground() {
document.body.style.backgroundImage = 'url(background' + backgroundIndex + '.jpg)';
backgroundIndex = (backgroundIndex % 15) + 1;
}
setInterval(changeBackground, 15000); // 每15秒更换一次背景
changeBackground(); // 初始化背景
// 复制地址到剪贴板
function copyToClipboard(text) {
navigator.clipboard.writeText(text).then(function() {
alert('地址已复制到剪贴板:' + text);
}, function(err) {
alert('复制失败:', err);
});
}
// 检测链接延迟
function checkLinkDelay(url, callback) {
var startTime = new Date().getTime();
var img = new Image();
img.onload = function() {
var endTime = new Date().getTime();
var delay = endTime - startTime;
callback(delay);
};
img.onerror = function() {
callback('无法检测');
};
img.src = url + '?t=' + startTime; // 防止缓存
}
// 示例:检测地址1的延迟
checkLinkDelay('https://api.hongshi-app.us.kg/', function(delay) {
console.log('地址1的延迟:' + delay + 'ms');
});
</script>
</body>
</html>