Update index.html
This commit is contained in:
110
index.html
110
index.html
@@ -18,6 +18,12 @@
|
|||||||
background-color: #f4f4f4;
|
background-color: #f4f4f4;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
h1 {
|
||||||
|
font-size: 1.5rem;
|
||||||
|
font-weight: bold;
|
||||||
|
margin-bottom: 1rem;
|
||||||
|
}
|
||||||
|
|
||||||
.domain-container {
|
.domain-container {
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
@@ -44,82 +50,98 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
.copy-button {
|
.copy-button {
|
||||||
margin-left: 1rem;
|
font-size: 0.75rem;
|
||||||
}
|
padding: 0.2rem 0.5rem;
|
||||||
|
|
||||||
.footer {
|
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
justify-content: center;
|
|
||||||
margin-top: 2rem;
|
|
||||||
}
|
|
||||||
|
|
||||||
.footer a {
|
|
||||||
color: #333;
|
|
||||||
text-decoration: none;
|
|
||||||
margin-left: 0.5rem;
|
margin-left: 0.5rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
.footer a:hover {
|
.footer {
|
||||||
|
font-size: 0.9rem;
|
||||||
|
color: #555;
|
||||||
|
}
|
||||||
|
|
||||||
|
.github-icon {
|
||||||
|
position: fixed;
|
||||||
|
bottom: 15px;
|
||||||
|
text-align: center;
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.github-icon a {
|
||||||
|
color: #333;
|
||||||
|
text-decoration: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.github-icon a:hover {
|
||||||
color: #555;
|
color: #555;
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
|
<!-- 添加标题 -->
|
||||||
|
<h2>Docker 镜像加速(多种仓库)</h2>
|
||||||
|
|
||||||
<div class="domain-container">
|
<div class="domain-container">
|
||||||
<div class="domain-item">
|
<div class="domain-item">
|
||||||
<div class="domain-text">dockerhub.example.com</div>
|
<div class="domain-text">dockerhub.<span id="domain-base"></span></div>
|
||||||
<sl-button class="copy-button" variant="primary" @click="copyToClipboard('dockerhub.example.com')">复制</sl-button>
|
<sl-button class="copy-button" variant="primary">复制</sl-button>
|
||||||
</div>
|
</div>
|
||||||
<div class="domain-item">
|
<div class="domain-item">
|
||||||
<div class="domain-text">ghcr.example.com</div>
|
<div class="domain-text">ghcr.<span id="domain-base"></span></div>
|
||||||
<sl-button class="copy-button" variant="primary" @click="copyToClipboard('ghcr.example.com')">复制</sl-button>
|
<sl-button class="copy-button" variant="primary">复制</sl-button>
|
||||||
</div>
|
</div>
|
||||||
<div class="domain-item">
|
<div class="domain-item">
|
||||||
<div class="domain-text">gcr.example.com</div>
|
<div class="domain-text">gcr.<span id="domain-base"></span></div>
|
||||||
<sl-button class="copy-button" variant="primary" @click="copyToClipboard('gcr.example.com')">复制</sl-button>
|
<sl-button class="copy-button" variant="primary">复制</sl-button>
|
||||||
</div>
|
</div>
|
||||||
<div class="domain-item">
|
<div class="domain-item">
|
||||||
<div class="domain-text">k8sgcr.example.com</div>
|
<div class="domain-text">k8sgcr.<span id="domain-base"></span></div>
|
||||||
<sl-button class="copy-button" variant="primary" @click="copyToClipboard('k8sgcr.example.com')">复制</sl-button>
|
<sl-button class="copy-button" variant="primary">复制</sl-button>
|
||||||
</div>
|
</div>
|
||||||
<div class="domain-item">
|
<div class="domain-item">
|
||||||
<div class="domain-text">registryk8s.example.com</div>
|
<div class="domain-text">registryk8s.<span id="domain-base"></span></div>
|
||||||
<sl-button class="copy-button" variant="primary" @click="copyToClipboard('registryk8s.example.com')">复制</sl-button>
|
<sl-button class="copy-button" variant="primary">复制</sl-button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="footer">
|
<div class="footer">
|
||||||
<span>Docker镜像加速: 支持多种仓库。</span>
|
提示:请根据对应的仓库使用对应的域名。
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="github-icon">
|
||||||
<a href="https://github.com/sky22333/Docker-Hub" target="_blank">
|
<a href="https://github.com/sky22333/Docker-Hub" target="_blank">
|
||||||
<sl-icon name="github" size="24"></sl-icon>
|
<sl-icon name="github" size="24"></sl-icon>
|
||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
const domainText = document.querySelectorAll('.domain-text');
|
const domainBase = new URL(window.location.href).hostname.replace(/^www\./, '');
|
||||||
const copyButtons = document.querySelectorAll('.copy-button');
|
document.querySelectorAll('#domain-base').forEach(el => {
|
||||||
const domainBase = 'example.com';
|
el.textContent = domainBase;
|
||||||
|
|
||||||
domainText.forEach((text, index) => {
|
|
||||||
text.textContent = text.textContent.replace('example.com', domainBase);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
copyButtons.forEach((button, index) => {
|
document.querySelectorAll('.copy-button').forEach(button => {
|
||||||
button.addEventListener('click', () => {
|
button.addEventListener('click', async () => {
|
||||||
copyToClipboard(domainText[index].textContent);
|
const domainText = button.previousElementSibling.textContent;
|
||||||
|
|
||||||
|
try {
|
||||||
|
await navigator.clipboard.writeText(domainText);
|
||||||
|
|
||||||
|
if (button.dataset.copied) return;
|
||||||
|
button.dataset.copied = true;
|
||||||
|
|
||||||
|
const originalText = button.textContent;
|
||||||
|
button.textContent = '已复制';
|
||||||
|
|
||||||
|
setTimeout(() => {
|
||||||
|
button.textContent = originalText;
|
||||||
|
delete button.dataset.copied;
|
||||||
|
}, 1000);
|
||||||
|
} catch (err) {
|
||||||
|
console.error('复制失败', err);
|
||||||
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
function copyToClipboard(text) {
|
|
||||||
navigator.clipboard.writeText(text);
|
|
||||||
const toast = Object.assign(document.createElement('sl-toast'), {
|
|
||||||
duration: 2000,
|
|
||||||
label: '已复制到剪贴板',
|
|
||||||
});
|
|
||||||
document.body.appendChild(toast);
|
|
||||||
toast.show();
|
|
||||||
}
|
|
||||||
</script>
|
</script>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|||||||
Reference in New Issue
Block a user