feat: enhance date and time display with Chinese format; add search engine switcher

- Updated dateTime function to display date and time in Chinese format.
- Introduced setSearchEngine function to switch between Google and Baidu as search engines.
- Added event listener for search engine switching on click.
- Persisted selected search engine in localStorage for user preference.
- Changed weatherBalloon city ID to Beijing, China.
This commit is contained in:
hc 2025-10-21 16:30:52 +08:00
parent 605432f8c5
commit a0cf683699
4 changed files with 228 additions and 34 deletions

View File

@ -8,3 +8,4 @@
@import url('animations.css'); @import url('animations.css');
/* Main Styles */ /* Main Styles */
@import url('styles.css'); @import url('styles.css');
@import url('search.css');

103
css/search.css Normal file
View File

@ -0,0 +1,103 @@
.search-container {
position: relative;
display: flex;
align-items: stretch;
width: 100%;
border-radius: 0.5rem;
overflow: hidden;
}
#search input {
padding-left: 3rem;
padding-right: 1rem;
width: 100%;
border-radius: 0.5rem 0 0 0.5rem;
background-position: none !important;
background-image: none !important;
}
#search-engine-selector {
position: absolute;
left: 0.75rem;
top: 50%;
transform: translateY(-50%);
z-index: 2;
background: transparent;
border: none;
cursor: pointer;
padding: 0.25rem;
display: flex;
align-items: center;
justify-content: center;
border-radius: 0.25rem;
transition: background-color 0.2s ease;
}
#search-engine-selector:hover,
#search-engine-selector:focus {
background-color: hsl(var(--color-white-hsl) / 0.1);
outline: none;
}
#search-engine-selector svg {
width: 1.5rem;
height: 1.5rem;
}
#search-submit {
border: none;
cursor: pointer;
padding: 0;
width: 3rem;
min-width: 3rem;
display: flex;
align-items: center;
justify-content: center;
border-radius: 0 0.5rem 0.5rem 0;
transition: background-color 0.2s ease;
}
#search-submit:hover,
#search-submit:focus {
outline: none;
}
#search-submit svg {
width: 1.25rem;
height: 1.25rem;
}
@media (prefers-color-scheme: dark) {
#search-submit {
background: hsl(var(--color-white-hsl) / 0.1);
color: var(--primary-font-color);
border: 0.125rem solid hsl(var(--color-white-hsl) / 0.25);
border-left: none;
}
#search-submit:hover,
#search-submit:focus {
background-color: hsl(var(--color-white-hsl) / 0.2);
border-color: hsl(var(--color-white-hsl) / 0.5);
}
}
@media (prefers-color-scheme: light) {
#search-submit {
background: hsl(var(--color-black-hsl) / 0.05);
color: var(--primary-font-color);
border: 0.125rem solid hsl(var(--color-black-hsl) / 0.25);
border-left: none;
}
#search-engine-selector:hover,
#search-engine-selector:focus {
background-color: hsl(var(--color-black-hsl) / 0.1);
}
#search-submit:hover,
#search-submit:focus {
background-color: hsl(var(--color-black-hsl) / 0.1);
border-color: hsl(var(--color-black-hsl) / 0.5);
}
}

View File

