上传文件至 /
This commit is contained in:
parent
ba4883b373
commit
0f224b2ef0
360
index.html
Normal file
360
index.html
Normal file
@ -0,0 +1,360 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="zh-CN">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>XMC导航页</title>
|
||||
<style>
|
||||
* {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
box-sizing: border-box;
|
||||
font-family: 'Microsoft YaHei', sans-serif;
|
||||
}
|
||||
|
||||
body {
|
||||
background-color: #f5f5f5;
|
||||
color: #333;
|
||||
padding: 20px;
|
||||
max-width: 800px;
|
||||
margin: 0 auto;
|
||||
}
|
||||
|
||||
.header {
|
||||
text-align: center;
|
||||
margin-bottom: 30px;
|
||||
}
|
||||
|
||||
.logo {
|
||||
font-size: 24px;
|
||||
font-weight: bold;
|
||||
color: #1e88e5;
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
|
||||
.search-container {
|
||||
display: flex;
|
||||
margin-bottom: 30px;
|
||||
}
|
||||
|
||||
.search-input {
|
||||
flex: 1;
|
||||
padding: 12px 15px;
|
||||
border: 1px solid #ddd;
|
||||
border-radius: 24px 0 0 24px;
|
||||
font-size: 16px;
|
||||
outline: none;
|
||||
box-shadow: 0 2px 5px rgba(0,0,0,0.1);
|
||||
}
|
||||
|
||||
.search-button {
|
||||
padding: 12px 20px;
|
||||
background-color: #1e88e5;
|
||||
color: white;
|
||||
border: none;
|
||||
border-radius: 0 24px 24px 0;
|
||||
cursor: pointer;
|
||||
font-size: 16px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
.search-button:hover {
|
||||
background-color: #1976d2;
|
||||
}
|
||||
|
||||
.add-bookmark {
|
||||
display: block;
|
||||
margin: 0 auto 20px;
|
||||
padding: 10px 20px;
|
||||
background-color: #4caf50;
|
||||
color: white;
|
||||
border: none;
|
||||
border-radius: 4px;
|
||||
cursor: pointer;
|
||||
font-size: 14px;
|
||||
}
|
||||
|
||||
.add-bookmark:hover {
|
||||
background-color: #388e3c;
|
||||
}
|
||||
|
||||
.bookmarks-container {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
|
||||
gap: 15px;
|
||||
}
|
||||
|
||||
.bookmark {
|
||||
background-color: white;
|
||||
border-radius: 8px;
|
||||
padding: 15px 10px;
|
||||
text-align: center;
|
||||
box-shadow: 0 2px 5px rgba(0,0,0,0.1);
|
||||
transition: transform 0.2s;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.bookmark:hover {
|
||||
transform: translateY(-3px);
|
||||
box-shadow: 0 4px 8px rgba(0,0,0,0.15);
|
||||
}
|
||||
|
||||
.bookmark-icon {
|
||||
width: 40px;
|
||||
height: 40px;
|
||||
margin: 0 auto 8px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
background-color: #e0e0e0;
|
||||
border-radius: 50%;
|
||||
color: #555;
|
||||
font-size: 18px;
|
||||
}
|
||||
|
||||
.bookmark-name {
|
||||
font-size: 13px;
|
||||
white-space: nowrap;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
}
|
||||
|
||||
.modal {
|
||||
display: none;
|
||||
position: fixed;
|
||||
top: 0;
|
||||
left: 0;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
background-color: rgba(0,0,0,0.5);
|
||||
z-index: 100;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
.modal-content {
|
||||
background-color: white;
|
||||
padding: 20px;
|
||||
border-radius: 8px;
|
||||
width: 90%;
|
||||
max-width: 400px;
|
||||
}
|
||||
|
||||
.modal-title {
|
||||
font-size: 18px;
|
||||
margin-bottom: 20px;
|
||||
color: #333;
|
||||
}
|
||||
|
||||
.form-group {
|
||||
margin-bottom: 15px;
|
||||
}
|
||||
|
||||
.form-group label {
|
||||
display: block;
|
||||
margin-bottom: 5px;
|
||||
font-size: 14px;
|
||||
color: #555;
|
||||
}
|
||||
|
||||
.form-group input {
|
||||
width: 100%;
|
||||
padding: 10px;
|
||||
border: 1px solid #ddd;
|
||||
border-radius: 4px;
|
||||
font-size: 14px;
|
||||
}
|
||||
|
||||
.modal-buttons {
|
||||
display: flex;
|
||||
justify-content: flex-end;
|
||||
margin-top: 20px;
|
||||
}
|
||||
|
||||
.modal-button {
|
||||
padding: 8px 15px;
|
||||
margin-left: 10px;
|
||||
border: none;
|
||||
border-radius: 4px;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.modal-button.cancel {
|
||||
background-color: #f5f5f5;
|
||||
color: #333;
|
||||
}
|
||||
|
||||
.modal-button.confirm {
|
||||
background-color: #1e88e5;
|
||||
color: white;
|
||||
}
|
||||
|
||||
.modal-button.confirm:hover {
|
||||
background-color: #1976d2;
|
||||
}
|
||||
|
||||
.time {
|
||||
text-align: center;
|
||||
font-size: 14px;
|
||||
color: #666;
|
||||
margin-bottom: 20px;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div class="header">
|
||||
<div class="logo">XMC导航页</div>
|
||||
<div class="time" id="current-time"></div>
|
||||
</div>
|
||||
|
||||
<div class="search-container">
|
||||
<input type="text" class="search-input" id="search-input" placeholder="搜索或输入网址">
|
||||
<button class="search-button" id="search-button">
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
|
||||
<circle cx="11" cy="11" r="8"></circle>
|
||||
<line x1="21" y1="21" x2="16.65" y2="16.65"></line>
|
||||
</svg>
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<button class="add-bookmark" id="add-bookmark">添加书签</button>
|
||||
|
||||
<div class="bookmarks-container" id="bookmarks-container">
|
||||
<!-- 书签将通过JavaScript动态添加 -->
|
||||
</div>
|
||||
|
||||
<!-- 添加书签的模态框 -->
|
||||
<div class="modal" id="bookmark-modal">
|
||||
<div class="modal-content">
|
||||
<div class="modal-title">添加书签</div>
|
||||
<div class="form-group">
|
||||
<label for="bookmark-name">名称</label>
|
||||
<input type="text" id="bookmark-name" placeholder="输入书签名称">
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="bookmark-url">网址</label>
|
||||
<input type="text" id="bookmark-url" placeholder="输入网址 (包含http://或https://)">
|
||||
</div>
|
||||
<div class="modal-buttons">
|
||||
<button class="modal-button cancel" id="cancel-bookmark">取消</button>
|
||||
<button class="modal-button confirm" id="confirm-bookmark">确定</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
// 显示当前时间
|
||||
function updateTime() {
|
||||
const now = new Date();
|
||||
const timeString = now.toLocaleTimeString('zh-CN', { hour: '2-digit', minute: '2-digit' });
|
||||
document.getElementById('current-time').textContent = timeString;
|
||||
}
|
||||
|
||||
setInterval(updateTime, 1000);
|
||||
updateTime();
|
||||
|
||||
// 搜索功能
|
||||
document.getElementById('search-button').addEventListener('click', function() {
|
||||
const query = document.getElementById('search-input').value.trim();
|
||||
if (query) {
|
||||
window.open(`https://www.bing.com/search?q=${encodeURIComponent(query)}`, '_self');
|
||||
}
|
||||
});
|
||||
|
||||
document.getElementById('search-input').addEventListener('keypress', function(e) {
|
||||
if (e.key === 'Enter') {
|
||||
document.getElementById('search-button').click();
|
||||
}
|
||||
});
|
||||
|
||||
// 书签功能
|
||||
let bookmarks = JSON.parse(localStorage.getItem('bookmarks')) || [];
|
||||
|
||||
// 显示书签
|
||||
function renderBookmarks() {
|
||||
const container = document.getElementById('bookmarks-container');
|
||||
container.innerHTML = '';
|
||||
|
||||
bookmarks.forEach((bookmark, index) => {
|
||||
const bookmarkElement = document.createElement('div');
|
||||
bookmarkElement.className = 'bookmark';
|
||||
bookmarkElement.innerHTML = `
|
||||
<div class="bookmark-icon">${bookmark.name.charAt(0).toUpperCase()}</div>
|
||||
<div class="bookmark-name">${bookmark.name}</div>
|
||||
`;
|
||||
|
||||
bookmarkElement.addEventListener('click', function() {
|
||||
window.open(bookmark.url, '_self');
|
||||
});
|
||||
|
||||
// 长按删除书签
|
||||
let pressTimer;
|
||||
bookmarkElement.addEventListener('touchstart', function(e) {
|
||||
pressTimer = setTimeout(() => {
|
||||
e.preventDefault();
|
||||
if (confirm(`确定要删除 "${bookmark.name}" 书签吗?`)) {
|
||||
bookmarks.splice(index, 1);
|
||||
localStorage.setItem('bookmarks', JSON.stringify(bookmarks));
|
||||
renderBookmarks();
|
||||
}
|
||||
}, 1000);
|
||||
});
|
||||
|
||||
bookmarkElement.addEventListener('touchend', function() {
|
||||
clearTimeout(pressTimer);
|
||||
});
|
||||
|
||||
container.appendChild(bookmarkElement);
|
||||
});
|
||||
}
|
||||
|
||||
// 添加书签模态框
|
||||
const modal = document.getElementById('bookmark-modal');
|
||||
const addBookmarkBtn = document.getElementById('add-bookmark');
|
||||
const cancelBookmarkBtn = document.getElementById('cancel-bookmark');
|
||||
const confirmBookmarkBtn = document.getElementById('confirm-bookmark');
|
||||
|
||||
addBookmarkBtn.addEventListener('click', function() {
|
||||
document.getElementById('bookmark-name').value = '';
|
||||
document.getElementById('bookmark-url').value = '';
|
||||
modal.style.display = 'flex';
|
||||
});
|
||||
|
||||
cancelBookmarkBtn.addEventListener('click', function() {
|
||||
modal.style.display = 'none';
|
||||
});
|
||||
|
||||
confirmBookmarkBtn.addEventListener('click', function() {
|
||||
const name = document.getElementById('bookmark-name').value.trim();
|
||||
let url = document.getElementById('bookmark-url').value.trim();
|
||||
|
||||
if (!name || !url) {
|
||||
alert('请填写名称和网址');
|
||||
return;
|
||||
}
|
||||
|
||||
// 确保URL有协议前缀
|
||||
if (!url.startsWith('http://') && !url.startsWith('https://')) {
|
||||
url = 'https://' + url;
|
||||
}
|
||||
|
||||
bookmarks.push({ name, url });
|
||||
localStorage.setItem('bookmarks', JSON.stringify(bookmarks));
|
||||
modal.style.display = 'none';
|
||||
renderBookmarks();
|
||||
});
|
||||
|
||||
// 点击模态框外部关闭
|
||||
modal.addEventListener('click', function(e) {
|
||||
if (e.target === modal) {
|
||||
modal.style.display = 'none';
|
||||
}
|
||||
});
|
||||
|
||||
// 初始渲染书签
|
||||
renderBookmarks();
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
Loading…
x
Reference in New Issue
Block a user