@ -15,7 +15,7 @@
<link rel="icon" type="image/png" sizes="16x16" href="favicon-16x16.png"> <link rel="icon" type="image/png" sizes="16x16" href="favicon-16x16.png">
<script src="js/main.js"></script> <script src="js/main.js"></script>
<link rel="stylesheet" href="css/main.css"> <link rel="stylesheet" href="css/main.css">
<title>_traichu</title> <title>yuheng</title>
</head> </head>
<body onload="traichu()"> <body onload="traichu()">
<main> <main>
@ -34,86 +34,106 @@
</aside> </aside>
<nav id="dock"> <nav id="dock">
<ul> <ul>
<li><a href="https://mail.google.com"><svg role="img" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><title>Gmail</title><path d="M24 5.457v13.909c0 .904-.732 1.636-1.636 1.636h-3.819V11.73L12 16.64l-6.545-4.91v9.273H1.636A1.636 1.636 0 0 1 0 19.366V5.457c0-2.023 2.309-3.178 3.927-1.964L5.455 4.64 12 9.548l6.545-4.91 1.528-1.145C21.69 2.28 24 3.434 24 5.457z"/></svg></a></li> <li><a href="https://mail.qq.com"><svg role="img" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><title>QQ Mail</title><path d="M24 5.457v13.909c0 .904-.732 1.636-1.636 1.636h-3.819V11.73L12 16.64l-6.545-4.91v9.273H1.636A1.636 1.636 0 0 1 0 19.366V5.457c0-2.023 2.309-3.178 3.927-1.964L5.455 4.64 12 9.548l6.545-4.91 1.528-1.145C21.69 2.28 24 3.434 24 5.457z"/></svg></a></li>
<li><a href="https://calendar.google.com"><svg role="img" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><title>Google Calendar</title><path d="M18.316 5.684H24v12.632h-5.684V5.684zM5.684 24h12.632v-5.684H5.684V24zM18.316 5.684V0H1.895A1.894 1.894 0 0 0 0 1.895v16.421h5.684V5.684h12.632zm-7.207 6.25v-.065c.272-.144.5-.349.687-.617s.279-.595.279-.982c0-.379-.099-.72-.3-1.025a2.05 2.05 0 0 0-.832-.714 2.703 2.703 0 0 0-1.197-.257c-.6 0-1.094.156-1.481.467-.386.311-.65.671-.793 1.078l1.085.452c.086-.249.224-.461.413-.633.189-.172.445-.257.767-.257.33 0 .602.088.816.264a.86.86 0 0 1 .322.703c0 .33-.12.589-.36.778-.24.19-.535.284-.886.284h-.567v1.085h.633c.407 0 .748.109 1.02.327.272.218.407.499.407.843 0 .336-.129.614-.387.832s-.565.327-.924.327c-.351 0-.651-.103-.897-.311-.248-.208-.422-.502-.521-.881l-1.096.452c.178.616.505 1.082.977 1.401.472.319.984.478 1.538.477a2.84 2.84 0 0 0 1.293-.291c.382-.193.684-.458.902-.794.218-.336.327-.72.327-1.149 0-.429-.115-.797-.344-1.105a2.067 2.067 0 0 0-.881-.689zm2.093-1.931l.602.913L15 10.045v5.744h1.187V8.446h-.827l-2.158 1.557zM22.105 0h-3.289v5.184H24V1.895A1.894 1.894 0 0 0 22.105 0zm-3.289 23.5l4.684-4.684h-4.684V23.5zM0 22.105C0 23.152.848 24 1.895 24h3.289v-5.184H0v3.289z"/></svg></a></li> <li><a href="https://calendar.dingtalk.com"><svg role="img" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><title>钉钉日历</title><path d="M18.316 5.684H24v12.632h-5.684V5.684zM5.684 24h12.632v-5.684H5.684V24zM18.316 5.684V0H1.895A1.894 1.894 0 0 0 0 1.895v16.421h5.684V5.684h12.632zm-7.207 6.25v-.065c.272-.144.5-.349.687-.617s.279-.595.279-.982c0-.379-.099-.72-.3-1.025a2.05 2.05 0 0 0-.832-.714 2.703 2.703 0 0 0-1.197-.257c-.6 0-1.094.156-1.481.467-.386.311-.65.671-.793 1.078l1.085.452c.086-.249.224-.461.413-.633.189-.172.445-.257.767-.257.33 0 .602.088.816.264a.86.86 0 0 1 .322.703c0 .33-.12.589-.36.778-.24.19-.535.284-.886.284h-.567v1.085h.633c.407 0 .748.109 1.02.327.272.218.407.499.407.843 0 .336-.129.614-.387.832s-.565.327-.924.327c-.351 0-.651-.103-.897-.311-.248-.208-.422-.502-.521-.881l-1.096.452c.178.616.505 1.082.977 1.401.472.319.984.478 1.538.477a2.84 2.84 0 0 0 1.293-.291c.382-.193.684-.458.902-.794.218-.336.327-.72.327-1.149 0-.429-.115-.797-.344-1.105a2.067 2.067 0 0 0-.881-.689zm2.093-1.931l.602.913L15 10.045v5.744h1.187V8.446h-.827l-2.158 1.557zM22.105 0h-3.289v5.184H24V1.895A1.894 1.894 0 0 0 22.105 0zm-3.289 23.5l4.684-4.684h-4.684V23.5zM0 22.105C0 23.152.848 24 1.895 24h3.289v-5.184H0v3.289z"/></svg></a></li>
<li><a href="https://keep.google.com"><svg role="img" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><title>Google Keep</title><path d="M4.908 0c-.904 0-1.635.733-1.635 1.637v20.726c0 .904.732 1.637 1.635 1.637H19.09c.904 0 1.637-.733 1.637-1.637V6.5h-6.5V0H4.908zm9.819 0v6h6l-6-6zM11.97 8.229c.224 0 .571.031.765.072.2.04.576.185.842.312.828.414 1.467 1.164 1.774 2.088.168.511.188 1.34.05 1.865a3.752 3.752 0 0 1-1.277 1.952l-.25.193h-1.87c-2.134 0-1.931.042-2.478-.494a3.349 3.349 0 0 1-.984-1.844c-.148-.766-.053-1.437.32-2.203.19-.399.303-.556.65-.899.68-.679 1.513-1.037 2.458-1.042zm-1.866 7.863h3.781v1.328h-3.779v-1.328z"/></svg></a></li> <li><a href="https://note.youdao.com"><svg role="img" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><title>有道云笔记</title><path d="M4.908 0c-.904 0-1.635.733-1.635 1.637v20.726c0 .904.732 1.637 1.635 1.637H19.09c.904 0 1.637-.733 1.637-1.637V6.5h-6.5V0H4.908zm9.819 0v6h6l-6-6zM11.97 8.229c.224 0 .571.031.765.072.2.04.576.185.842.312.828.414 1.467 1.164 1.774 2.088.168.511.188 1.34.05 1.865a3.752 3.752 0 0 1-1.277 1.952l-.25.193h-1.87c-2.134 0-1.931.042-2.478-.494a3.349 3.349 0 0 1-.984-1.844c-.148-.766-.053-1.437.32-2.203.19-.399.303-.556.65-.899.68-.679 1.513-1.037 2.458-1.042zm-1.866 7.863h3.781v1.328h-3.779v-1.328z"/></svg></a></li>
<li><a href="https://notion.so"><svg role="img" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><title>Notion</title><path d="M4.459 4.208c.746.606 1.026.56 2.428.466l13.215-.793c.28 0 .047-.28-.046-.326L17.86 1.968c-.42-.326-.981-.7-2.055-.607L3.01 2.295c-.466.046-.56.28-.374.466zm.793 3.08v13.904c0 .747.373 1.027 1.214.98l14.523-.84c.841-.046.935-.56.935-1.167V6.354c0-.606-.233-.933-.748-.887l-15.177.887c-.56.047-.747.327-.747.933zm14.337.745c.093.42 0 .84-.42.888l-.7.14v10.264c-.608.327-1.168.514-1.635.514-.748 0-.935-.234-1.495-.933l-4.577-7.186v6.952L12.21 19s0 .84-1.168.84l-3.222.186c-.093-.186 0-.653.327-.746l.84-.233V9.854L7.822 9.76c-.094-.42.14-1.026.793-1.073l3.456-.233 4.764 7.279v-6.44l-1.215-.139c-.093-.514.28-.887.747-.933zM1.936 1.035l13.31-.98c1.634-.14 2.055-.047 3.082.7l4.249 2.986c.7.513.934.653.934 1.213v16.378c0 1.026-.373 1.634-1.68 1.726l-15.458.934c-.98.047-1.448-.093-1.962-.747l-3.129-4.06c-.56-.747-.793-1.306-.793-1.96V2.667c0-.839.374-1.54 1.447-1.632z"/></svg></a></li> <li><a href="https://notion.so"><svg role="img" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><title>Notion</title><path d="M4.459 4.208c.746.606 1.026.56 2.428.466l13.215-.793c.28 0 .047-.28-.046-.326L17.86 1.968c-.42-.326-.981-.7-2.055-.607L3.01 2.295c-.466.046-.56.28-.374.466zm.793 3.08v13.904c0 .747.373 1.027 1.214.98l14.523-.84c.841-.046.935-.56.935-1.167V6.354c0-.606-.233-.933-.748-.887l-15.177.887c-.56.047-.747.327-.747.933zm14.337.745c.093.42 0 .84-.42.888l-.7.14v10.264c-.608.327-1.168.514-1.635.514-.748 0-.935-.234-1.495-.933l-4.577-7.186v6.952L12.21 19s0 .84-1.168.84l-3.222.186c-.093-.186 0-.653.327-.746l.84-.233V9.854L7.822 9.76c-.094-.42.14-1.026.793-1.073l3.456-.233 4.764 7.279v-6.44l-1.215-.139c-.093-.514.28-.887.747-.933zM1.936 1.035l13.31-.98c1.634-.14 2.055-.047 3.082.7l4.249 2.986c.7.513.934.653.934 1.213v16.378c0 1.026-.373 1.634-1.68 1.726l-15.458.934c-.98.047-1.448-.093-1.962-.747l-3.129-4.06c-.56-.747-.793-1.306-.793-1.96V2.667c0-.839.374-1.54 1.447-1.632z"/></svg></a></li>
<li><a href="https://github.com"><svg role="img" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><title>GitHub</title><path d="M12 .297c-6.63 0-12 5.373-12 12 0 5.303 3.438 9.8 8.205 11.385.6.113.82-.258.82-.577 0-.285-.01-1.04-.015-2.04-3.338.724-4.042-1.61-4.042-1.61C4.422 18.07 3.633 17.7 3.633 17.7c-1.087-.744.084-.729.084-.729 1.205.084 1.838 1.236 1.838 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3-5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523.105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873.12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92.42.36.81 1.096.81 2.22 0 1.606-.015 2.896-.015 3.286 0 .315.21.69.825.57C20.565 22.092 24 17.592 24 12.297c0-6.627-5.373-12-12-12"/></svg></a></li> <li><a href="https://github.com"><svg role="img" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><title>GitHub</title><path d="M12 .297c-6.63 0-12 5.373-12 12 0 5.303 3.438 9.8 8.205 11.385.6.113.82-.258.82-.577 0-.285-.01-1.04-.015-2.04-3.338.724-4.042-1.61-4.042-1.61C4.422 18.07 3.633 17.7 3.633 17.7c-1.087-.744.084-.729.084-.729 1.205.084 1.838 1.236 1.838 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3-5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523.105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873.12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92.42.36.81 1.096.81 2.22 0 1.606-.015 2.896-.015 3.286 0 .315.21.69.825.57C20.565 22.092 24 17.592 24 12.297c0-6.627-5.373-12-12-12"/></svg></a></li>
<li><a href="https://figma.com"><svg role="img" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><title>Figma</title><path d="M15.852 8.981h-4.588V0h4.588c2.476 0 4.49 2.014 4.49 4.49s-2.014 4.491-4.49 4.491zM12.735 7.51h3.117c1.665 0 3.019-1.355 3.019-3.019s-1.355-3.019-3.019-3.019h-3.117V7.51zm0 1.471H8.148c-2.476 0-4.49-2.014-4.49-4.49S5.672 0 8.148 0h4.588v8.981zm-4.587-7.51c-1.665 0-3.019 1.355-3.019 3.019s1.354 3.02 3.019 3.02h3.117V1.471H8.148zm4.587 15.019H8.148c-2.476 0-4.49-2.014-4.49-4.49s2.014-4.49 4.49-4.49h4.588v8.98zM8.148 8.981c-1.665 0-3.019 1.355-3.019 3.019s1.355 3.019 3.019 3.019h3.117V8.981H8.148zM8.172 24c-2.489 0-4.515-2.014-4.515-4.49s2.014-4.49 4.49-4.49h4.588v4.441c0 2.503-2.047 4.539-4.563 4.539zm-.024-7.51a3.023 3.023 0 0 0-3.019 3.019c0 1.665 1.365 3.019 3.044 3.019 1.705 0 3.093-1.376 3.093-3.068v-2.97H8.148zm7.704 0h-.098c-2.476 0-4.49-2.014-4.49-4.49s2.014-4.49 4.49-4.49h.098c2.476 0 4.49 2.014 4.49 4.49s-2.014 4.49-4.49 4.49zm-.097-7.509c-1.665 0-3.019 1.355-3.019 3.019s1.355 3.019 3.019 3.019h.098c1.665 0 3.019-1.355 3.019-3.019s-1.355-3.019-3.019-3.019h-.098z"/></svg></a></li>
<li><a href="https://soccerstreams.net"><svg role="img" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><title>Premier League</title><path d="M11.176 0s-.681 1.938-.867 2.527C9.844 2.202 8.386 1.194 7.78.775c.14.806.356 2.124.403 2.403-.124-.093-.821-.698-1.875-1.194.589.682 1.008 1.736 1.271 2.588a10.566 10.566 0 0 1 5.238-1.379c.977 0 1.94.14 2.854.403.093-.884.279-1.968.682-2.758-.915.728-1.474 1.503-1.551 1.596-.031-.186-.093-1.52-.17-2.434-.372.403-1.8 2.016-2.063 2.264C12.384 1.938 11.176 0 11.176 0zm1.674 3.86c-1.674 0-3.3.386-4.696 1.115.713.046 1.224.668 1.395 1.164-.558-.45-1.442-.667-1.985-.078-.511.589-.464 1.688.047 2.572-1.193-.605-1.194-2.185-.775-2.867A10.392 10.392 0 0 0 3.61 9.594l1.07.172c-1.24 1.426-2.107 3.953-2.107 5.146l1.75-.543c-.31 1.054-.401 4.602.653 6.385 0 0 1.38-.96 2.945-3.363.65 2.17.356 3.985 0 5.767 2.82 1.581 6.09.696 8.012-.683l.357 1.35c2.248-1.489 3.488-3.628 3.72-6.124l.837.93c1.286-3.829.28-6.883-1.565-9.502l-.078.637-.79-.87s.17-.077.31-.263c.03-.078-.046-.495-.371-.774-.31.078-.56.264-.684.45a3.222 3.222 0 0 0-.93-.543c.062.077.604.79.65 1.007.466.388 1.102.837 1.52 1.395-.34-.403-1.984-.497-2.728-.078 0 0-.744-.868-1.426-1.473-.14-.511.326-.96.326-.96s-.48-.03-.93.42c-.682-.512-1.55-.745-1.55-.745-.961.14-1.612.82-1.612.82.217.14.512.327.776.42.511.217 1.006.139 1.332.139.263 0 .636.078.636.078s.635.495 1.565 1.565c-1.426-.574-2.915.062-3.969-.45-1.24-.62-1.146-1.595-1.146-1.595s-.836-.11-.836-.141c0 0 .618-.82 1.548-1.1l-.464-.402c.558-.465 1.534-1.085 3.115-1.24 0 0 .683.262 2.11 1.285.232-.326.308-1.008.308-1.008.728.248 2.217 1.333 2.806 1.984-.325-.759-.559-1.223-.636-2.013-.357-.357-1.24-1.101-3.069-1.551.295.605.264 1.115.264 1.115-.34-.45-1.055-1.146-1.55-1.332-.295-.015-.605-.047-.93-.047zm3.271 7.068a4.323 4.323 0 0 0 1.256.697v1.348c-.465.403-1.985 1.675-3.008 1.566-.573-1.1-1.115-2.107-1.115-2.107s1.565-1.318 2.867-1.504zm2.975.031c.465 1.131.59 2.48.078 3.379-.28-.605-.636-.947-1.008-1.35v-1.347s.418-.264.93-.682zm-.977 3.395c.465.511.559 1.068.559 1.068-.202 1.131-.836 1.846-1.301 2.14.046-.821-.172-1.519-.172-1.519-.34.372-1.13.743-1.596.836l-.697-1.3c.822-.032 2.201-1.194 2.201-1.194l1.006-.031z"/></svg></a></li>
<li><a href="https://formula1stream.cc"><svg role="img" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><title>F1</title><path d="M9.6 11.24h7.91L19.75 9H9.39c-2.85 0-3.62.34-5.17 1.81C2.71 12.3 0 15 0 15h3.38c.77-.75 2.2-2.13 2.85-2.75.92-.87 1.37-1.01 3.37-1.01zM20.39 9l-6 6H18l6-6h-3.61zm-3.25 2.61H9.88c-2.22 0-2.6.12-3.55 1.07C5.44 13.57 4 15 4 15h3.15l.75-.75c.49-.49.75-.55 1.78-.55h5.37l2.09-2.09z"/></svg></a></li>
<li><a href="https://mlbstreams.to"><svg role="img" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><title>MLB</title><path d="M22.003 5.53a1.988 1.988 0 011.99 1.827l.007.177v8.927a2.007 2.007 0 01-1.848 2.002l-.15.006H2.002a2.003 2.003 0 01-1.42-.586 1.979 1.979 0 01-.575-1.245L0 16.46V7.535a1.994 1.994 0 01.583-1.427 2.016 2.016 0 011.242-.57l.176-.007h20.002zm-7.5.703H2.001a1.312 1.312 0 00-.926.375 1.299 1.299 0 00-.374.926v8.927a1.282 1.282 0 00.374.922c.246.245.579.383.926.384h8.116a92.275 92.275 0 00-.495-.843H8.66c0-2.402.812-3.73 1.784-3.995.133-.024.07-.68-.1-.88h-.561c-.09 0-.038-.169-.038-.169l.456-.972-.062-.266H8.455l1.383-.967c.064-2.55 2.68-2.748 4.255-1.686.937.62 1.008 1.849.937 2.698-.012.054-.244.018-.244.018s-.16.937.257.937h1.838c.749-.03 1.472.478 1.472.478l.176-.643-4.026-5.244zm7.5 0h-5.59l3.207 5.36.296.038.187.245v.229l.202.041.188.255v.221l.21.037.211.23v.51c.252.228.536.418.843.563.283.108.315.562.486.803.213.352.505.493.444.69-.143.526-.682 1.414-1.184 1.456h-1.986v.85h2.488a1.3 1.3 0 001.294-1.311V7.534h-.002a1.285 1.285 0 00-1.294-1.3zM4.022 14.404a.888.888 0 01-.638 1.513.879.879 0 01-.88-.888.888.888 0 011.518-.625z"/></svg></a></li>
<li><a href="https://nhlbite.com"><svg role="img" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><title>NHL</title><path d="M19.35,9.5c.15-.62-.2-1.14-.54-1.47h3.24s-1.44,6.26-1.44,6.26h3.38c-.11,.33-.27,.89-.37,1.7h-5.77l1.5-6.49Z"/><path d="M1.52,9.51c.15-.62-.19-1.14-.53-1.47h3.13s2.07,5.09,2.07,5.09l1.2-5.1h2.31l-1.87,7.96h-2.59l-1.87-4.54-1.07,4.55H0l1.52-6.49Z"/><path d="M10.64,9.51c.14-.63-.2-1.14-.54-1.48h3.24s-.71,3.1-.71,3.1h2.77s.71-3.12,.71-3.12h2.24s-1.83,7.95-1.83,7.95h-2.24l.7-3.08h-2.77s-.7,3.09-.7,3.09h-2.37l1.49-6.46Z"/></svg></a></li>
<li><a href="https://nbabite.com"><svg role="img" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><title>NBA</title><path d="M9.19 0a2.486 2.486 0 0 0-2.485 2.484v19.029A2.488 2.488 0 0 0 9.19 24h5.615a2.493 2.493 0 0 0 2.49-2.487V2.484A2.488 2.488 0 0 0 14.81 0zm0 .584h3.21c-.62.237-.707.508-.73 1.366-.105.01-.325-.087-.25.434 0 0 .043.346.18.286-.133.918.023.99-.93 1.031l-.047.067c-.95.093-1.25-.027-2.05 1.603 0 0-.207.505-.268.714-.197.415-.674 1.328-.819 1.919-.046.2-.14.264-.01.553.185.417-.124.527.95.496V9.3s-.286.247-.346.398c-.061.147-.226.89-.22 1.237.019.917.767 1.683.992 2.597l.492.07c.282.634 1.495 2.355 1.743 2.582.057.159.365.355.545.551.149.141 1.025 1.1 2.054 1.692-.007-.001.164.344.249.618-.342.275.32.777.52 1.609.012.107-.19.222.114.495-.022 1.256-.402 1.918.241 2.266H9.191a1.9 1.9 0 0 1-1.9-1.901V2.486a1.9 1.9 0 0 1 1.9-1.902zm3.804.002h1.815a1.9 1.9 0 0 1 1.897 1.898v9.193a1.653 1.653 0 0 0-.22-.397c0-.255-.272-.249-.346-.344-.07-.081.067-.128-.407-.235-.09-.05-.158-.747-.158-.747-.07-.447-.229-.754-.467-1.227-.12-.243-.177-1.001-.305-1.386.071-1.767-.493-2.28-.95-2.569-.174-.11-.262-.191-.433-.29l-.005-.082c-.133-.126-.402-.264-.623-.362-.068-.07-.037-.22.01-.276.15-.02.348-.356.513-.703.129.009.174-.118.214-.19.138-.222.288-.413.096-.542.435-.777.154-1.301-.08-1.321-.095-.195-.26-.316-.551-.42zm.551 6.338c.06.319.34 1.929.456 2.187.123.259.535 1.05.73 1.54a1.69 1.69 0 0 0-1.294 1.646 1.692 1.692 0 0 0 1.693 1.691 1.692 1.692 0 0 0 1.576-1.066v8.59a1.887 1.887 0 0 1-1.598 1.877h-.017c.833-.502.319-1.46.16-2.022-.012-.033.014-.074.026-.1.045-.08-.045-.257-.045-.257-.098-.09-.127-.561-.182-.772-.089-.358.157-.971.157-1.18 0-.206-.156-.491-.445-.858-.069-.078-.276-1.86-.462-2.313-.258-.623-.339-.526-.64-1.266-.24-.525-.055-1.295-.59-3.085.005.006.12-.113.12-.113s-.422-1.55-.561-1.975c-.14-.426-.385-.456-.385-.456s.002-.172.012-.216c.02-.07.516-1.367.558-1.407.001-.03.717-.514.731-.445Z"/></svg></a></li>
<li><a href="https://mmastreams.cc"><svg role="img" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><title>UFC</title><path d="M6.308 7.843h2.797s-1.86 6.639-1.951 6.998c-.177.69-.353 1.316-2.043 1.316-2.037 0-3.22-.007-3.777 0-.698.007-1.521-.633-1.296-1.464l1.91-6.85H4.8S3.2 13.553 3.166 13.7c-.029.148-.19.557.698.564.64.014.69-.155.803-.564.268-.922 1.64-5.857 1.64-5.857zm10.272 0l-.507 1.824H9.986l.507-1.824zm-8.404 8.314l1.459-5.244h6.086l-.507 1.823h-3.262l-.95 3.421zm11.47-5.385c-.26.957-.493 1.774-.754 2.738-.05.17-.162.416-.127.57.078.367 1.29.226 1.726.226h1.945c-.155.612-.33 1.21-.5 1.81h-4.63c-.676-.064-1.557-.353-1.472-1.226.028-.274.156-.584.24-.887a1189.7 1189.7 0 001.24-4.463c.176-.648.317-1.197.83-1.457.333-.17.861-.218 1.255-.24H24c-.162.606-.331 1.211-.5 1.81h-2.643c-.317 0-.669-.036-.845.084-.19.141-.295.775-.366 1.035z"/></svg></a></li>
</ul> </ul>
</nav> </nav>
<section id="search"> <section id="search">
<h2 class="sr-only">Search</h2> <h2 class="sr-only">Search</h2>
<form action="https://duckduckgo.com/" method="get"> <form id="search-form" action="https://www.baidu.com/s" method="get">
<input type="text" id="q" name="q" autofocus> <div class="search-container">
<button class="sr-only" tabindex="-1">Search</button> <button type="button" id="search-engine-selector" aria-label="切换搜索引擎" title="点击切换搜索引擎" data-engine="baidu">
<svg class="baidu-icon" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 64 64" fill="#3245DF" aria-hidden="true">
<path d="M11.518 33.724c6.957-1.495 6.012-9.8 5.802-11.63-.342-2.803-3.638-7.7-8.113-7.313-5.63.505-6.454 8.64-6.454 8.64-.753 3.763 1.823 11.8 8.765 10.303zm12.917-13.947c3.842 0 6.948-4.423 6.948-9.892C31.383 4.422 28.277 0 24.435 0s-6.952 4.422-6.952 9.885c0 5.47 3.114 9.892 6.952 9.892zm16.55.653c5.138.667 8.44-4.815 9.097-8.97.67-4.15-2.644-8.97-6.28-9.798-3.645-.835-8.195 5.002-8.6 8.808-.496 4.653.666 9.3 5.793 9.96zm20.363 6.977c0-1.987-1.65-7.974-7.775-7.974-6.137 0-6.954 5.65-6.954 9.643 0 3.812.32 9.132 7.94 8.963s6.787-8.633 6.787-10.633zM18.906 48.2c-.203.585-.66 2.08-.265 3.382a3.844 3.844 0 003.314 3.052H25.6v-8.908h-3.902a4.28 4.28 0 00-2.791 2.473zm34.668-3.334s-7.948-6.148-12.588-12.795c-6.288-9.8-15.224-5.8-18.212-.828-2.975 4.983-7.612 8.135-8.272 8.97-.666.822-9.6 5.643-7.615 14.452 1.98 8.802 8.945 8.633 8.945 8.633a39.04 39.04 0 0011.088-.828 23.39 23.39 0 0111.085.33s13.913 4.66 17.72-4.312-2.15-13.622-2.15-13.622zm-23.807 13.35h-9.045c-3.905-.778-5.462-3.444-5.66-3.9-.192-.46-1.298-2.603-.713-6.248 1.688-5.463 6.504-5.855 6.504-5.855h4.814v-5.918l4.1.062zm16.846-.062h-10.4C32.18 57.114 32 54.248 32 54.248v-11.5l4.223-.068v10.347c.258 1.103 1.63 1.3 1.63 1.3h4.3v-11.58h4.5z"/>
</svg>
<svg class="google-icon" viewBox="0 0 24 24" aria-hidden="true" style="display:none;">
<path fill="#4285F4" d="M22.56 12.25c0-.78-.07-1.53-.2-2.25H12v4.26h5.92c-.26 1.37-1.04 2.53-2.21 3.31v2.77h3.57c2.08-1.92 3.28-4.74 3.28-8.09z"/>
<path fill="#34A853" d="M12 23c2.97 0 5.46-.98 7.28-2.66l-3.57-2.77c-.98.66-2.23 1.06-3.71 1.06-2.86 0-5.29-1.93-6.16-4.53H2.18v2.84C3.99 20.53 7.7 23 12 23z"/>
<path fill="#FBBC05" d="M5.84 14.09c-.22-.66-.35-1.36-.35-2.09s.13-1.43.35-2.09V7.07H2.18C1.43 8.55 1 10.22 1 12s.43 3.45 1.18 4.93l2.85-2.22.81-.62z"/>
<path fill="#EA4335" d="M12 5.38c1.62 0 3.06.56 4.21 1.64l3.15-3.15C17.45 2.09 14.97 1 12 1 7.7 1 3.99 3.47 2.18 7.07l3.66 2.84c.87-2.6 3.3-4.53 6.16-4.53z"/>
</svg>
</button>
<input type="text" id="search-input" name="wd" autofocus>
<button type="submit" id="search-submit" aria-label="搜索">
<svg viewBox="0 0 24 24" aria-hidden="true">
<path fill="currentColor" d="M15.5 14h-.79l-.28-.27C15.41 12.59 16 11.11 16 9.5 16 5.91 13.09 3 9.5 3S3 5.91 3 9.5 5.91 16 9.5 16c1.61 0 3.09-.59 4.23-1.57l.27.28v.79l5 4.99L20.49 19l-4.99-5zm-6 0C7.01 14 5 11.99 5 9.5S7.01 5 9.5 5 14 7.01 14 9.5 11.99 14 9.5 14z"/>
</svg>
</button>
</div>
</form> </form>
</section> </section>
<section id="bookmarks"> <section id="bookmarks">
<h2 class="sr-only">Bookmarks</h2> <h2 class="sr-only">Bookmarks</h2>
<ul> <ul>
<li> <li>
<a href="https://news.ycombinator.com"><img src="https://icons.duckduckgo.com/ip3/news.ycombinator.com.ico" class="favicon" alt="HackerNews favicon">HackerNews</a> <a href="https://www.zhihu.com"><img src="https://static.zhihu.com/heifetz/favicon.ico" class="favicon" alt="知乎 favicon">知乎</a>
</li> </li>
<li> <li>
<a href="https://www.reddit.com"><img src="https://icons.duckduckgo.com/ip3/reddit.com.ico" class="favicon" alt="Reddit favicon">Reddit</a> <a href="https://www.xiaohongshu.com"><img src="https://www.xiaohongshu.com/favicon.ico" class="favicon" alt="小红书 favicon">小红书</a>
</li> </li>
<li> <li>
<a href="https://twitter.com"><img src="https://icons.duckduckgo.com/ip3/twitter.com.ico" class="favicon" alt="Twitter favicon">Twitter</a> <a href="https://tieba.baidu.com"><img src="https://tieba.baidu.com/favicon.ico" class="favicon" alt="贴吧 favicon">贴吧</a>
</li>
<li>
<a href="https://www.douyin.com"><img src="https://www.douyin.com/favicon.ico" class="favicon" alt="抖音 favicon">抖音</a>
</li>
<li>
<a href="https://weibo.com"><img src="https://weibo.com/favicon.ico" class="favicon" alt="微博 favicon">微博</a>
</li> </li>
</ul> </ul>
<ul> <ul>
<li> <li>
<a href="https://apnews.com"><img src="https://icons.duckduckgo.com/ip3/apnews.com.ico" class="favicon" alt="Associated Press favicon">Associated Press</a> <a href="https://www.dgtle.com"><img src="https://www.dgtle.com/favicon.ico" class="favicon" alt="数字尾巴 favicon">数字尾巴</a>
</li> </li>
<li> <li>
<a href="https://www.reuters.com"><img src="https://icons.duckduckgo.com/ip3/reuters.com.ico" class="favicon" alt="Reuters favicon">Reuters</a> <a href="https://www.ifanr.com"><img src="https://www.ifanr.com/favicon.ico" class="favicon" alt="爱范儿 favicon">爱范儿</a>
</li> </li>
<li> <li>
<a href="https://www.supercluster.com"><img src="https://icons.duckduckgo.com/ip3/supercluster.com.ico" class="favicon" alt="Supercluster favicon">Supercluster</a> <a href="https://jandan.net"><img src="https://jandan.net/favicon.ico" class="favicon" alt="煎蛋 favicon">煎蛋</a>
</li> </li>
<li> <li>
<a href="https://www.smithsonianmag.com"><img src="https://icons.duckduckgo.com/ip3/smithsonianmag.org.ico" class="favicon" alt="Smithsonian Magazine favicon">Smithsonian Magazine</a> <a href="https://www.hupu.com"><img src="https://www.hupu.com/favicon.ico" class="favicon" alt="虎扑社区 favicon">虎扑社区</a>
</li> </li>
<li> <li>
<a href="https://publicdomainreview.org"><img src="https://icons.duckduckgo.com/ip3/publicdomainreview.org.ico" class="favicon" alt="The Public Domain Review favicon">Public Domain Review</a> <a href="https://jike.city"><img src="https://jike.city/favicon.ico" class="favicon" alt="即刻 favicon">即刻</a>
</li> </li>
</ul> </ul>
<ul> <ul>
<li> <li>
<a href="https://app.plex.tv"><img src="https://icons.duckduckgo.com/ip3/plex.tv.ico" class="favicon" alt="Plex favicon">Plex</a> <a href="https://www.iqiyi.com"><img src="https://www.iqiyi.com/favicon.ico" class="favicon" alt="爱奇艺 favicon">爱奇艺</a>
</li> </li>
<li> <li>
<a href="https://www.youtube.com"><img src="https://icons.duckduckgo.com/ip3/youtube.com.ico" class="favicon" alt="YouTube favicon">YouTube</a> <a href="https://www.bilibili.com"><img src="https://www.bilibili.com/favicon.ico" class="favicon" alt="哔哩哔哩 favicon">哔哩哔哩</a>
</li> </li>
<li> <li>
<a href="https://www.twitch.tv"><img src="https://icons.duckduckgo.com/ip3/twitch.tv.ico" class="favicon" alt="Twitch favicon">Twitch</a> <a href="https://www.douyu.com"><img src="https://www.douyu.com/favicon.ico" class="favicon" alt="斗鱼 favicon">斗鱼</a>
</li> </li>
<li> <li>
<a href="https://open.spotify.com"><img src="https://icons.duckduckgo.com/ip3/spotify.com.ico" class="favicon" alt="Spotify favicon">Spotify</a> <a href="https://music.163.com"><img src="https://music.163.com/favicon.ico" class="favicon" alt="网易云音乐 favicon">网易云音乐</a>
</li> </li>
</ul> </ul>
<ul> <ul>
<li> <li>
<a href="https://www.cardsphere.com"><img src="https://icons.duckduckgo.com/ip3/cardsphere.com.ico" class="favicon" alt="Cardsphere favicon">Cardsphere</a> <a href="https://fanyi.baidu.com"><img src="https://fanyi.baidu.com/favicon.ico" class="favicon" alt="百度翻译 favicon">百度翻译</a>
</li> </li>
<li> <li>
<a href="https://cubecobra.com"><img src="https://icons.duckduckgo.com/ip3/cubecobra.com.ico" class="favicon" alt="CubeCobra favicon">Cube Cobra</a> <a href="https://map.baidu.com"><img src="https://map.baidu.com/favicon.ico" class="favicon" alt="百度地图 favicon">百度地图</a>
</li> </li>
<li> <li>
<a href="https://deckbox.org"><img src="https://icons.duckduckgo.com/ip3/deckbox.org.ico" class="favicon" alt="Deckbox favicon">Deckbox</a> <a href="https://cowtransfer.com"><img src="https://cowtransfer.com/favicon.ico" class="favicon" alt="文件传输助手 favicon">文件传输助手</a>
</li> </li>
<li> <li>
<a href="https://www.moxfield.com"><img src="https://icons.duckduckgo.com/ip3/moxfield.com.ico" class="favicon" alt="Moxfield favicon">Moxfield</a> <a href="https://convertio.co"><img src="https://convertio.co/favicon.ico" class="favicon" alt="在线转换 favicon">在线转换</a>
</li> </li>
<li> <li>
<a href="https://scryfall.com"><img src="https://icons.duckduckgo.com/ip3/scryfall.com.ico" class="favicon" alt="Scryfall favicon">Scryfall</a> <a href="https://www.lanzou.com"><img src="https://www.lanzou.com/favicon.ico" class="favicon" alt="文件分享 favicon">文件分享</a>
</li>
<li>
<a href="https://www.kuaidi100.com"><img src="https://www.kuaidi100.com/favicon.ico" class="favicon" alt="快递查询 favicon">快递查询</a>
</li> </li>
</ul> </ul>
</section> </section>

View File

@ -1,7 +1,23 @@
function dateTime() { function dateTime() {
const date = new Date(); const date = new Date();
let today = date.toDateString();
let time = date.toLocaleTimeString(); // 中文日期格式
const year = date.getFullYear();
const month = date.getMonth() + 1;
const day = date.getDate();
const weekDays = ['星期日', '星期一', '星期二', '星期三', '星期四', '星期五', '星期六'];
const weekDay = weekDays[date.getDay()];
const today = `${year}${month}${day}${weekDay}`;
// 中文时间格式
const time = date.toLocaleTimeString('zh-CN', {
hour12: false,
hour: '2-digit',
minute: '2-digit',
second: '2-digit'
});
document.getElementById('date-time').innerHTML = '<p id="date">' + today + '</p><p id="time">' + time + '</p>'; document.getElementById('date-time').innerHTML = '<p id="date">' + today + '</p><p id="time">' + time + '</p>';
setTimeout(dateTime, 1000); setTimeout(dateTime, 1000);
} }
@ -21,7 +37,61 @@ function weatherBalloon(cityID) {
}); });
} }
function setSearchEngine(engine) {
const searchForm = document.getElementById('search-form');
const searchInput = document.getElementById('search-input');
const searchEngineSelector = document.getElementById('search-engine-selector');
const baiduIcon = searchEngineSelector?.querySelector('.baidu-icon');
const googleIcon = searchEngineSelector?.querySelector('.google-icon');
if (!searchForm || !searchInput || !searchEngineSelector || !baiduIcon || !googleIcon) {
return;
}
if (engine === 'google') {
searchEngineSelector.dataset.engine = 'google';
searchEngineSelector.setAttribute('aria-label', '当前搜索引擎Google点击切换至 Baidu');
searchEngineSelector.setAttribute('title', '当前Google点击切换至 Baidu');
searchForm.action = 'https://www.google.com/search';
searchInput.name = 'q';
baiduIcon.style.display = 'none';
googleIcon.style.display = 'block';
} else {
searchEngineSelector.dataset.engine = 'baidu';
searchEngineSelector.setAttribute('aria-label', '当前搜索引擎Baidu点击切换至 Google');
searchEngineSelector.setAttribute('title', '当前Baidu点击切换至 Google');
searchForm.action = 'https://www.baidu.com/s';
searchInput.name = 'wd';
baiduIcon.style.display = 'block';
googleIcon.style.display = 'none';
}
try {
localStorage.setItem('searchEngine', searchEngineSelector.dataset.engine);
} catch (error) {
// Ignore storage errors (e.g., disabled storage)
}
searchInput.focus();
}
function switchSearchEngine() {
const searchEngineSelector = document.getElementById('search-engine-selector');
const nextEngine = (searchEngineSelector?.dataset.engine || 'baidu') === 'baidu' ? 'google' : 'baidu';
setSearchEngine(nextEngine);
}
function traichu() { function traichu() {
dateTime(); dateTime();
weatherBalloon(1850147); //OpenWeather city ID weatherBalloon(1816670); //OpenWeather city ID - Beijing, China
const selector = document.getElementById('search-engine-selector');
if (selector) {
selector.addEventListener('click', switchSearchEngine);
let savedEngine = null;
try {
savedEngine = localStorage.getItem('searchEngine');
} catch (error) {
savedEngine = null;
}
setSearchEngine(savedEngine === 'google' ? 'google' : 'baidu');
}
} }