diff --git a/.env b/.env new file mode 100644 index 0000000..f4854ad --- /dev/null +++ b/.env @@ -0,0 +1,2 @@ +# 搜索框提示词 +VITE_INPUT_TIP = "想要搜点什么" \ No newline at end of file diff --git a/.gitignore b/.gitignore index 600d2d3..a547bf3 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,24 @@ -.vscode \ No newline at end of file +# Logs +logs +*.log +npm-debug.log* +yarn-debug.log* +yarn-error.log* +pnpm-debug.log* +lerna-debug.log* + +node_modules +dist +dist-ssr +*.local + +# Editor directories and files +.vscode/* +!.vscode/extensions.json +.idea +.DS_Store +*.suo +*.ntvs* +*.njsproj +*.sln +*.sw? diff --git a/.vscode/extensions.json b/.vscode/extensions.json new file mode 100644 index 0000000..c0a6e5a --- /dev/null +++ b/.vscode/extensions.json @@ -0,0 +1,3 @@ +{ + "recommendations": ["Vue.volar", "Vue.vscode-typescript-vue-plugin"] +} diff --git a/README.md b/README.md index f18edee..240bdb2 100644 --- a/README.md +++ b/README.md @@ -5,12 +5,13 @@ ![Snavigation.png](https://s2.loli.net/2022/07/15/FE6U2BJCynHDep8.jpg) ->尚未完成 +> 重构中,尚未完成 ### Demo ->由于 CDN 缓存原因,查看最新效果可能需要 `Ctrl` + `F5` 强制刷新浏览器缓存 +> 由于 `CDN` 缓存原因,查看最新效果可能需要 `Ctrl` + `F5` 强制刷新浏览器缓存 -- [Snavigation](https://snavigation.vercel.app/) +- [Snavigation](https://nav.imsyy.top) +- [Snavigation Dev](https://snavigation.vercel.app) ### 功能 @@ -23,22 +24,50 @@ - [x] 移动端适配 * [ ] 还没想好呢 -### 插件 +### 部署 -* [iziToast](https://izitoast.marcelodolza.com/) -* [Iconfont](https://www.iconfont.cn/) -* [jQuery](https://jquery.com/) +* **安装** [node.js](https://nodejs.org/zh-cn/) **环境** + + > node > 16.16.0 + > npm > 8.15.0 + +* 然后以 **管理员权限** 运行 `cmd` 终端,并 `cd` 到 项目根目录 +* 在 `终端` 中输入: + +```bash +# 安装 pnpm +npm install -g pnpm + +# 安装依赖 +pnpm install + +# 开发 +pnpm dev + +# 构建 +pnpm build +``` +> 构建完成后,静态资源会在 **`dist` 目录** 中生成,可将 **`dist` 文件夹下的文件**上传至服务器, +> 也可使用 [Vercel](https://vercel.com/) 或 [Cloudflare Pages](https://pages.cloudflare.com/) 等托管平台一键自动部署 + + +### 技术栈 + +* [Vue](https://cn.vuejs.org/) +* [Vite](https://vitejs.cn/vite3-cn/) +* [Pinia](https://pinia.vuejs.org/zh/) +* [iconfont](https://www.iconfont.cn/) ### API * [小歪 API](https://api.ixiaowai.cn/) -* [天气 API](https://www.tianqiapi.com/) +* [缙哥哥 API](https://www.dujin.org/3618.html) +* [Hitokoto 一言](https://hitokoto.cn/) ### 鸣谢 -本站部分内容参考自 +本站部分样式及功能参考自 * [青柠起始页](https://limestart.cn/) -* [sou2](https://github.com/yeetime/sou2/)    diff --git a/css/animation.css b/css/animation.css deleted file mode 100644 index f0365a1..0000000 --- a/css/animation.css +++ /dev/null @@ -1,202 +0,0 @@ -/*渐入动画*/ -@keyframes fade { - 0% { - opacity: 0; - } - - 100% { - opacity: 1; - } -} - -@-webkit-keyframes fade { - 0% { - opacity: 0; - } - - 100% { - opacity: 1; - } -} - -@-moz-keyframes fade { - 0% { - opacity: 0; - } - - 100% { - opacity: 1; - } -} - -@-o-keyframes fade { - 0% { - opacity: 0; - } - - 100% { - opacity: 1; - } -} - -/*文字闪烁*/ -@-webkit-keyframes fadenum { - - 0% { - opacity: 1; - } - - 50% { - opacity: 0; - } - - 100% { - opacity: 1; - } - -} - -@-moz-keyframes fadenum { - - 0% { - opacity: 1; - } - - 50% { - opacity: 0; - } - - 100% { - opacity: 1; - } - -} - -@-o-keyframes fadenum { - - 0% { - opacity: 1; - } - - 50% { - opacity: 0; - } - - 100% { - opacity: 1; - } - -} - -@keyframes fadenum { - - 0% { - opacity: 1; - } - - 50% { - opacity: 0; - } - - 100% { - opacity: 1; - } - -} - -/*下沉动画*/ -@-moz-keyframes down { - 0% { - opacity: 0; - top: 44%; - /* -webkit-transform: translateY(-25%); - -moz-transform: translateY(-25%); - -o-transform: translateY(-25%); - -ms-transform: translateY(-25%); - transform: translateY(-25%) */ - } - - 100% { - opacity: 1; - -ms-filter: none; - filter: none; - top: 46%; - /* -webkit-transform: translateY(-20%); - -moz-transform: translateY(-20%); - -o-transform: translateY(-20%); - -ms-transform: translateY(-20%); - transform: translateY(-20%) */ - } -} - -@-webkit-keyframes down { - 0% { - opacity: 0; - top: 44%; - /* -webkit-transform: translateY(-25%); - -moz-transform: translateY(-25%); - -o-transform: translateY(-25%); - -ms-transform: translateY(-25%); - transform: translateY(-25%) */ - } - - 100% { - opacity: 1; - -ms-filter: none; - filter: none; - top: 46%; - /* -webkit-transform: translateY(-20%); - -moz-transform: translateY(-20%); - -o-transform: translateY(-20%); - -ms-transform: translateY(-20%); - transform: translateY(-20%) */ - } -} - -@-o-keyframes down { - 0% { - opacity: 0; - top: 44%; - /* -webkit-transform: translateY(-25%); - -moz-transform: translateY(-25%); - -o-transform: translateY(-25%); - -ms-transform: translateY(-25%); - transform: translateY(-25%) */ - } - - 100% { - opacity: 1; - -ms-filter: none; - filter: none; - top: 46%; - /* -webkit-transform: translateY(-20%); - -moz-transform: translateY(-20%); - -o-transform: translateY(-20%); - -ms-transform: translateY(-20%); - transform: translateY(-20%) */ - } -} - -@keyframes down { - 0% { - opacity: 0; - top: 44%; - /* -webkit-transform: translateY(-25%); - -moz-transform: translateY(-25%); - -o-transform: translateY(-25%); - -ms-transform: translateY(-25%); - transform: translateY(-25%) */ - } - - 100% { - opacity: 1; - -ms-filter: none; - filter: none; - top: 46%; - /* -webkit-transform: translateY(-20%); - -moz-transform: translateY(-20%); - -o-transform: translateY(-20%); - -ms-transform: translateY(-20%); - transform: translateY(-20%) */ - } -} \ No newline at end of file diff --git a/css/font.css b/css/font.css deleted file mode 100644 index 4a23c99..0000000 --- a/css/font.css +++ /dev/null @@ -1,92 +0,0 @@ -@font-face { - font-family: "MiSans"; - src: url('../font/MiSans-Regular.subset.woff2') format('woff'); -} - -@font-face { - font-family: "iconfont"; - /* Project id 3222465 */ - src: url('../font/iconfont.woff2') format('woff2'), - url('../font/iconfont.woff') format('woff'), - url('../font/iconfont.ttf') format('truetype'); -} - -.iconfont { - font-family: "iconfont" !important; - font-size: 16px; - font-style: normal; - -webkit-font-smoothing: antialiased; - -moz-osx-font-smoothing: grayscale; -} - -.icon-tianjia-:before { - content: "\e643"; -} - -.icon-taobao:before { - content: "\e755"; -} - -.icon-jingdong:before { - content: "\e618"; -} - -.icon-xinlangweibo:before { - content: "\e601"; -} - -.icon-zhihu:before { - content: "\e60a"; -} - -.icon-github:before { - content: "\e691"; -} - -.icon-delete:before { - content: "\e94d"; -} - -.icon-home:before { - content: "\e964"; -} - -.icon-xiugai:before { - content: "\e626"; -} - -.icon-bilibilidonghua:before { - content: "\e8b1"; -} - -.icon-wangluo:before { - content: "\e600"; -} - -.icon-sougousousuo:before { - content: "\e685"; -} - -.icon-360sousuo:before { - content: "\e64d"; -} - -.icon-baidu:before { - content: "\eb49"; -} - -.icon-bing:before { - content: "\eb4c"; -} - -.icon-google:before { - content: "\ebaa"; -} - -.icon-shezhi:before { - content: "\e634"; -} - -.icon-sousuo:before { - content: "\e635"; -} \ No newline at end of file diff --git a/css/loading.css b/css/loading.css deleted file mode 100644 index 32683d3..0000000 --- a/css/loading.css +++ /dev/null @@ -1,127 +0,0 @@ -@charset "utf-8"; - -#loading-box .loading-left-bg, -#loading-box .loading-right-bg { - position: fixed; - z-index: 999998; - width: 50%; - height: 100%; - background-color: rgb(81 81 81 / 80%); - transition: all 0.7s cubic-bezier(0.42, 0, 0, 1.01); - backdrop-filter: blur(10px); -} - -#loading-box .loading-right-bg { - right: 0; -} - -#loading-box>.spinner-box { - position: fixed; - z-index: 999999; - display: flex; - justify-content: center; - align-items: center; - width: 100%; - height: 100vh; -} - -#loading-box .spinner-box .loading-word { - position: absolute; - color: #ffffff; - font-size: 0.95rem; - transform: translateY(64px); - text-align: center; -} - -p.loading-title { - font-size: 1.25rem; - margin: 20px 10px 4px 10px; -} - -#loading-box .spinner-box .configure-core { - width: 100%; - height: 100%; - background-color: #37474f; -} - -div.loaded div.loading-left-bg { - transform: translate(-100%, 0); -} - -div.loaded div.loading-right-bg { - transform: translate(100%, 0); -} - -div.loaded div.spinner-box { - display: none !important; -} - -.loader { - position: absolute; - top: calc(50% - 32px); - left: calc(50% - 32px); - width: 64px; - height: 64px; - border-radius: 50%; - perspective: 800px; - transition: all 0.7s cubic-bezier(0.42, 0, 0, 1.01); -} - -.inner { - position: absolute; - box-sizing: border-box; - width: 100%; - height: 100%; - border-radius: 50%; -} - -.inner.one { - left: 0%; - top: 0%; - animation: rotate-one 1s linear infinite; - border-bottom: 3px solid #EFEFFA; -} - -.inner.two { - right: 0%; - top: 0%; - animation: rotate-two 1s linear infinite; - border-right: 3px solid #EFEFFA; -} - -.inner.three { - right: 0%; - bottom: 0%; - animation: rotate-three 1s linear infinite; - border-top: 3px solid #EFEFFA; -} - -@keyframes rotate-one { - 0% { - transform: rotateX(35deg) rotateY(-45deg) rotateZ(0deg); - } - - 100% { - transform: rotateX(35deg) rotateY(-45deg) rotateZ(360deg); - } -} - -@keyframes rotate-two { - 0% { - transform: rotateX(50deg) rotateY(10deg) rotateZ(0deg); - } - - 100% { - transform: rotateX(50deg) rotateY(10deg) rotateZ(360deg); - } -} - -@keyframes rotate-three { - 0% { - transform: rotateX(35deg) rotateY(55deg) rotateZ(0deg); - } - - 100% { - transform: rotateX(35deg) rotateY(55deg) rotateZ(360deg); - } -} \ No newline at end of file diff --git a/css/mobile.css b/css/mobile.css deleted file mode 100644 index 53e38a3..0000000 --- a/css/mobile.css +++ /dev/null @@ -1,94 +0,0 @@ -@charset "utf-8"; - -/*小于1200px时*/ -@media (max-width: 1200px) { - - /*书签及设置高度*/ - .mark, - .set { - margin-top: 180px; - } -} - -/*小于720px时*/ -@media (max-width: 720px) { - - /*书签*/ - .quick, - .quicks { - width: 23%; - min-width: 23%; - max-width: 23%; - } -} - -/*小于512px时*/ -@media (max-width: 512px) { - - /*文字大小*/ - #time_text { - font-size: 2.75rem; - } - - #day { - font-size: 1.05rem; - } - - .weather { - font-size: 1rem; - } - - .wd::-webkit-input-placeholder { - letter-spacing: 1px; - font-size: 0.95rem; - } - - /*搜索引擎*/ - .se-li { - width: 31.33%; - min-width: 31.33%; - max-width: 31.33%; - } - - /*设置按钮*/ - #menu i { - font-size: 1.45rem; - } - - /*书签*/ - .quick, - .quicks { - width: 31.33%; - min-width: 31.33%; - max-width: 31.33%; - } - - /*壁纸设置*/ - #wallpaper { - flex-wrap: wrap; - } - - #wallpaper_text { - margin-top: 0px; - } - - .form-radio { - margin: 0px 10px 30px 0px; - } - - /*隐藏*/ - .mobile { - display: none; - } -} - -/* 大于568px时 */ -@media (min-width: 568px) { - .iziToast { - border-radius: 30px !important; - } - - .iziToast-wrapper { - padding: 10px 0px !important; - } -} \ No newline at end of file diff --git a/css/style.css b/css/style.css deleted file mode 100644 index 81ff8f8..0000000 --- a/css/style.css +++ /dev/null @@ -1,1055 +0,0 @@ -@charset "utf-8"; - -:root { - --body-background-color: #333333; - --main-text-color: #efefef; - --main-text-form-color: #333333; - --main-text-form-hover-color: #efefef; - /* --main-background-color: #ffffff40; - --main-background-hover-color: #ffffff60; - --main-background-active-color: #ffffff80; */ - --main-background-color: #00000040; - --main-background-hover-color: #acacac60; - --main-background-active-color: #8a8a8a80; - --main-button-color: #ffffff40; - --main-button-hover-color: #00000030; - --main-button-active-color: #00000020; - --main-input-color: #ffffff30; - --main-input-text-placeholder-color: #ffffff70; - --main-text-shadow: 0px 0px 8px #00000066; - --main-search-shadow: 0 0 20px #0000000d; - --main-search-hover-shadow: 0 0 20px #00000033; - --border-bottom-color-hover: #efefef80; - --border-bottom-color-active: #efefef; -} - -html, -body { - width: 100%; - height: 100%; - margin: 0; - background-color: var(--body-background-color); - -webkit-tap-highlight-color: transparent; - -webkit-user-select: none; - user-select: none; - font-family: 'MiSans', sans-serif; -} - -*, -a, -p { - text-decoration: none; - transition: 0.3s; - color: var(--main-text-color); - user-select: none; -} - -section { - display: block; - position: fixed; - width: 100%; - height: 100%; - min-height: 600px; - opacity: 0; - transition: ease 1.5s; -} - -.noclickn { - pointer-events: none; -} - -/*背景*/ -.bg-all { - z-index: 0; - position: absolute; - top: calc(0px + 0px); - left: 0; - width: 100%; - height: calc(100% - 0px); - transition: .25s; -} - -#bg { - transform: scale(1.10); - filter: blur(10px); - position: fixed; - left: 0; - top: 0; - width: 100%; - height: 100%; - object-fit: cover; - transition: opacity 1s, transform .25s, filter .25s; - backface-visibility: hidden; -} - -img.error { - display: none; -} - -.cover { - opacity: 0; - position: fixed; - left: 0; - top: 0; - width: 100%; - height: 100%; - background-image: radial-gradient(rgba(0, 0, 0, 0) 0, rgba(0, 0, 0, .5) 100%), radial-gradient(rgba(0, 0, 0, 0) 33%, rgba(0, 0, 0, .3) 166%); - transition: .25s; -} - -/*总布局*/ -#content { - width: 100%; - height: 100%; - display: flex; - align-items: center; - justify-content: center; -} - -.con { - width: 100%; - display: flex; - justify-content: center; - flex-direction: column; - align-items: center; -} - -.sou { - max-width: 680px; - width: calc(100% - 60px); - animation: fade; - -webkit-animation: fade 0.5s; - -moz-animation: fade 0.5s; - -o-animation: fade 0.5s; - -ms-animation: fade 0.5s; - /* transform: translateY(-150%); */ -} - -/* .box .sou { - display: none; -} */ - -.box .all-search { - opacity: 0; - transition: 0.3s; -} - -/* -搜索框点击后更改样式 -*/ - -/*搜索框*/ -.onsearch .all-search { - background-color: var(--main-text-form-hover-color); - transform: translateY(-140%); - transition: ease 0.3s !important; -} - -/*背景模糊*/ -.onsearch #bg { - transform: scale(1.08) !important; - filter: blur(10px) !important; - transition: ease 0.3s !important; -} - -/*搜索引擎按钮*/ -.onsearch #icon-se { - color: var(--main-text-form-color) !important; - transition: ease 0.5s; -} - -/*搜索按钮*/ -.onsearch #icon-sou { - color: var(--main-text-form-color) !important; - transition: ease 0.5s; -} - -/*时间上移*/ -.onsearch .tool-all { - transform: translateY(-140%) !important; -} - -/*搜索引擎选择上移*/ -.onsearch .search-engine { - transform: translateY(-38%) !important; -} - - -/*时间*/ -.tool-all { - position: absolute; - display: flex; - flex-direction: column; - align-items: center; - transform: translateY(-120%); - z-index: 1; -} - -.time { - color: var(--main-text-color); - display: flex; - flex-direction: column; - align-items: center; -} - -#point { - margin: 0px 4px; - animation: fadenum 2s infinite; - -webkit-animation: fadenum 2s infinite; - -moz-animation: fadenum 2s infinite; - -o-animation: fadenum 2s linear infinite; - -ms-animation: fadenum 2s linear infinite; -} - -#time_text { - font-size: 3rem; - margin: 6px 0px; - text-shadow: var(--main-text-shadow); - transition: 0.2s; -} - -#time_text:hover { - cursor: pointer; - transition: 0.2s; - transform: scale(1.08); -} - -#time_text:active { - transition: 0.2s; - opacity: 0.6; - transform: scale(1.02); -} - -#day { - font-size: 1.15rem; - opacity: 0.8; - margin: 4px 0px; - text-shadow: var(--main-text-shadow); -} - -/*天气*/ -.weather { - color: #efefef; - opacity: 0.8; - font-size: 1.10rem; - text-shadow: var(--main-text-shadow); -} - -/*搜索框*/ -.search, -.wd, -.s { - padding: 0; - margin: 0; - border: none; - outline: none; - background: none; - display: flex; - justify-content: center; - animation: fade; - -webkit-animation: fade 0.5s; - -moz-animation: fade 0.5s; - -o-animation: fade 0.5s; - -ms-animation: fade 0.5s; -} - -.wd::-webkit-input-placeholder { - letter-spacing: 2px; - font-size: 1.05rem; -} - -.all-search { - display: flex; - align-items: center; - width: 100%; - height: 43px; - border-radius: 30px; - color: var(--main-text-color); - background-color: var(--main-background-color); - box-shadow: var(--main-search-shadow); - -webkit-backdrop-filter: blur(10px); - backdrop-filter: blur(10px); - overflow: hidden; - transition: 0.5s ease; -} - -.all-search:hover { - box-shadow: var(--main-search-hover-shadow); -} - -.con .sou form .wd { - width: 100%; - height: 100%; - line-height: 100%; - text-indent: 4px; - font-size: 1.25rem; - color: var(--main-text-form-color); - /* background-color: transparent; */ -} - -.sou form .se, -.sou form .s { - width: 40px; - height: 40px; - display: flex; - padding: 10px; - cursor: pointer; - justify-content: center; - align-items: center; -} - -#icon-se, -#icon-sou { - font-size: 1.25rem; - color: #efefef; -} - -.sou form .se { - transition: 0.3s; - border-radius: 0px 30px 30px 0px; -} - -.sou form .se:hover { - transition: 0.3s; - background: var(--main-background-color); - border-radius: 0px 30px 30px 0px; -} - -.sou-button { - transition: 0.3s; - border-radius: 30px 0px 0px 30px; -} - -.sou-button:hover { - transition: 0.3s; - background: var(--main-background-color); - border-radius: 30px 0px 0px 30px; -} - -.all-search input::-webkit-input-placeholder { - color: var(--main-text-color); - text-align: center; -} - -.all-search input::-moz-placeholder { - color: var(--main-text-color); - text-align: center; -} - -.all-search input:-ms-input-placeholder { - color: var(--main-text-color); - text-align: center; -} - -/*切换搜索引擎*/ -.search-engine { - position: absolute; - margin-top: 10px; - margin-left: 5px; - padding: 10px; - color: var(--main-text-color); - background-color: var(--main-background-color); - box-shadow: var(--main-search-shadow); - -webkit-backdrop-filter: blur(10px); - backdrop-filter: blur(10px); - border-radius: 8px; - display: none; - z-index: 999; - animation: fade; - -webkit-animation: fade 0.5s; - -moz-animation: fade 0.5s; - -o-animation: fade 0.5s; - -ms-animation: fade 0.5s; -} - -.search-engine-list { - display: flex; - justify-content: flex-start; - width: 100%; - flex-wrap: wrap; - height: 152px; - overflow-y: auto; - overflow-x: hidden; -} - -.se-li { - flex: 1; - width: 23%; - min-width: 23%; - max-width: 23%; - width: 100%; - padding: 8px 0px; - margin: 1%; - border-radius: 8px; - transition: 0.3s; - background: var(--main-background-color); -} - -.se-li:hover { - cursor: pointer; - transition: 0.3s; - border-radius: 8px; - background-color: var(--main-background-hover-color); -} - -.se-li-text { - display: flex; - width: 100%; - height: 100%; - align-items: center; - justify-content: center; -} - -.se-li-text span { - margin-left: 10px; - overflow: hidden; - text-overflow: ellipsis; - white-space: nowrap; - -} - -/*搜索建议*/ -#keywords { - position: absolute; - width: 100%; - top: 46.5%; - font-size: small; - color: var(--main-text-color); - background-color: var(--main-background-color); - box-shadow: var(--main-search-shadow); - border-radius: 8px; - display: none; - z-index: 999; - -webkit-backdrop-filter: blur(10px); - backdrop-filter: blur(10px); - animation: down; - -webkit-animation: down 0.5s; - -moz-animation: down 0.5s; - -o-animation: down 0.5s; - -ms-animation: down 0.5s; -} - -.keyword { - padding: 6px 12px; - border-radius: 8px; - transition: 0.3s; - animation: fade; - -webkit-animation: fade 0.5s; - -moz-animation: fade 0.5s; - -o-animation: fade 0.5s; - -ms-animation: fade 0.5s; -} - -.keyword i { - margin-right: 6px; - font-size: small; -} - -.keyword:hover, -.keyword.choose { - cursor: pointer; - /* font-weight: bold; */ - transition: 0.3s; - text-indent: 10px; - border-radius: 8px; - background-color: var(--main-background-hover-color); - border-radius: 8px; -} - -/*书签及设置*/ -.mark, -.set { - flex-direction: column; - align-items: center; - background: var(--main-background-color); - border-radius: 8px; - height: 400px; - max-height: 400px; - width: 80%; - max-width: 900px; - max-width: 900px; - position: absolute; - margin-top: 200px; - z-index: 2000; - animation: fade; - -webkit-animation: fade 0.75s; - -moz-animation: fade 0.75s; - -o-animation: fade 0.75s; - -ms-animation: fade 0.75s; -} - -.mark .tab, -.set .tabs { - height: 40px; - min-height: 40px; - width: 100%; - display: flex; - justify-content: space-around; - align-items: center; - margin-bottom: 20px; -} - -.set .tabs { - margin-bottom: 0px !important; -} - -.mark .tab .tab-item, -.set .tabs .tab-items { - width: 100%; - height: 100%; - display: flex; - justify-content: center; - align-items: center; - font-size: 0.95rem; - transition: 0.3s; - border-bottom: 2px solid transparent; - border-top: 2px solid transparent; -} - -.mark .tab .tab-item:hover, -.set .tabs .tab-items:hover { - transition: 0.3s; - cursor: pointer; - border-bottom-color: var(--border-bottom-color-hover); -} - -.mark .tab .tab-item.active, -.set .tabs .tab-items.actives { - border-bottom-color: var(--border-bottom-color-active); -} - -.products, -.productss { - width: 100%; - height: 100%; -} - -.products .mainCont, -.productss .mainConts { - display: none; - width: 100%; - /* overflow: auto; */ - flex-wrap: wrap; - animation: fade; - -webkit-animation: fade 0.5s; - -moz-animation: fade 0.5s; - -o-animation: fade 0.5s; - -ms-animation: fade 0.5s; -} - -.products .mainCont.selected, -.productss .mainConts.selected { - display: flex; -} - -/*快捷方式*/ -.quick-all, -.quick-alls { - display: flex; - flex-wrap: wrap; - justify-content: flex-start; - align-content: flex-start; - width: 100%; - margin: 0px 20px 20px 20px; - height: 316px; - overflow: auto; -} - -.quick, -.quicks { - flex: 1; - height: 48px; - background: var(--main-background-color); - cursor: pointer; - border-radius: 8px; - width: 18%; - min-width: 18%; - max-width: 18%; - margin: 0% 1% 2% 1%; - transition: 0.3s; -} - -.quick:hover, -.quicks:hover { - transition: 0.3s; - background: var(--main-background-hover-color); -} - -.quick:active, -.quicks:active { - transform: scale(0.95); - transition: 0.3s; - background: var(--main-background-active-color); -} - -.quick a, -.quicks a { - width: 100%; - height: 100%; - display: flex; - justify-content: center; - align-items: center; - overflow: hidden; - text-overflow: ellipsis; - white-space: nowrap; -} - -/*设置区域统一样式*/ -#menu { - width: 44px; - height: 44px; - position: absolute; - right: 8px; - top: 8px; - z-index: 2000000; - cursor: pointer; - transition: 0.5s; - border-radius: 8px; - transition: 0.3s; - animation: fade; - -webkit-animation: fade 1s; - -moz-animation: fade 1s; - -o-animation: fade 1s; - -ms-animation: fade 1s; -} - -#menu:hover { - cursor: pointer; - transition: 0.3s; - background: var(--main-background-color); - border-radius: 8px; -} - -#menu:active { - cursor: pointer; - transform: scale(0.90); -} - -#menu i { - display: flex; - justify-content: center; - align-items: center; - height: 100%; - font-size: 1.75rem; - transition: 0.3s; -} - -.set_blocks { - width: 100%; - height: 340px; - display: flex; - flex-direction: column; - justify-content: space-between; -} - -.set_blocks_content { - display: flex; - margin: 20px 20px 0px 20px; - height: 430px; - flex-direction: column; - justify-content: space-between; -} - -.set_blocks_content .se_add_preinstall, -.set_blocks_content .se_add_preinstalls, -.from_items.button { - display: flex; - justify-content: center; -} - -.set_se_list_add, -.set_se_list_preinstall, -.se_add_save, -.se_add_cancel, -.set_quick_list_add, -.set_quick_list_preinstall, -.quick_add_cancel, -.quick_add_save, -.wallpaper_save { - width: 25%; - display: flex; - height: 40px; - border-radius: 8px; - background: var(--main-background-color); - margin: 0 20px; - justify-content: center; - align-items: center; - transition: 0.3s; -} - -.set_se_list_add:hover, -.set_se_list_preinstall:hover, -.se_add_save:hover, -.se_add_cancel:hover, -.set_quick_list_add:hover, -.set_quick_list_preinstall:hover, -.quick_add_cancel:hover, -.quick_add_save:hover, -.wallpaper_save:hover { - cursor: pointer; - background: var(--main-background-hover-color); - transition: 0.3s; -} - -.set_se_list_add:active, -.set_se_list_preinstall:active, -.se_add_save:active, -.se_add_cancel:active, -.set_quick_list_add:active, -.set_quick_list_preinstall:active, -.quick_add_cancel:active, -.quick_add_save:active, -.wallpaper_save:active { - transform: scale(0.90); - background: var(--main-background-active-color); - transition: 0.3s; -} - -.set_blocks_content button { - width: 40px; - height: 100%; - background: var(--main-button-color); - border: 1px solid transparent; - transition: 0.3s; -} - -.set_blocks_content button:hover { - cursor: pointer; - background: var(--main-button-hover-color); -} - -.set_blocks_content button:active { - transform: scale(0.95); - background: var(--main-button-active-color); -} - -.se_list, -.se_add_preinstall, -.se_add_preinstalls, -.quick_list, -.add_content { - animation: fade; - -webkit-animation: fade 0.5s; - -moz-animation: fade 0.5s; - -o-animation: fade 0.5s; - -ms-animation: fade 0.5s; -} - -/*表单内容*/ -.add_content { - display: flex; - flex-direction: column; - height: 320px; - justify-content: space-between; - overflow-y: auto; - overflow-x: hidden; -} - -.froms { - height: 100%; - display: flex; - flex-direction: column; - justify-content: space-evenly; -} - -.froms .from_items { - display: flex; - flex-direction: row; - align-items: center; - width: 100%; -} - -.from_text { - width: 60px; - display: flex; - justify-content: center; - margin-right: 10px; -} - -.add_content input, -#wallpaper_url input { - font-size: 1.05rem; - outline: none; - height: 40px; - width: 100%; - border-radius: 8px; - padding: 0px 10px; - border: none; - background: var(--main-input-color); -} - -.add_content input:hover, -.add_content input:active, -#wallpaper_url input:hover, -#wallpaper_url input:active { - box-shadow: var(--main-search-hover-shadow); -} - -.add_content input::-webkit-input-placeholder, -#wallpaper_url input::-webkit-input-placeholder { - color: var(--main-input-text-placeholder-color); -} - -input::-webkit-outer-spin-button, -input::-webkit-inner-spin-button { - -webkit-appearance: none; -} - -input[type="number"] { - -moz-appearance: textfield; -} - -/*快捷方式和搜索引擎设置*/ -.quick_list, -.se_list { - height: 260px; - overflow-y: auto; -} - -.quick_list_table, -.se_list_table { - display: flex; - flex-direction: column; - margin: 0px 10px; -} - -.quick_list_div, -.se_list_div { - height: 40px; - display: flex; - flex-direction: row; - align-items: center; - justify-content: space-between; - margin-bottom: 14px; - background: var(--main-background-color); - border-radius: 8px; - transition: 0.3s; -} - -.quick_list_div:hover, -.se_list_div:hover { - background: var(--main-background-hover-color); - transition: 0.3s; -} - -.quick_list_div_num, -.se_list_num { - height: 40px; - width: 40px; - min-width: 40px; - display: flex; - justify-content: center; - align-items: center; - background: var(--main-background-color); - border-radius: 8px; -} - -.quick_list_div_name, -.se_list_name { - width: 100%; - margin-left: 10px; - overflow: hidden; - text-overflow: ellipsis; - white-space: nowrap; -} - -.quick_list_div_button, -.se_list_button { - height: 40px; - border-radius: 8px; - display: flex; - align-items: center; - justify-content: center; -} - -/*背景图片*/ -#wallpaper { - display: flex; - flex-direction: row; -} - -#wallpaper_url { - margin: 10px 0px; - animation: fade; - -webkit-animation: fade 0.5s; - -moz-animation: fade 0.5s; - -o-animation: fade 0.5s; - -ms-animation: fade 0.5s; -} - -#wallpaper_text { - font-weight: bold; - margin-top: 6px; -} - -.form-radio { - margin: 0px 10px 10px 0px; -} - -input[type="radio"]+label { - cursor: pointer; - padding: 6px 10px; - background: var(--main-background-color); - border-radius: 8px; - transition: 0.3s; - border: 2px solid transparent; -} - -input[type="radio"]:checked+label { - background: var(--main-background-active-color); - border: 2px solid var(--main-background-active-color); -} - -/*数据备份*/ -.set_tip { - display: flex; - margin: 20px; - background: var(--main-background-color); - padding: 20px; - border-radius: 8px; - flex-direction: column; -} - -.set_button { - margin: 20px; - display: flex; - justify-content: center; -} - -.but-ordinary { - width: 25%; - display: flex; - height: 40px; - border-radius: 8px; - background: var(--main-background-color); - margin: 0 20px; - justify-content: center; - align-items: center; - transition: 0.3s; -} - -.but-ordinary:hover { - cursor: pointer; - background: var(--main-background-hover-color); - transition: 0.3s; -} - -.but-ordinary:active { - transform: scale(0.90); - background: var(--main-background-active-color); - transition: 0.3s; -} - -.set_version { - display: flex; - justify-content: center; - flex-direction: column; - align-items: center; -} - -.set_version-text2 { - font-size: small; - color: var(--main-background-active-color); -} - -/*页脚*/ -.foot { - position: absolute; - bottom: 10px; - z-index: 1000; - text-align: center; - width: 100%; - height: 20px; - line-height: 20px; -} - -.power { - color: var(--main-text-color); - opacity: 0.8; - font-size: small; - text-shadow: var(--main-text-shadow); -} - -/*弹窗样式*/ -.iziToast { - backdrop-filter: blur(10px) !important; -} - -.iziToast:after { - box-shadow: none !important; -} - -.iziToast>.iziToast-body { - display: flex; - align-items: center; -} - -.iziToast>.iziToast-body .iziToast-message { - margin: 0 !important; -} - -.iziToast>.iziToast-body .iziToast-texts { - margin: 0 !important; -} - -.iziToast>.iziToast-body .iziToast-buttons>a, -.iziToast>.iziToast-body .iziToast-buttons>button, -.iziToast>.iziToast-body .iziToast-buttons>input:not([type=checkbox]):not([type=radio]) { - margin: 2px 6px !important; - color: #efefef !important; -} - -.iziToast>.iziToast-body .iziToast-buttons>a:focus, -.iziToast>.iziToast-body .iziToast-buttons>button:focus, -.iziToast>.iziToast-body .iziToast-buttons>input:not([type=checkbox]):not([type=radio]):focus { - box-shadow: none !important; -} - -/*滚动条*/ -::-webkit-scrollbar { - background-color: transparent !important; - width: 6px; -} - -::-webkit-scrollbar-track { - display: none; -} - -::-webkit-scrollbar-thumb { - border-radius: 10px; - box-shadow: inset 0 0 6px rgba(0, 0, 0, .1); - -webkit-box-shadow: inset 0 0 6px rgba(0, 0, 0, .1); - background-color: var(--main-background-color); -} - -::-webkit-scrollbar-thumb:hover { - background-color: var(--main-background-active-color); -} - -/*文字选中*/ -::selection { - background: #00000040; - color: #000000b3; -} - -::-moz-selection { - background: #00000040; - color: #000000b3; -} - -::-webkit-selection { - background: #00000040; - color: #000000b3; -} - -.from_items input::selection { - background: #ffffff60; - color: #ffffffb3; -} - -/*关闭块*/ -.close_sou { - width: 100%; - height: 100%; - position: absolute; -} \ No newline at end of file diff --git a/favicon.ico b/favicon.ico deleted file mode 100644 index 91c5221..0000000 Binary files a/favicon.ico and /dev/null differ diff --git a/font/MiSans-Regular.subset.ttf b/font/MiSans-Regular.subset.ttf deleted file mode 100644 index f4f8196..0000000 Binary files a/font/MiSans-Regular.subset.ttf and /dev/null differ diff --git a/font/MiSans-Regular.subset.woff2 b/font/MiSans-Regular.subset.woff2 deleted file mode 100644 index fa9e078..0000000 Binary files a/font/MiSans-Regular.subset.woff2 and /dev/null differ diff --git a/font/MiSans-Regular.woff2 b/font/MiSans-Regular.woff2 deleted file mode 100644 index 66eb805..0000000 Binary files a/font/MiSans-Regular.woff2 and /dev/null differ diff --git a/font/iconfont.ttf b/font/iconfont.ttf deleted file mode 100644 index 19da85f..0000000 Binary files a/font/iconfont.ttf and /dev/null differ diff --git a/font/iconfont.woff b/font/iconfont.woff deleted file mode 100644 index 790049b..0000000 Binary files a/font/iconfont.woff and /dev/null differ diff --git a/font/iconfont.woff2 b/font/iconfont.woff2 deleted file mode 100644 index b3f24fc..0000000 Binary files a/font/iconfont.woff2 and /dev/null differ diff --git a/img/background1.webp b/img/background1.webp deleted file mode 100644 index 9002a2f..0000000 Binary files a/img/background1.webp and /dev/null differ diff --git a/img/background10.webp b/img/background10.webp deleted file mode 100644 index fadd799..0000000 Binary files a/img/background10.webp and /dev/null differ diff --git a/img/background2.webp b/img/background2.webp deleted file mode 100644 index eea9b29..0000000 Binary files a/img/background2.webp and /dev/null differ diff --git a/img/background3.webp b/img/background3.webp deleted file mode 100644 index e53a1aa..0000000 Binary files a/img/background3.webp and /dev/null differ diff --git a/img/background4.webp b/img/background4.webp deleted file mode 100644 index cc6445b..0000000 Binary files a/img/background4.webp and /dev/null differ diff --git a/img/background5.webp b/img/background5.webp deleted file mode 100644 index 5e1565b..0000000 Binary files a/img/background5.webp and /dev/null differ diff --git a/img/background6.webp b/img/background6.webp deleted file mode 100644 index 6662f1f..0000000 Binary files a/img/background6.webp and /dev/null differ diff --git a/img/background7.webp b/img/background7.webp deleted file mode 100644 index 900f506..0000000 Binary files a/img/background7.webp and /dev/null differ diff --git a/img/background8.webp b/img/background8.webp deleted file mode 100644 index efe0b32..0000000 Binary files a/img/background8.webp and /dev/null differ diff --git a/img/background9.webp b/img/background9.webp deleted file mode 100644 index 29a1256..0000000 Binary files a/img/background9.webp and /dev/null differ diff --git a/img/icon/favicon_144.png b/img/icon/favicon_144.png deleted file mode 100644 index 7d54454..0000000 Binary files a/img/icon/favicon_144.png and /dev/null differ diff --git a/img/icon/favicon_32.png b/img/icon/favicon_32.png deleted file mode 100644 index 2583cf7..0000000 Binary files a/img/icon/favicon_32.png and /dev/null differ diff --git a/index.html b/index.html index 42f3936..fcbc1e0 100644 --- a/index.html +++ b/index.html @@ -1,562 +1,26 @@ - - - - - - - + + + + + + Snavigation - - - - - - - - - - - - + + - - - - -
-
-
-
-
-
-
-
-
-
-

Snavigation

- 加载中 -
-
-
- -
- -
-
- -
-
-
- -
-
- 00:00 - 0 月 00 日 周一 -
-
- N/A N/A°C ~ N/A°C -
-
- -
-
- - - -
- - - - - - -
-
- -
-
Copyright © 2020 -  無名 &  - - Made by imsyy -
-
-
- - - - - - - - - + + +
+ + diff --git a/js/js.cookie.js b/js/js.cookie.js deleted file mode 100644 index 826ae33..0000000 --- a/js/js.cookie.js +++ /dev/null @@ -1,164 +0,0 @@ -/*! - * JavaScript Cookie v2.2.1 - * https://github.com/js-cookie/js-cookie - * - * Copyright 2006, 2015 Klaus Hartl & Fagner Brack - * Released under the MIT license - */ -; -(function (factory) { - var registeredInModuleLoader; - if (typeof define === 'function' && define.amd) { - define(factory); - registeredInModuleLoader = true; - } - if (typeof exports === 'object') { - module.exports = factory(); - registeredInModuleLoader = true; - } - if (!registeredInModuleLoader) { - var OldCookies = window.Cookies; - var api = window.Cookies = factory(); - api.noConflict = function () { - window.Cookies = OldCookies; - return api; - }; - } -}(function () { - function extend() { - var i = 0; - var result = {}; - for (; i < arguments.length; i++) { - var attributes = arguments[i]; - for (var key in attributes) { - result[key] = attributes[key]; - } - } - return result; - } - - function decode(s) { - return s.replace(/(%[0-9A-Z]{2})+/g, decodeURIComponent); - } - - function init(converter) { - function api() {} - - function set(key, value, attributes) { - if (typeof document === 'undefined') { - return; - } - - attributes = extend({ - path: '/' - }, api.defaults, attributes); - - if (typeof attributes.expires === 'number') { - attributes.expires = new Date(new Date() * 1 + attributes.expires * 864e+5); - } - - // We're using "expires" because "max-age" is not supported by IE - attributes.expires = attributes.expires ? attributes.expires.toUTCString() : ''; - - try { - var result = JSON.stringify(value); - if (/^[\{\[]/.test(result)) { - value = result; - } - } catch (e) {} - - value = converter.write ? - converter.write(value, key) : - encodeURIComponent(String(value)) - .replace(/%(23|24|26|2B|3A|3C|3E|3D|2F|3F|40|5B|5D|5E|60|7B|7D|7C)/g, decodeURIComponent); - - key = encodeURIComponent(String(key)) - .replace(/%(23|24|26|2B|5E|60|7C)/g, decodeURIComponent) - .replace(/[\(\)]/g, escape); - - var stringifiedAttributes = ''; - for (var attributeName in attributes) { - if (!attributes[attributeName]) { - continue; - } - stringifiedAttributes += '; ' + attributeName; - if (attributes[attributeName] === true) { - continue; - } - - // Considers RFC 6265 section 5.2: - // ... - // 3. If the remaining unparsed-attributes contains a %x3B (";") - // character: - // Consume the characters of the unparsed-attributes up to, - // not including, the first %x3B (";") character. - // ... - stringifiedAttributes += '=' + attributes[attributeName].split(';')[0]; - } - - return (document.cookie = key + '=' + value + stringifiedAttributes); - } - - function get(key, json) { - if (typeof document === 'undefined') { - return; - } - - var jar = {}; - // To prevent the for loop in the first place assign an empty array - // in case there are no cookies at all. - var cookies = document.cookie ? document.cookie.split('; ') : []; - var i = 0; - - for (; i < cookies.length; i++) { - var parts = cookies[i].split('='); - var cookie = parts.slice(1).join('='); - - if (!json && cookie.charAt(0) === '"') { - cookie = cookie.slice(1, -1); - } - - try { - var name = decode(parts[0]); - cookie = (converter.read || converter)(cookie, name) || - decode(cookie); - - if (json) { - try { - cookie = JSON.parse(cookie); - } catch (e) {} - } - - jar[name] = cookie; - - if (key === name) { - break; - } - } catch (e) {} - } - - return key ? jar[key] : jar; - } - - api.set = set; - api.get = function (key) { - return get(key, false /* read as raw */ ); - }; - api.getJSON = function (key) { - return get(key, true /* read as json */ ); - }; - api.remove = function (key, attributes) { - set(key, '', extend(attributes, { - expires: -1 - })); - }; - - api.defaults = {}; - - api.withConverter = init; - - return api; - } - - return init(function () {}); -})); \ No newline at end of file diff --git a/js/main.js b/js/main.js deleted file mode 100644 index e17b4dc..0000000 --- a/js/main.js +++ /dev/null @@ -1,170 +0,0 @@ -//加载完成后执行 -window.addEventListener('load', function () { - //载入动画 - $('#loading-box').attr('class', 'loaded'); - $('#bg').css("cssText", "transform: scale(1);filter: blur(0px);transition: ease 1.5s;"); - $('#section').css("cssText", "opacity: 1;transition: ease 1.5s;"); - $('.cover').css("cssText", "opacity: 1;transition: ease 1.5s;"); - - //用户欢迎 - iziToast.settings({ - timeout: 3000, - backgroundColor: '#ffffff40', - titleColor: '#efefef', - messageColor: '#efefef', - progressBar: false, - close: false, - closeOnEscape: true, - position: 'topCenter', - transitionIn: 'bounceInDown', - transitionOut: 'flipOutX', - displayMode: 'replace', - layout: '1' - }); - setTimeout(function () { - iziToast.show({ - title: hello, - message: '欢迎来到 Snavigation' - }); - }, 800); - - //中文字体缓加载-此处写入字体源文件 - //先行加载简体中文子集,后续补全字集 - //由于压缩过后的中文字体仍旧过大,可转移至对象存储或 CDN 加载 - const font = new FontFace( - "MiSans", - "url(" + "./font/MiSans-Regular.woff2" + ")" - ); - document.fonts.add(font); - -}, false) - -//进入问候 -now = new Date(), hour = now.getHours() -if (hour < 6) { - var hello = "凌晨好"; -} else if (hour < 9) { - var hello = "早上好"; -} else if (hour < 12) { - var hello = "上午好"; -} else if (hour < 14) { - var hello = "中午好"; -} else if (hour < 17) { - var hello = "下午好"; -} else if (hour < 19) { - var hello = "傍晚好"; -} else if (hour < 22) { - var hello = "晚上好"; -} else { - var hello = "夜深了"; -} - -//获取时间 -var t = null; -t = setTimeout(time, 1000); - -function time() { - clearTimeout(t); - dt = new Date(); - var mm = dt.getMonth() + 1; - var d = dt.getDate(); - var weekday = ["周日", "周一", "周二", "周三", "周四", "周五", "周六"]; - var day = dt.getDay(); - var h = dt.getHours(); - var m = dt.getMinutes(); - if (h < 10) { - h = "0" + h; - } - if (m < 10) { - m = "0" + m; - } - $("#time_text").html(h + ':' + m); - $("#day").html(mm + " 月 " + d + " 日 " + weekday[day]); - t = setTimeout(time, 1000); -} - -//获取天气 -//每日限量 100 次 -//请前往 https://www.tianqiapi.com/index/doc?version=v6 申请(免费) -fetch('https://yiketianqi.com/api?unescape=1&version=v6&appid=43986679&appsecret=TksqGZT7') - .then(response => response.json()) - .then(data => { - //$('#wea_text').html(data.wea + ' ' + data.tem_night + '℃' + ' ~ ' + data.tem_day + '℃') - $('#wea_text').text(data.wea) - $('#tem1').text(data.tem1) - $('#tem2').text(data.tem2) - }) - .catch(console.error) - -//Tab书签页 -$(function () { - $(".mark .tab .tab-item").click(function () { - $(this).addClass("active").siblings().removeClass("active"); - $(".products .mainCont").eq($(this).index()).css("display", "flex").siblings().css("display", "none"); - }) -}) - -//设置 -$(function () { - $(".set .tabs .tab-items").click(function () { - $(this).addClass("actives").siblings().removeClass("actives"); - $(".productss .mainConts").eq($(this).index()).css("display", "flex").siblings().css("display", "none"); - }) -}) - -//输入框为空时阻止跳转 -$(window).keydown(function (e) { - var key = window.event ? e.keyCode : e.which; - if (key.toString() == "13") { - if ($(".wd").val() == "") { - return false; - } - } -}); - -//点击搜索按钮 -$(".sou-button").click(function () { - if ($("body").attr("class") === "onsearch") { - if ($(".wd").val() != "") { - $("#search-submit").click(); - } - } -}); - -//鼠标中键点击事件 -$(window).mousedown(function (event) { - if (event.button == 1) { - $("#time_text").click(); - } -}); - -//控制台输出 -var styleTitle1 = ` -font-size: 20px; -font-weight: 600; -color: rgb(244,167,89); -` -var styleTitle2 = ` -font-size:12px; -color: rgb(244,167,89); -` -var styleContent = ` -color: rgb(30,152,255); -` -var title1 = 'Snavigation' -var title2 = ` - _____ __ __ _______ ____ __ -|_ _| \\/ |/ ____\\ \\ / /\\ \\ / / - | | | \\ / | (___ \\ \\_/ / \\ \\_/ / - | | | |\\/| |\\___ \\ \\ / \\ / - _| |_| | | |____) | | | | | -|_____|_| |_|_____/ |_| |_| -` -var content = ` -版 本 号:1.1 -更新日期:2022-07-12 - -Github: https://github.com/imsyy/Snavigation -` -console.log(`%c${title1} %c${title2} -%c${content}`, styleTitle1, styleTitle2, styleContent) \ No newline at end of file diff --git a/js/set.js b/js/set.js deleted file mode 100644 index 2596ab6..0000000 --- a/js/set.js +++ /dev/null @@ -1,1216 +0,0 @@ -/* -作者:D.Young -主页:https://yyv.me/ -github:https://github.com/5iux/sou -日期:2019-07-26 -版权所有,请勿删除 -======================================== -由 yeetime 修改 -github:https://github.com/yeetime/sou2 -日期:2019-12-13 -======================================== -由 imsyy 二次修改 -github:https://github.com/imsyy/sou2 -日期:2022-03-10 -*/ - -// 默认搜索引擎列表 -var se_list_preinstall = { - '1': { - id: 1, - title: "百度", - url: "https://www.baidu.com/s", - name: "wd", - icon: "iconfont icon-baidu", - }, - '2': { - id: 2, - title: "必应", - url: "https://cn.bing.com/search", - name: "q", - icon: "iconfont icon-bing", - }, - '3': { - id: 3, - title: "谷歌", - url: "https://www.google.com/search", - name: "q", - icon: "iconfont icon-google", - }, - '4': { - id: 4, - title: "搜狗", - url: "https://www.sogou.com/web", - name: "query", - icon: "iconfont icon-sougousousuo", - }, - '5': { - id: 5, - title: "360", - url: "https://www.so.com/s", - name: "q", - icon: "iconfont icon-360sousuo", - }, - '6': { - id: 6, - title: "微博", - url: "https://s.weibo.com/weibo", - name: "q", - icon: "iconfont icon-xinlangweibo", - }, - '7': { - id: 7, - title: "知乎", - url: "https://www.zhihu.com/search", - name: "q", - icon: "iconfont icon-zhihu", - }, - '8': { - id: 8, - title: "Github", - url: "https://github.com/search", - name: "q", - icon: "iconfont icon-github", - }, - '9': { - id: 9, - title: "BiliBili", - url: "https://search.bilibili.com/all", - name: "keyword", - icon: "iconfont icon-bilibilidonghua", - }, - '10': { - id: 10, - title: "淘宝", - url: "https://s.taobao.com/search", - name: "q", - icon: "iconfont icon-taobao", - }, - '11': { - id: 11, - title: "京东", - url: "https://search.jd.com/Search", - name: "keyword", - icon: "iconfont icon-jingdong", - } -}; - -// 默认快捷方式 -var quick_list_preinstall = { - '1': { - title: "Vercel", - url: "https://vercel.com/", - }, - '2': { - title: "GitHub", - url: "https://github.com/", - }, - '3': { - title: "Cloudflare", - url: "https://dash.cloudflare.com/", - }, - '4': { - title: "W3school", - url: "https://www.w3school.com.cn/", - }, - '5': { - title: "腾讯云", - url: "https://console.cloud.tencent.com/", - }, - '6': { - title: "阿里云", - url: "https://console.aliyun.com/", - }, - '7': { - title: "百度网盘", - url: "https://pan.baidu.com/", - }, - '8': { - title: "阿里云盘", - url: "https://www.aliyundrive.com/drive/", - }, - '9': { - title: "Office", - url: "https://www.office.com/", - }, - '10': { - title: "又拍云", - url: "https://console.upyun.com/", - }, - '11': { - title: "CSDN", - url: "https://www.csdn.net/", - }, - '12': { - title: "哔哩哔哩", - url: "https://www.bilibili.com/", - } -}; - -// 获取搜索引擎列表 -function getSeList() { - var se_list_local = Cookies.get('se_list'); - if (se_list_local !== "{}" && se_list_local) { - return JSON.parse(se_list_local); - } else { - setSeList(se_list_preinstall); - return se_list_preinstall; - } -} - -// 设置搜索引擎列表 -function setSeList(se_list) { - if (se_list) { - Cookies.set('se_list', se_list, { - expires: 36500 - }); - return true; - } - return false; -} - -// 获得默认搜索引擎 -function getSeDefault() { - var se_default = Cookies.get('se_default'); - return se_default ? se_default : "1"; -} - -//背景图片 -var bg_img_preinstall = { - "type": "2", // 1:使用主题默认的背景图片 2:关闭背景图片 3:使用自定义的背景图片 - "path": "", //自定义图片 -}; - -// 获取背景图片 -function getBgImg() { - var bg_img_local = Cookies.get('bg_img'); - if (bg_img_local && bg_img_local !== "{}") { - return JSON.parse(bg_img_local); - } else { - setBgImg(bg_img_preinstall); - return bg_img_preinstall; - } -} - -// 设置背景图片 -function setBgImg(bg_img) { - if (bg_img) { - Cookies.set('bg_img', bg_img, { - expires: 36500 - }); - return true; - } - return false; -} - -// 设置-壁纸 -//$('#bg').attr('src','https://api.dujin.org/bing/1920.php') -function setBgImgInit() { - var bg_img = getBgImg(); - $("input[name='wallpaper-type'][value=" + bg_img["type"] + "]").click(); - if (bg_img["type"] === "5") { - $("#wallpaper-url").val(bg_img["path"]); - $("#wallpaper-button").fadeIn(100); - $("#wallpaper_url").fadeIn(100); - } else { - $("#wallpaper_url").fadeOut(300); - $("#wallpaper-button").fadeOut(300); - } - - switch (bg_img["type"]) { - case "1": - var pictures = new Array(); - pictures[0] = './img/background1.webp'; - pictures[1] = './img/background2.webp'; - pictures[2] = './img/background3.webp'; - pictures[3] = './img/background4.webp'; - pictures[4] = './img/background5.webp'; - pictures[5] = './img/background6.webp'; - pictures[6] = './img/background7.webp'; - pictures[7] = './img/background8.webp'; - pictures[8] = './img/background9.webp'; - pictures[9] = './img/background10.webp'; - var rd = Math.floor(Math.random() * 10); - $('#bg').attr('src', pictures[rd]) //随机默认壁纸 - break; - case "2": - $('#bg').attr('src', 'https://api.dujin.org/bing/1920.php') //必应每日 - break; - case "3": - $('#bg').attr('src', 'https://api.ixiaowai.cn/gqapi/gqapi.php') //随机风景 - break; - case "4": - $('#bg').attr('src', 'https://api.ixiaowai.cn/api/api.php') //随机二次元 - break; - case "5": - $('#bg').attr('src', bg_img["path"]) //自定义 - break; - } -} - -// 搜索框高亮 -function focusWd() { - $("body").addClass("onsearch"); -} - -// 搜索框取消高亮 -function blurWd() { - $("body").removeClass("onsearch"); - //隐藏输入 - $(".wd").val(""); - //隐藏搜索建议 - $("#keywords").hide(); -} - -// 搜索建议提示 -function keywordReminder() { - var keyword = $(".wd").val(); - if (keyword != "") { - $.ajax({ - url: 'https://suggestion.baidu.com/su?wd=' + keyword, - dataType: 'jsonp', - jsonp: 'cb', //回调函数的参数名(键值)key - success: function (data) { - //获取宽度 - $("#keywords").css("width", $('.sou').width()); - $("#keywords").empty().show(); - $.each(data.s, function (i, val) { - $('#keywords').append(`
${val}
`); - }); - $("#keywords").attr("data-length", data.s["length"]); - $(".keyword").click(function () { - $(".wd").val($(this).text()); - $("#search-submit").click(); - }); - }, - error: function () { - $("#keywords").empty().show(); - $("#keywords").hide(); - } - }) - } else { - $("#keywords").empty().show(); - $("#keywords").hide(); - } -} - -// 搜索框数据加载 -function searchData() { - var se_default = getSeDefault(); - var se_list = getSeList(); - var defaultSe = se_list[se_default]; - if (defaultSe) { - $(".search").attr("action", defaultSe["url"]); - $("#icon-se").attr("class", defaultSe["icon"]); - $(".wd").attr("name", defaultSe["name"]); - } - - // 判断窗口大小,添加输入框自动完成 - // var wid = $("body").width(); - // if (wid < 640) { - // $(".wd").attr('autocomplete', 'off'); - // } else { - // $(".wd").focus(); - // focusWd(); - // } -} - -// 搜索引擎列表加载 -function seList() { - var html = ""; - var se_list = getSeList(); - for (var i in se_list) { - html += `
- ${se_list[i]["title"]}
`; - } - $(".search-engine-list").html(html); -} - -// 设置-搜索引擎列表加载 -function setSeInit() { - var se_default = getSeDefault(); - var se_list = getSeList(); - var html = ""; - for (var i in se_list) { - var tr = `
${i}
`; - if (i === se_default) { - tr = `
-
`; - } - tr += `
${se_list[i]["title"]}
-
- - -
-
`; - html += tr; - } - $(".se_list_table").html(html); -} - -// 获取快捷方式列表 -function getQuickList() { - var quick_list_local = Cookies.get('quick_list'); - if (quick_list_local !== "{}" && quick_list_local) { - return JSON.parse(quick_list_local); - } else { - setQuickList(quick_list_preinstall); - return quick_list_preinstall; - } -} - -// 设置快捷方式列表 -function setQuickList(quick_list) { - if (quick_list) { - Cookies.set('quick_list', quick_list, { - expires: 36500 - }); - return true; - } - return false; -} - -// 快捷方式数据加载 -function quickData() { - var html = ""; - var quick_list = getQuickList(); - for (var i in quick_list) { - html += `
- ${quick_list[i]['title']} -
`; - } - $(".quick-all").html(html + `
`); -} - -// 设置-快捷方式加载 -function setQuickInit() { - var quick_list = getQuickList(); - var html = ""; - for (var i in quick_list) { - tr = ` -
-
${i}
-
${quick_list[i]['title']}
-
- - -
-
`; - html += tr; - } - $(".quick_list_table").html(html); -} - -/** - * 下载文本为文件 - * @param filename 文件名 - * @param text 内容 - */ -function download(filename, text) { - var element = document.createElement('a'); - element.setAttribute('href', 'data:text/plain;charset=utf-8,' + encodeURIComponent(text)); - element.setAttribute('download', filename); - - element.style.display = 'none'; - document.body.appendChild(element); - - element.click(); - - document.body.removeChild(element); -} - -// 打开设置 -function openSet() { - $("#menu").addClass('on'); - - openBox(); - - //更改设置图标 - $("#icon-menu").attr("class", "iconfont icon-home"); - - //隐藏书签打开设置 - $(".mark").css({ - "display": "none", - }); - $(".set").css({ - "display": "flex", - }); -} - -// 关闭设置 -function closeSet() { - $("#menu").removeClass('on'); - - closeBox(); - - //更改设置图标 - $("#icon-menu").attr("class", "iconfont icon-shezhi"); - - //隐藏设置 - $(".set").css({ - "display": "none", - }); - - // 刷新主页数据 - seList(); - quickData(); -} - -// 书签显示 -function openBox() { - $("#content").addClass('box'); - $(".mark").css({ - "display": "flex", - }); - //时间上移 - $(".tool-all").css({ - "transform": 'translateY(-160%)' - }); - //背景模糊 - $('#bg').css({ - "transform": 'scale(1.08)', - "filter": "blur(10px)", - "transition": "ease 0.3s", - }); -} - -// 书签关闭 -function closeBox() { - $("#content").removeClass('box'); - $(".mark").css({ - "display": "none", - }); - //时间下移 - $(".tool-all").css({ - "transform": 'translateY(-120%)' - }); - //背景模糊 - $('#bg').css({ - "transform": 'scale(1)', - "filter": "blur(0px)", - "transition": "ease 0.3s", - }); -} - -//显示设置搜索引擎列表 -function showSe() { - $(".se_list").show(); - $(".se_add_preinstall").show(); -} - -//隐藏设置搜索引擎列表 -function hideSe() { - $(".se_list").hide(); - $(".se_add_preinstall").hide(); -} - -//显示设置快捷方式列表 -function showQuick() { - $(".quick_list").show(); - $(".se_add_preinstalls").show(); -} - -//隐藏设置快捷方式列表 -function hideQuick() { - $(".quick_list").hide(); - $(".se_add_preinstalls").hide(); -} - - -$(document).ready(function () { - - // 搜索框数据加载 - searchData(); - - // 搜索引擎列表加载 - seList(); - - // 快捷方式数据加载 - quickData(); - - // 壁纸数据加载 - setBgImgInit(); - - // 点击事件 - $(document).on('click', function (e) { - // 选择搜索引擎点击 - if ($(".search-engine").is(":hidden") && $(".se").is(e.target) || $(".search-engine").is(":hidden") && $("#icon-se").is(e.target)) { - if ($(".se").is(e.target) || $("#icon-se").is(e.target)) { - //获取宽度 - $(".search-engine").css("width", $('.sou').width() - 30); - //出现动画 - $(".search-engine").slideDown(160); - } - } else { - if (!$(".search-engine").is(e.target) && $(".search-engine").has(e.target).length === 0) { - $(".search-engine").slideUp(160); - } - } - - // 自动提示隐藏 - if (!$(".sou").is(e.target) && $(".sou").has(e.target).length === 0) { - $("#keywords").hide(); - } - }); - - // 时间点击 - $("#time_text").click(function () { - if ($("#content").attr("class") === "box") { - closeBox(); - closeSet(); - blurWd(); - } else { - openBox(); - } - }); - - // 搜索引擎列表点击 - $(".search-engine-list").on("click", ".se-li", function () { - var url = $(this).attr('data-url'); - var name = $(this).attr('data-name'); - var icon = $(this).attr('data-icon'); - $(".search").attr("action", url); - $(".wd").attr("name", name); - $("#icon-se").attr("class", icon); - $(".search-engine").slideUp(160); - }); - - // 搜索引擎列表点击 - $(".search-engine-list").on("click", ".se-li", function () { - var url = $(this).attr('data-url'); - var name = $(this).attr('data-name'); - var icon = $(this).attr('data-icon'); - $(".search").attr("action", url); - $(".wd").attr("name", name); - $("#icon-se").attr("class", icon); - $(".search-engine").slideUp(160); - }); - - // 搜索框点击事件 - $(document).on('click', '.sou', function () { - focusWd(); - $(".search-engine").slideUp(160); - }); - - $(document).on('click', '.wd', function () { - focusWd(); - keywordReminder(); - $(".search-engine").slideUp(160); - }); - - // 点击其他区域关闭事件 - $(document).on('click', '.close_sou', function () { - blurWd(); - closeSet(); - }); - - // 点击搜索引擎时隐藏自动提示 - $(document).on('click', '.se', function () { - $('#keywords').toggle(); - }); - - // 恢复自动提示 - $(document).on('click', '.se-li', function () { - $('#keywords').show(); - }); - - // 自动提示 (调用百度 api) - $('.wd').keyup(function (event) { - var key = event.keyCode; - // 屏蔽上下键 - var shieldKey = [38, 40]; - if (shieldKey.includes(key)) return; - keywordReminder(); - }); - - // 点击自动提示的搜索建议 - $("#keywords").on("click", ".wd", function () { - var wd = $(this).text(); - $(".wd").val(wd); - $(".search").submit(); - //隐藏输入 - $(".wd").val(""); - $("#keywords").hide(); - }); - - // 自动提示键盘方向键选择操作 - $(".wd").keydown(function (event) { //上下键获取焦点 - var key = event.keyCode; - if ($.trim($(this).val()).length === 0) return; - - var id = $(".choose").attr("data-id"); - if (id === undefined) id = 0; - - if (key === 38) { - /*向上按钮*/ - id--; - } else if (key === 40) { - /*向下按钮*/ - id++; - } else { - return; - } - var length = $("#keywords").attr("data-length"); - if (id > length) id = 1; - if (id < 1) id = length; - - $(".keyword[data-id=" + id + "]").addClass("choose").siblings().removeClass("choose"); - $(".wd").val($(".keyword[data-id=" + id + "]").text()); - }); - - // 菜单点击 - $("#menu").click(function () { - if ($(this).attr("class") === "on") { - closeSet(); - } else { - openSet(); - - // 设置内容加载 - setSeInit(); //搜索引擎设置 - setQuickInit(); //快捷方式设置 - } - }); - - // 快捷方式添加按钮点击 - $("#set-quick").click(function () { - openSet(); - - // 设置内容加载 - setSeInit(); //搜索引擎设置 - setQuickInit(); //快捷方式设置 - - //添加快捷方式 - $("#set-quick-menu").trigger('click'); - $(".set_quick_list_add").trigger('click'); - }); - - // 修改默认搜索引擎 - $(".se_list_table").on("click", ".set_se_default", function () { - var name = $(this).val(); - Cookies.set('se_default', name, { - expires: 36500 - }); - iziToast.show({ - timeout: 8000, - message: '是否设置为默认搜索引擎?', - buttons: [ - ['', function (instance, toast) { - setSeInit(); - instance.hide({ - transitionOut: 'flipOutX', - }, toast, 'buttonName'); - iziToast.show({ - message: '设置成功' - }); - setTimeout(function () { - window.location.reload() - }, 1000); - }, true], - ['', function (instance, toast) { - instance.hide({ - transitionOut: 'flipOutX', - }, toast, 'buttonName'); - }] - ] - }); - }); - - // 搜索引擎添加 - $(".set_se_list_add").click(function () { - $(".se_add_content input").val(""); - - hideSe(); - $(".se_add_content").show(); - }); - - // 搜索引擎保存 - $(".se_add_save").click(function () { - var key_inhere = $(".se_add_content input[name='key_inhere']").val(); - var key = $(".se_add_content input[name='key']").val(); - var title = $(".se_add_content input[name='title']").val(); - var url = $(".se_add_content input[name='url']").val(); - var name = $(".se_add_content input[name='name']").val(); - //var icon = $(".se_add_content input[name='icon']").val(); - var icon = "iconfont icon-wangluo"; - - var num = /^\+?[1-9][0-9]*$/; - if (!num.test(key)) { - iziToast.show({ - timeout: 2000, - message: '序号 ' + key + ' 不是正整数' - }); - return; - } - - var se_list = getSeList(); - - if (se_list[key]) { - iziToast.show({ - timeout: 8000, - message: '搜索引擎 ' + key + ' 已有数据,是否覆盖?', - buttons: [ - ['', function (instance, toast) { - se_list[key] = { - title: title, - url: url, - name: name, - icon: icon, - }; - setSeList(se_list); - setSeInit(); - $(".se_add_content").hide(); - //显示列表 - showSe(); - - instance.hide({ - transitionOut: 'flipOutX', - }, toast, 'buttonName'); - iziToast.show({ - message: '覆盖成功' - }); - }, true], - ['', function (instance, toast) { - instance.hide({ - transitionOut: 'flipOutX', - }, toast, 'buttonName'); - }] - ] - }); - return; - } - - if (key_inhere && key !== key_inhere) { - delete se_list[key_inhere]; - } - - se_list[key] = { - title: title, - url: url, - name: name, - icon: icon, - }; - setSeList(se_list); - setSeInit(); - iziToast.show({ - timeout: 2000, - message: '添加成功' - }); - $(".se_add_content").hide(); - showSe(); - }); - - // 关闭表单 - $(".se_add_cancel").click(function () { - $(".se_add_content").hide(); - - //显示列表 - showSe(); - }); - - // 搜索引擎修改 - $(".se_list").on("click", ".edit_se", function () { - - var se_list = getSeList(); - var key = $(this).val(); - $(".se_add_content input[name='key_inhere']").val(key); - $(".se_add_content input[name='key']").val(key); - $(".se_add_content input[name='title']").val(se_list[key]["title"]); - $(".se_add_content input[name='url']").val(se_list[key]["url"]); - $(".se_add_content input[name='name']").val(se_list[key]["name"]); - // $(".se_add_content input[name='icon']").val("iconfont icon-Earth"); - - //隐藏列表 - hideSe(); - - $(".se_add_content").show(); - }); - - // 搜索引擎删除 - $(".se_list").on("click", ".delete_se", function () { - var se_default = getSeDefault(); - var key = $(this).val(); - if (key == se_default) { - iziToast.show({ - message: '默认搜索引擎不可删除' - }); - } else { - iziToast.show({ - timeout: 8000, - message: '搜索引擎 ' + key + ' 是否删除?', - buttons: [ - ['', function (instance, toast) { - var se_list = getSeList(); - delete se_list[key]; - setSeList(se_list); - setSeInit(); - instance.hide({ - transitionOut: 'flipOutX', - }, toast, 'buttonName'); - iziToast.show({ - message: '删除成功' - }); - }, true], - ['', function (instance, toast) { - instance.hide({ - transitionOut: 'flipOutX', - }, toast, 'buttonName'); - }] - ] - }); - } - }); - - // 恢复预设搜索引擎 - $(".set_se_list_preinstall").click(function () { - iziToast.show({ - timeout: 8000, - message: '现有搜索引擎数据将被清空', - buttons: [ - ['', function (instance, toast) { - setSeList(se_list_preinstall); - Cookies.set('se_default', 1, { - expires: 36500 - }); - setSeInit(); - instance.hide({ - transitionOut: 'flipOutX', - }, toast, 'buttonName'); - iziToast.show({ - message: '重置成功' - }); - setTimeout(function () { - window.location.reload() - }, 1000); - }, true], - ['', function (instance, toast) { - instance.hide({ - transitionOut: 'flipOutX', - }, toast, 'buttonName'); - }] - ] - }); - }); - - // 设置-快捷方式添加 - $(".set_quick_list_add").click(function () { - $(".quick_add_content input").val(""); - $(".quick_add_content").show(); - - //隐藏列表 - hideQuick(); - }); - - // 设置-快捷方式保存 - $(".quick_add_save").click(function () { - var key_inhere = $(".quick_add_content input[name='key_inhere']").val(); - var key = $(".quick_add_content input[name='key']").val(); - var title = $(".quick_add_content input[name='title']").val(); - var url = $(".quick_add_content input[name='url']").val(); - var img = $(".quick_add_content input[name='img']").val(); - - var num = /^\+?[1-9][0-9]*$/; - if (!num.test(key)) { - iziToast.show({ - timeout: 2000, - message: '快捷方式 ' + key + ' 不是正整数' - }); - return; - } - - var quick_list = getQuickList(); - - if (quick_list[key]) { - iziToast.show({ - timeout: 8000, - message: '快捷方式 " + key + " 已有数据,是否覆盖?', - buttons: [ - ['', function (instance, toast) { - quick_list[key] = { - title: title, - url: url, - img: img, - }; - setQuickList(quick_list); - setQuickInit(); - $(".quick_add_content").hide(); - //显示列表 - showQuick(); - - instance.hide({ - transitionOut: 'flipOutX', - }, toast, 'buttonName'); - iziToast.show({ - message: '覆盖成功' - }); - }, true], - ['', function (instance, toast) { - instance.hide({ - transitionOut: 'flipOutX', - }, toast, 'buttonName'); - }] - ] - }); - return; - } - - if (key_inhere && key != key_inhere) { - delete quick_list[key_inhere]; - } - - quick_list[key] = { - title: title, - url: url, - img: img, - }; - setQuickList(quick_list); - setQuickInit(); - $(".quick_add_content").hide(); - iziToast.show({ - timeout: 2000, - message: '添加成功' - }); - - //显示列表 - showQuick(); - }); - - // 设置-快捷方式关闭添加表单 - $(".quick_add_cancel").click(function () { - $(".quick_add_content").hide(); - - //显示列表 - showQuick(); - }); - - //恢复预设快捷方式 - $(".set_quick_list_preinstall").click(function () { - iziToast.show({ - timeout: 8000, - message: '快捷方式数据将被清空', - buttons: [ - ['', function (instance, toast) { - setQuickList(quick_list_preinstall); - setQuickInit(); - instance.hide({ - transitionOut: 'flipOutX', - }, toast, 'buttonName'); - iziToast.show({ - timeout: 2000, - message: '重置成功' - }); - // setTimeout(function () { - // window.location.reload() - // }, 1000); - }, true], - ['', function (instance, toast) { - instance.hide({ - transitionOut: 'flipOutX', - }, toast, 'buttonName'); - }] - ] - }); - }); - - // 快捷方式修改 - $(".quick_list").on("click", ".edit_quick", function () { - - var quick_list = getQuickList(); - var key = $(this).val(); - $(".quick_add_content input[name='key_inhere']").val(key); - $(".quick_add_content input[name='key']").val(key); - $(".quick_add_content input[name='title']").val(quick_list[key]["title"]); - $(".quick_add_content input[name='url']").val(quick_list[key]["url"]); - $(".quick_add_content input[name='img']").val(quick_list[key]["img"]); - - //隐藏列表 - hideQuick(); - - $(".quick_add_content").show(); - }); - - // 快捷方式删除 - $(".quick_list").on("click", ".delete_quick", function () { - - var key = $(this).val(); - - iziToast.show({ - timeout: 8000, - message: '快捷方式 ' + key + ' 是否删除?', - buttons: [ - ['', function (instance, toast) { - var quick_list = getQuickList(); - delete quick_list[key]; - setQuickList(quick_list); - setQuickInit(); - instance.hide({ - transitionOut: 'flipOutX', - }, toast, 'buttonName'); - iziToast.show({ - timeout: 2000, - message: '删除成功' - }); - }, true], - ['', function (instance, toast) { - instance.hide({ - transitionOut: 'flipOutX', - }, toast, 'buttonName'); - }] - ] - }); - }); - - // 壁纸设置 - $("#wallpaper").on("click", ".set-wallpaper", function () { - var type = $(this).val(); - var bg_img = getBgImg(); - bg_img["type"] = type; - - if (type === "1") { - $('#wallpaper_text').html("显示默认壁纸,刷新页面以生效"); - setBgImg(bg_img); - iziToast.show({ - message: '壁纸设置成功,刷新生效', - }); - } - - if (type === "2") { - $('#wallpaper_text').html("显示必应每日一图,每天更新,刷新页面以生效 | API @ 缙哥哥"); - setBgImg(bg_img); - iziToast.show({ - message: '壁纸设置成功,刷新生效', - }); - } - - if (type === "3") { - $('#wallpaper_text').html("显示随机风景图,每次刷新后更换,刷新页面以生效 | API @ 小歪"); - setBgImg(bg_img); - iziToast.show({ - message: '壁纸设置成功,刷新生效', - }); - } - - if (type === "4") { - $('#wallpaper_text').html("显示随机二次元图,每次刷新后更换,刷新页面以生效 | API @ 小歪"); - setBgImg(bg_img); - iziToast.show({ - message: '壁纸设置成功,刷新生效', - }); - } - - if (type === "5") { - $('#wallpaper_text').html("自定义壁纸地址,请输入正确地址,点击保存且刷新页面以生效"); - $("#wallpaper_url").fadeIn(100); - $("#wallpaper-button").fadeIn(100); - $("#wallpaper-url").val(bg_img["path"]); - } else { - $("#wallpaper_url").fadeOut(300); - $("#wallpaper-button").fadeOut(300); - } - }); - - // 自定义壁纸设置保存 - $(".wallpaper_save").click(function () { - var url = $("#wallpaper-url").val(); - var reg = /^http(s)?:\/\/(([\w-]+\.)+[\w-]|localhost)+(:[0-9]{1,5})?(\/[\w- ./?%&=]*)?$/g; - if (!reg.test(url)) { - iziToast.show({ - message: '请输入正确的链接', - }); - } else { - var bg_img = getBgImg(); - bg_img["type"] = "5"; - bg_img["path"] = url; - setBgImg(bg_img); - iziToast.show({ - message: '自定义壁纸设置成功,刷新生效', - }); - } - }); - - // 我的数据导出 - $("#my_data_out").click(function () { - var cookies = Cookies.get(); - var json = JSON.stringify(cookies); - download("Snavigation-back-up-" + $.now() + ".json", json); - iziToast.show({ - timeout: 2000, - message: '已导出备份文件至下载目录' - }); - }); - - // 我的数据导入 点击触发文件选择 - $("#my_data_in").click(function () { - $("#my_data_file").click(); - }); - - // 选择文件后读取文件内容 - $("#my_data_file").change(function () { - var selectedFile = document.getElementById('my_data_file').files[0]; - //var name = selectedFile.name;//读取选中文件的文件名 - //var size = selectedFile.size;//读取选中文件的大小 - //console.log("文件名:"+name+" 大小:"+size); - - var reader = new FileReader(); //这是核心,读取操作就是由它完成. - reader.readAsText(selectedFile); //读取文件的内容,也可以读取文件的URL - reader.onload = function () { - //当读取完成后回调这个函数,然后此时文件的内容存储到了result中,直接操作即可 - //console.log(this.result); - - // json 格式校验 - var mydata; - try { - mydata = JSON.parse(this.result); - } catch (e) { - iziToast.show({ - timeout: 2000, - message: '数据解析异常' - }); - return; - } - if (typeof mydata != 'object') { - iziToast.show({ - timeout: 2000, - message: '数据格式错误' - }); - return; - } - - iziToast.show({ - timeout: 8000, - message: '当前数据将会被覆盖!是否继续导入?', - buttons: [ - ['', function (instance, toast) { - for (var key in mydata) { - Cookies.set(key, mydata[key], { - expires: 36500 - }); - } - instance.hide({ - transitionOut: 'flipOutX', - }, toast, 'buttonName'); - iziToast.show({ - timeout: 2000, - message: '导入成功' - }); - setTimeout(function () { - window.location.reload() - }, 1000); - }, true], - ['', function (instance, toast) { - instance.hide({ - transitionOut: 'flipOutX', - }, toast, 'buttonName'); - setTimeout(function () { - window.location.reload() - }, 1000); - }] - ] - }); - } - }); -}); \ No newline at end of file diff --git a/package.json b/package.json new file mode 100644 index 0000000..281870a --- /dev/null +++ b/package.json @@ -0,0 +1,24 @@ +{ + "name": "snavigation", + "private": true, + "version": "0.0.0", + "type": "module", + "scripts": { + "dev": "vite", + "build": "vite build", + "preview": "vite preview" + }, + "dependencies": { + "axios": "^1.4.0", + "axios-jsonp": "^1.0.4", + "pinia": "^2.1.4", + "pinia-plugin-persistedstate": "^3.2.0", + "sass": "^1.64.1", + "vue": "^3.3.4" + }, + "devDependencies": { + "@vitejs/plugin-vue": "^4.2.3", + "terser": "^5.19.2", + "vite": "^4.4.5" + } +} diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml new file mode 100644 index 0000000..e939caf --- /dev/null +++ b/pnpm-lock.yaml @@ -0,0 +1,751 @@ +lockfileVersion: '6.0' + +settings: + autoInstallPeers: true + excludeLinksFromLockfile: false + +dependencies: + axios: + specifier: ^1.4.0 + version: 1.4.0 + axios-jsonp: + specifier: ^1.0.4 + version: 1.0.4 + pinia: + specifier: ^2.1.4 + version: 2.1.4(vue@3.3.4) + pinia-plugin-persistedstate: + specifier: ^3.2.0 + version: 3.2.0(pinia@2.1.4) + sass: + specifier: ^1.64.1 + version: 1.64.1 + vue: + specifier: ^3.3.4 + version: 3.3.4 + +devDependencies: + '@vitejs/plugin-vue': + specifier: ^4.2.3 + version: 4.2.3(vite@4.4.6)(vue@3.3.4) + terser: + specifier: ^5.19.2 + version: 5.19.2 + vite: + specifier: ^4.4.5 + version: 4.4.6(sass@1.64.1)(terser@5.19.2) + +packages: + + /@babel/helper-string-parser@7.22.5: + resolution: {integrity: sha512-mM4COjgZox8U+JcXQwPijIZLElkgEpO5rsERVDJTc2qfCDfERyob6k5WegS14SX18IIjv+XD+GrqNumY5JRCDw==} + engines: {node: '>=6.9.0'} + + /@babel/helper-validator-identifier@7.22.5: + resolution: {integrity: sha512-aJXu+6lErq8ltp+JhkJUfk1MTGyuA4v7f3pA+BJ5HLfNC6nAQ0Cpi9uOquUj8Hehg0aUiHzWQbOVJGao6ztBAQ==} + engines: {node: '>=6.9.0'} + + /@babel/parser@7.22.7: + resolution: {integrity: sha512-7NF8pOkHP5o2vpmGgNGcfAeCvOYhGLyA3Z4eBQkT1RJlWu47n63bCs93QfJ2hIAFCil7L5P2IWhs1oToVgrL0Q==} + engines: {node: '>=6.0.0'} + hasBin: true + dependencies: + '@babel/types': 7.22.5 + + /@babel/types@7.22.5: + resolution: {integrity: sha512-zo3MIHGOkPOfoRXitsgHLjEXmlDaD/5KU1Uzuc9GNiZPhSqVxVRtxuPaSBZDsYZ9qV88AjtMtWW7ww98loJ9KA==} + engines: {node: '>=6.9.0'} + dependencies: + '@babel/helper-string-parser': 7.22.5 + '@babel/helper-validator-identifier': 7.22.5 + to-fast-properties: 2.0.0 + + /@esbuild/android-arm64@0.18.16: + resolution: {integrity: sha512-wsCqSPqLz+6Ov+OM4EthU43DyYVVyfn15S4j1bJzylDpc1r1jZFFfJQNfDuT8SlgwuqpmpJXK4uPlHGw6ve7eA==} + engines: {node: '>=12'} + cpu: [arm64] + os: [android] + requiresBuild: true + dev: true + optional: true + + /@esbuild/android-arm@0.18.16: + resolution: {integrity: sha512-gCHjjQmA8L0soklKbLKA6pgsLk1byULuHe94lkZDzcO3/Ta+bbeewJioEn1Fr7kgy9NWNFy/C+MrBwC6I/WCug==} + engines: {node: '>=12'} + cpu: [arm] + os: [android] + requiresBuild: true + dev: true + optional: true + + /@esbuild/android-x64@0.18.16: + resolution: {integrity: sha512-ldsTXolyA3eTQ1//4DS+E15xl0H/3DTRJaRL0/0PgkqDsI0fV/FlOtD+h0u/AUJr+eOTlZv4aC9gvfppo3C4sw==} + engines: {node: '>=12'} + cpu: [x64] + os: [android] + requiresBuild: true + dev: true + optional: true + + /@esbuild/darwin-arm64@0.18.16: + resolution: {integrity: sha512-aBxruWCII+OtluORR/KvisEw0ALuw/qDQWvkoosA+c/ngC/Kwk0lLaZ+B++LLS481/VdydB2u6tYpWxUfnLAIw==} + engines: {node: '>=12'} + cpu: [arm64] + os: [darwin] + requiresBuild: true + dev: true + optional: true + + /@esbuild/darwin-x64@0.18.16: + resolution: {integrity: sha512-6w4Dbue280+rp3LnkgmriS1icOUZDyPuZo/9VsuMUTns7SYEiOaJ7Ca1cbhu9KVObAWfmdjUl4gwy9TIgiO5eA==} + engines: {node: '>=12'} + cpu: [x64] + os: [darwin] + requiresBuild: true + dev: true + optional: true + + /@esbuild/freebsd-arm64@0.18.16: + resolution: {integrity: sha512-x35fCebhe9s979DGKbVAwXUOcTmCIE32AIqB9CB1GralMIvxdnMLAw5CnID17ipEw9/3MvDsusj/cspYt2ZLNQ==} + engines: {node: '>=12'} + cpu: [arm64] + os: [freebsd] + requiresBuild: true + dev: true + optional: true + + /@esbuild/freebsd-x64@0.18.16: + resolution: {integrity: sha512-YM98f+PeNXF3GbxIJlUsj+McUWG1irguBHkszCIwfr3BXtXZsXo0vqybjUDFfu9a8Wr7uUD/YSmHib+EeGAFlg==} + engines: {node: '>=12'} + cpu: [x64] + os: [freebsd] + requiresBuild: true + dev: true + optional: true + + /@esbuild/linux-arm64@0.18.16: + resolution: {integrity: sha512-XIqhNUxJiuy+zsR77+H5Z2f7s4YRlriSJKtvx99nJuG5ATuJPjmZ9n0ANgnGlPCpXGSReFpgcJ7O3SMtzIFeiQ==} + engines: {node: '>=12'} + cpu: [arm64] + os: [linux] + requiresBuild: true + dev: true + optional: true + + /@esbuild/linux-arm@0.18.16: + resolution: {integrity: sha512-b5ABb+5Ha2C9JkeZXV+b+OruR1tJ33ePmv9ZwMeETSEKlmu/WJ45XTTG+l6a2KDsQtJJ66qo/hbSGBtk0XVLHw==} + engines: {node: '>=12'} + cpu: [arm] + os: [linux] + requiresBuild: true + dev: true + optional: true + + /@esbuild/linux-ia32@0.18.16: + resolution: {integrity: sha512-no+pfEpwnRvIyH+txbBAWtjxPU9grslmTBfsmDndj7bnBmr55rOo/PfQmRfz7Qg9isswt1FP5hBbWb23fRWnow==} + engines: {node: '>=12'} + cpu: [ia32] + os: [linux] + requiresBuild: true + dev: true + optional: true + + /@esbuild/linux-loong64@0.18.16: + resolution: {integrity: sha512-Zbnczs9ZXjmo0oZSS0zbNlJbcwKXa/fcNhYQjahDs4Xg18UumpXG/lwM2lcSvHS3mTrRyCYZvJbmzYc4laRI1g==} + engines: {node: '>=12'} + cpu: [loong64] + os: [linux] + requiresBuild: true + dev: true + optional: true + + /@esbuild/linux-mips64el@0.18.16: + resolution: {integrity: sha512-YMF7hih1HVR/hQVa/ot4UVffc5ZlrzEb3k2ip0nZr1w6fnYypll9td2qcoMLvd3o8j3y6EbJM3MyIcXIVzXvQQ==} + engines: {node: '>=12'} + cpu: [mips64el] + os: [linux] + requiresBuild: true + dev: true + optional: true + + /@esbuild/linux-ppc64@0.18.16: + resolution: {integrity: sha512-Wkz++LZ29lDwUyTSEnzDaaP5OveOgTU69q9IyIw9WqLRxM4BjTBjz9un4G6TOvehWpf/J3gYVFN96TjGHrbcNQ==} + engines: {node: '>=12'} + cpu: [ppc64] + os: [linux] + requiresBuild: true + dev: true + optional: true + + /@esbuild/linux-riscv64@0.18.16: + resolution: {integrity: sha512-LFMKZ30tk78/mUv1ygvIP+568bwf4oN6reG/uczXnz6SvFn4e2QUFpUpZY9iSJT6Qpgstrhef/nMykIXZtZWGQ==} + engines: {node: '>=12'} + cpu: [riscv64] + os: [linux] + requiresBuild: true + dev: true + optional: true + + /@esbuild/linux-s390x@0.18.16: + resolution: {integrity: sha512-3ZC0BgyYHYKfZo3AV2/66TD/I9tlSBaW7eWTEIkrQQKfJIifKMMttXl9FrAg+UT0SGYsCRLI35Gwdmm96vlOjg==} + engines: {node: '>=12'} + cpu: [s390x] + os: [linux] + requiresBuild: true + dev: true + optional: true + + /@esbuild/linux-x64@0.18.16: + resolution: {integrity: sha512-xu86B3647DihHJHv/wx3NCz2Dg1gjQ8bbf9cVYZzWKY+gsvxYmn/lnVlqDRazObc3UMwoHpUhNYaZset4X8IPA==} + engines: {node: '>=12'} + cpu: [x64] + os: [linux] + requiresBuild: true + dev: true + optional: true + + /@esbuild/netbsd-x64@0.18.16: + resolution: {integrity: sha512-uVAgpimx9Ffw3xowtg/7qQPwHFx94yCje+DoBx+LNm2ePDpQXHrzE+Sb0Si2VBObYz+LcRps15cq+95YM7gkUw==} + engines: {node: '>=12'} + cpu: [x64] + os: [netbsd] + requiresBuild: true + dev: true + optional: true + + /@esbuild/openbsd-x64@0.18.16: + resolution: {integrity: sha512-6OjCQM9wf7z8/MBi6BOWaTL2AS/SZudsZtBziXMtNI8r/U41AxS9x7jn0ATOwVy08OotwkPqGRMkpPR2wcTJXA==} + engines: {node: '>=12'} + cpu: [x64] + os: [openbsd] + requiresBuild: true + dev: true + optional: true + + /@esbuild/sunos-x64@0.18.16: + resolution: {integrity: sha512-ZoNkruFYJp9d1LbUYCh8awgQDvB9uOMZqlQ+gGEZR7v6C+N6u7vPr86c+Chih8niBR81Q/bHOSKGBK3brJyvkQ==} + engines: {node: '>=12'} + cpu: [x64] + os: [sunos] + requiresBuild: true + dev: true + optional: true + + /@esbuild/win32-arm64@0.18.16: + resolution: {integrity: sha512-+j4anzQ9hrs+iqO+/wa8UE6TVkKua1pXUb0XWFOx0FiAj6R9INJ+WE//1/Xo6FG1vB5EpH3ko+XcgwiDXTxcdw==} + engines: {node: '>=12'} + cpu: [arm64] + os: [win32] + requiresBuild: true + dev: true + optional: true + + /@esbuild/win32-ia32@0.18.16: + resolution: {integrity: sha512-5PFPmq3sSKTp9cT9dzvI67WNfRZGvEVctcZa1KGjDDu4n3H8k59Inbk0du1fz0KrAbKKNpJbdFXQMDUz7BG4rQ==} + engines: {node: '>=12'} + cpu: [ia32] + os: [win32] + requiresBuild: true + dev: true + optional: true + + /@esbuild/win32-x64@0.18.16: + resolution: {integrity: sha512-sCIVrrtcWN5Ua7jYXNG1xD199IalrbfV2+0k/2Zf2OyV2FtnQnMgdzgpRAbi4AWlKJj1jkX+M+fEGPQj6BQB4w==} + engines: {node: '>=12'} + cpu: [x64] + os: [win32] + requiresBuild: true + dev: true + optional: true + + /@jridgewell/gen-mapping@0.3.3: + resolution: {integrity: sha512-HLhSWOLRi875zjjMG/r+Nv0oCW8umGb0BgEhyX3dDX3egwZtB8PqLnjz3yedt8R5StBrzcg4aBpnh8UA9D1BoQ==} + engines: {node: '>=6.0.0'} + dependencies: + '@jridgewell/set-array': 1.1.2 + '@jridgewell/sourcemap-codec': 1.4.15 + '@jridgewell/trace-mapping': 0.3.18 + dev: true + + /@jridgewell/resolve-uri@3.1.0: + resolution: {integrity: sha512-F2msla3tad+Mfht5cJq7LSXcdudKTWCVYUgw6pLFOOHSTtZlj6SWNYAp+AhuqLmWdBO2X5hPrLcu8cVP8fy28w==} + engines: {node: '>=6.0.0'} + dev: true + + /@jridgewell/set-array@1.1.2: + resolution: {integrity: sha512-xnkseuNADM0gt2bs+BvhO0p78Mk762YnZdsuzFV018NoG1Sj1SCQvpSqa7XUaTam5vAGasABV9qXASMKnFMwMw==} + engines: {node: '>=6.0.0'} + dev: true + + /@jridgewell/source-map@0.3.5: + resolution: {integrity: sha512-UTYAUj/wviwdsMfzoSJspJxbkH5o1snzwX0//0ENX1u/55kkZZkcTZP6u9bwKGkv+dkk9at4m1Cpt0uY80kcpQ==} + dependencies: + '@jridgewell/gen-mapping': 0.3.3 + '@jridgewell/trace-mapping': 0.3.18 + dev: true + + /@jridgewell/sourcemap-codec@1.4.14: + resolution: {integrity: sha512-XPSJHWmi394fuUuzDnGz1wiKqWfo1yXecHQMRf2l6hztTO+nPru658AyDngaBe7isIxEkRsPR3FZh+s7iVa4Uw==} + dev: true + + /@jridgewell/sourcemap-codec@1.4.15: + resolution: {integrity: sha512-eF2rxCRulEKXHTRiDrDy6erMYWqNw4LPdQ8UQA4huuxaQsVeRPFl2oM8oDGxMFhJUWZf9McpLtJasDDZb/Bpeg==} + + /@jridgewell/trace-mapping@0.3.18: + resolution: {integrity: sha512-w+niJYzMHdd7USdiH2U6869nqhD2nbfZXND5Yp93qIbEmnDNk7PD48o+YchRVpzMU7M6jVCbenTR7PA1FLQ9pA==} + dependencies: + '@jridgewell/resolve-uri': 3.1.0 + '@jridgewell/sourcemap-codec': 1.4.14 + dev: true + + /@vitejs/plugin-vue@4.2.3(vite@4.4.6)(vue@3.3.4): + resolution: {integrity: sha512-R6JDUfiZbJA9cMiguQ7jxALsgiprjBeHL5ikpXfJCH62pPHtI+JdJ5xWj6Ev73yXSlYl86+blXn1kZHQ7uElxw==} + engines: {node: ^14.18.0 || >=16.0.0} + peerDependencies: + vite: ^4.0.0 + vue: ^3.2.25 + dependencies: + vite: 4.4.6(sass@1.64.1)(terser@5.19.2) + vue: 3.3.4 + dev: true + + /@vue/compiler-core@3.3.4: + resolution: {integrity: sha512-cquyDNvZ6jTbf/+x+AgM2Arrp6G4Dzbb0R64jiG804HRMfRiFXWI6kqUVqZ6ZR0bQhIoQjB4+2bhNtVwndW15g==} + dependencies: + '@babel/parser': 7.22.7 + '@vue/shared': 3.3.4 + estree-walker: 2.0.2 + source-map-js: 1.0.2 + + /@vue/compiler-dom@3.3.4: + resolution: {integrity: sha512-wyM+OjOVpuUukIq6p5+nwHYtj9cFroz9cwkfmP9O1nzH68BenTTv0u7/ndggT8cIQlnBeOo6sUT/gvHcIkLA5w==} + dependencies: + '@vue/compiler-core': 3.3.4 + '@vue/shared': 3.3.4 + + /@vue/compiler-sfc@3.3.4: + resolution: {integrity: sha512-6y/d8uw+5TkCuzBkgLS0v3lSM3hJDntFEiUORM11pQ/hKvkhSKZrXW6i69UyXlJQisJxuUEJKAWEqWbWsLeNKQ==} + dependencies: + '@babel/parser': 7.22.7 + '@vue/compiler-core': 3.3.4 + '@vue/compiler-dom': 3.3.4 + '@vue/compiler-ssr': 3.3.4 + '@vue/reactivity-transform': 3.3.4 + '@vue/shared': 3.3.4 + estree-walker: 2.0.2 + magic-string: 0.30.1 + postcss: 8.4.27 + source-map-js: 1.0.2 + + /@vue/compiler-ssr@3.3.4: + resolution: {integrity: sha512-m0v6oKpup2nMSehwA6Uuu+j+wEwcy7QmwMkVNVfrV9P2qE5KshC6RwOCq8fjGS/Eak/uNb8AaWekfiXxbBB6gQ==} + dependencies: + '@vue/compiler-dom': 3.3.4 + '@vue/shared': 3.3.4 + + /@vue/devtools-api@6.5.0: + resolution: {integrity: sha512-o9KfBeaBmCKl10usN4crU53fYtC1r7jJwdGKjPT24t348rHxgfpZ0xL3Xm/gLUYnc0oTp8LAmrxOeLyu6tbk2Q==} + dev: false + + /@vue/reactivity-transform@3.3.4: + resolution: {integrity: sha512-MXgwjako4nu5WFLAjpBnCj/ieqcjE2aJBINUNQzkZQfzIZA4xn+0fV1tIYBJvvva3N3OvKGofRLvQIwEQPpaXw==} + dependencies: + '@babel/parser': 7.22.7 + '@vue/compiler-core': 3.3.4 + '@vue/shared': 3.3.4 + estree-walker: 2.0.2 + magic-string: 0.30.1 + + /@vue/reactivity@3.3.4: + resolution: {integrity: sha512-kLTDLwd0B1jG08NBF3R5rqULtv/f8x3rOFByTDz4J53ttIQEDmALqKqXY0J+XQeN0aV2FBxY8nJDf88yvOPAqQ==} + dependencies: + '@vue/shared': 3.3.4 + + /@vue/runtime-core@3.3.4: + resolution: {integrity: sha512-R+bqxMN6pWO7zGI4OMlmvePOdP2c93GsHFM/siJI7O2nxFRzj55pLwkpCedEY+bTMgp5miZ8CxfIZo3S+gFqvA==} + dependencies: + '@vue/reactivity': 3.3.4 + '@vue/shared': 3.3.4 + + /@vue/runtime-dom@3.3.4: + resolution: {integrity: sha512-Aj5bTJ3u5sFsUckRghsNjVTtxZQ1OyMWCr5dZRAPijF/0Vy4xEoRCwLyHXcj4D0UFbJ4lbx3gPTgg06K/GnPnQ==} + dependencies: + '@vue/runtime-core': 3.3.4 + '@vue/shared': 3.3.4 + csstype: 3.1.2 + + /@vue/server-renderer@3.3.4(vue@3.3.4): + resolution: {integrity: sha512-Q6jDDzR23ViIb67v+vM1Dqntu+HUexQcsWKhhQa4ARVzxOY2HbC7QRW/ggkDBd5BU+uM1sV6XOAP0b216o34JQ==} + peerDependencies: + vue: 3.3.4 + dependencies: + '@vue/compiler-ssr': 3.3.4 + '@vue/shared': 3.3.4 + vue: 3.3.4 + + /@vue/shared@3.3.4: + resolution: {integrity: sha512-7OjdcV8vQ74eiz1TZLzZP4JwqM5fA94K6yntPS5Z25r9HDuGNzaGdgvwKYq6S+MxwF0TFRwe50fIR/MYnakdkQ==} + + /acorn@8.10.0: + resolution: {integrity: sha512-F0SAmZ8iUtS//m8DmCTA0jlh6TDKkHQyK6xc6V4KDTyZKA9dnvX9/3sRTVQrWm79glUAZbnmmNcdYwUIHWVybw==} + engines: {node: '>=0.4.0'} + hasBin: true + dev: true + + /anymatch@3.1.3: + resolution: {integrity: sha512-KMReFUr0B4t+D+OBkjR3KYqvocp2XaSzO55UcB6mgQMd3KbcE+mWTyvVV7D/zsdEbNnV6acZUutkiHQXvTr1Rw==} + engines: {node: '>= 8'} + dependencies: + normalize-path: 3.0.0 + picomatch: 2.3.1 + + /asynckit@0.4.0: + resolution: {integrity: sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q==} + dev: false + + /axios-jsonp@1.0.4: + resolution: {integrity: sha512-KI5Fc4ery6DR+oneXG09hPZfGuNUW8Lblhe750h53Z0Eh5MRsrHn49YitDU4RsMk0HV+12zcvL2Q51QkOLGdIQ==} + dev: false + + /axios@1.4.0: + resolution: {integrity: sha512-S4XCWMEmzvo64T9GfvQDOXgYRDJ/wsSZc7Jvdgx5u1sd0JwsuPLqb3SYmusag+edF6ziyMensPVqLTSc1PiSEA==} + dependencies: + follow-redirects: 1.15.2 + form-data: 4.0.0 + proxy-from-env: 1.1.0 + transitivePeerDependencies: + - debug + dev: false + + /binary-extensions@2.2.0: + resolution: {integrity: sha512-jDctJ/IVQbZoJykoeHbhXpOlNBqGNcwXJKJog42E5HDPUwQTSdjCHdihjj0DlnheQ7blbT6dHOafNAiS8ooQKA==} + engines: {node: '>=8'} + + /braces@3.0.2: + resolution: {integrity: sha512-b8um+L1RzM3WDSzvhm6gIz1yfTbBt6YTlcEKAvsmqCZZFw46z626lVj9j1yEPW33H5H+lBQpZMP1k8l+78Ha0A==} + engines: {node: '>=8'} + dependencies: + fill-range: 7.0.1 + + /buffer-from@1.1.2: + resolution: {integrity: sha512-E+XQCRwSbaaiChtv6k6Dwgc+bx+Bs6vuKJHHl5kox/BaKbhiXzqQOwK4cO22yElGp2OCmjwVhT3HmxgyPGnJfQ==} + dev: true + + /chokidar@3.5.3: + resolution: {integrity: sha512-Dr3sfKRP6oTcjf2JmUmFJfeVMvXBdegxB0iVQ5eb2V10uFJUCAS8OByZdVAyVb8xXNz3GjjTgj9kLWsZTqE6kw==} + engines: {node: '>= 8.10.0'} + dependencies: + anymatch: 3.1.3 + braces: 3.0.2 + glob-parent: 5.1.2 + is-binary-path: 2.1.0 + is-glob: 4.0.3 + normalize-path: 3.0.0 + readdirp: 3.6.0 + optionalDependencies: + fsevents: 2.3.2 + + /combined-stream@1.0.8: + resolution: {integrity: sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg==} + engines: {node: '>= 0.8'} + dependencies: + delayed-stream: 1.0.0 + dev: false + + /commander@2.20.3: + resolution: {integrity: sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ==} + dev: true + + /csstype@3.1.2: + resolution: {integrity: sha512-I7K1Uu0MBPzaFKg4nI5Q7Vs2t+3gWWW648spaF+Rg7pI9ds18Ugn+lvg4SHczUdKlHI5LWBXyqfS8+DufyBsgQ==} + + /delayed-stream@1.0.0: + resolution: {integrity: sha512-ZySD7Nf91aLB0RxL4KGrKHBXl7Eds1DAmEdcoVawXnLD7SDhpNgtuII2aAkg7a7QS41jxPSZ17p4VdGnMHk3MQ==} + engines: {node: '>=0.4.0'} + dev: false + + /esbuild@0.18.16: + resolution: {integrity: sha512-1xLsOXrDqwdHxyXb/x/SOyg59jpf/SH7YMvU5RNSU7z3TInaASNJWNFJ6iRvLvLETZMasF3d1DdZLg7sgRimRQ==} + engines: {node: '>=12'} + hasBin: true + requiresBuild: true + optionalDependencies: + '@esbuild/android-arm': 0.18.16 + '@esbuild/android-arm64': 0.18.16 + '@esbuild/android-x64': 0.18.16 + '@esbuild/darwin-arm64': 0.18.16 + '@esbuild/darwin-x64': 0.18.16 + '@esbuild/freebsd-arm64': 0.18.16 + '@esbuild/freebsd-x64': 0.18.16 + '@esbuild/linux-arm': 0.18.16 + '@esbuild/linux-arm64': 0.18.16 + '@esbuild/linux-ia32': 0.18.16 + '@esbuild/linux-loong64': 0.18.16 + '@esbuild/linux-mips64el': 0.18.16 + '@esbuild/linux-ppc64': 0.18.16 + '@esbuild/linux-riscv64': 0.18.16 + '@esbuild/linux-s390x': 0.18.16 + '@esbuild/linux-x64': 0.18.16 + '@esbuild/netbsd-x64': 0.18.16 + '@esbuild/openbsd-x64': 0.18.16 + '@esbuild/sunos-x64': 0.18.16 + '@esbuild/win32-arm64': 0.18.16 + '@esbuild/win32-ia32': 0.18.16 + '@esbuild/win32-x64': 0.18.16 + dev: true + + /estree-walker@2.0.2: + resolution: {integrity: sha512-Rfkk/Mp/DL7JVje3u18FxFujQlTNR2q6QfMSMB7AvCBx91NGj/ba3kCfza0f6dVDbw7YlRf/nDrn7pQrCCyQ/w==} + + /fill-range@7.0.1: + resolution: {integrity: sha512-qOo9F+dMUmC2Lcb4BbVvnKJxTPjCm+RRpe4gDuGrzkL7mEVl/djYSu2OdQ2Pa302N4oqkSg9ir6jaLWJ2USVpQ==} + engines: {node: '>=8'} + dependencies: + to-regex-range: 5.0.1 + + /follow-redirects@1.15.2: + resolution: {integrity: sha512-VQLG33o04KaQ8uYi2tVNbdrWp1QWxNNea+nmIB4EVM28v0hmP17z7aG1+wAkNzVq4KeXTq3221ye5qTJP91JwA==} + engines: {node: '>=4.0'} + peerDependencies: + debug: '*' + peerDependenciesMeta: + debug: + optional: true + dev: false + + /form-data@4.0.0: + resolution: {integrity: sha512-ETEklSGi5t0QMZuiXoA/Q6vcnxcLQP5vdugSpuAyi6SVGi2clPPp+xgEhuMaHC+zGgn31Kd235W35f7Hykkaww==} + engines: {node: '>= 6'} + dependencies: + asynckit: 0.4.0 + combined-stream: 1.0.8 + mime-types: 2.1.35 + dev: false + + /fsevents@2.3.2: + resolution: {integrity: sha512-xiqMQR4xAeHTuB9uWm+fFRcIOgKBMiOBP+eXiyT7jsgVCq1bkVygt00oASowB7EdtpOHaaPgKt812P9ab+DDKA==} + engines: {node: ^8.16.0 || ^10.6.0 || >=11.0.0} + os: [darwin] + requiresBuild: true + optional: true + + /glob-parent@5.1.2: + resolution: {integrity: sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow==} + engines: {node: '>= 6'} + dependencies: + is-glob: 4.0.3 + + /immutable@4.3.1: + resolution: {integrity: sha512-lj9cnmB/kVS0QHsJnYKD1uo3o39nrbKxszjnqS9Fr6NB7bZzW45U6WSGBPKXDL/CvDKqDNPA4r3DoDQ8GTxo2A==} + + /is-binary-path@2.1.0: + resolution: {integrity: sha512-ZMERYes6pDydyuGidse7OsHxtbI7WVeUEozgR/g7rd0xUimYNlvZRE/K2MgZTjWy725IfelLeVcEM97mmtRGXw==} + engines: {node: '>=8'} + dependencies: + binary-extensions: 2.2.0 + + /is-extglob@2.1.1: + resolution: {integrity: sha512-SbKbANkN603Vi4jEZv49LeVJMn4yGwsbzZworEoyEiutsN3nJYdbO36zfhGJ6QEDpOZIFkDtnq5JRxmvl3jsoQ==} + engines: {node: '>=0.10.0'} + + /is-glob@4.0.3: + resolution: {integrity: sha512-xelSayHH36ZgE7ZWhli7pW34hNbNl8Ojv5KVmkJD4hBdD3th8Tfk9vYasLM+mXWOZhFkgZfxhLSnrwRr4elSSg==} + engines: {node: '>=0.10.0'} + dependencies: + is-extglob: 2.1.1 + + /is-number@7.0.0: + resolution: {integrity: sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==} + engines: {node: '>=0.12.0'} + + /magic-string@0.30.1: + resolution: {integrity: sha512-mbVKXPmS0z0G4XqFDCTllmDQ6coZzn94aMlb0o/A4HEHJCKcanlDZwYJgwnkmgD3jyWhUgj9VsPrfd972yPffA==} + engines: {node: '>=12'} + dependencies: + '@jridgewell/sourcemap-codec': 1.4.15 + + /mime-db@1.52.0: + resolution: {integrity: sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg==} + engines: {node: '>= 0.6'} + dev: false + + /mime-types@2.1.35: + resolution: {integrity: sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw==} + engines: {node: '>= 0.6'} + dependencies: + mime-db: 1.52.0 + dev: false + + /nanoid@3.3.6: + resolution: {integrity: sha512-BGcqMMJuToF7i1rt+2PWSNVnWIkGCU78jBG3RxO/bZlnZPK2Cmi2QaffxGO/2RvWi9sL+FAiRiXMgsyxQ1DIDA==} + engines: {node: ^10 || ^12 || ^13.7 || ^14 || >=15.0.1} + hasBin: true + + /normalize-path@3.0.0: + resolution: {integrity: sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA==} + engines: {node: '>=0.10.0'} + + /picocolors@1.0.0: + resolution: {integrity: sha512-1fygroTLlHu66zi26VoTDv8yRgm0Fccecssto+MhsZ0D/DGW2sm8E8AjW7NU5VVTRt5GxbeZ5qBuJr+HyLYkjQ==} + + /picomatch@2.3.1: + resolution: {integrity: sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==} + engines: {node: '>=8.6'} + + /pinia-plugin-persistedstate@3.2.0(pinia@2.1.4): + resolution: {integrity: sha512-tZbNGf2vjAQcIm7alK40sE51Qu/m9oWr+rEgNm/2AWr1huFxj72CjvpQcIQzMknDBJEkQznCLAGtJTIcLKrKdw==} + peerDependencies: + pinia: ^2.0.0 + dependencies: + pinia: 2.1.4(vue@3.3.4) + dev: false + + /pinia@2.1.4(vue@3.3.4): + resolution: {integrity: sha512-vYlnDu+Y/FXxv1ABo1vhjC+IbqvzUdiUC3sfDRrRyY2CQSrqqaa+iiHmqtARFxJVqWQMCJfXx1PBvFs9aJVLXQ==} + peerDependencies: + '@vue/composition-api': ^1.4.0 + typescript: '>=4.4.4' + vue: ^2.6.14 || ^3.3.0 + peerDependenciesMeta: + '@vue/composition-api': + optional: true + typescript: + optional: true + dependencies: + '@vue/devtools-api': 6.5.0 + vue: 3.3.4 + vue-demi: 0.14.5(vue@3.3.4) + dev: false + + /postcss@8.4.27: + resolution: {integrity: sha512-gY/ACJtJPSmUFPDCHtX78+01fHa64FaU4zaaWfuh1MhGJISufJAH4cun6k/8fwsHYeK4UQmENQK+tRLCFJE8JQ==} + engines: {node: ^10 || ^12 || >=14} + dependencies: + nanoid: 3.3.6 + picocolors: 1.0.0 + source-map-js: 1.0.2 + + /proxy-from-env@1.1.0: + resolution: {integrity: sha512-D+zkORCbA9f1tdWRK0RaCR3GPv50cMxcrz4X8k5LTSUD1Dkw47mKJEZQNunItRTkWwgtaUSo1RVFRIG9ZXiFYg==} + dev: false + + /readdirp@3.6.0: + resolution: {integrity: sha512-hOS089on8RduqdbhvQ5Z37A0ESjsqz6qnRcffsMU3495FuTdqSm+7bhJ29JvIOsBDEEnan5DPu9t3To9VRlMzA==} + engines: {node: '>=8.10.0'} + dependencies: + picomatch: 2.3.1 + + /rollup@3.26.3: + resolution: {integrity: sha512-7Tin0C8l86TkpcMtXvQu6saWH93nhG3dGQ1/+l5V2TDMceTxO7kDiK6GzbfLWNNxqJXm591PcEZUozZm51ogwQ==} + engines: {node: '>=14.18.0', npm: '>=8.0.0'} + hasBin: true + optionalDependencies: + fsevents: 2.3.2 + dev: true + + /sass@1.64.1: + resolution: {integrity: sha512-16rRACSOFEE8VN7SCgBu1MpYCyN7urj9At898tyzdXFhC+a+yOX5dXwAR7L8/IdPJ1NB8OYoXmD55DM30B2kEQ==} + engines: {node: '>=14.0.0'} + hasBin: true + dependencies: + chokidar: 3.5.3 + immutable: 4.3.1 + source-map-js: 1.0.2 + + /source-map-js@1.0.2: + resolution: {integrity: sha512-R0XvVJ9WusLiqTCEiGCmICCMplcCkIwwR11mOSD9CR5u+IXYdiseeEuXCVAjS54zqwkLcPNnmU4OeJ6tUrWhDw==} + engines: {node: '>=0.10.0'} + + /source-map-support@0.5.21: + resolution: {integrity: sha512-uBHU3L3czsIyYXKX88fdrGovxdSCoTGDRZ6SYXtSRxLZUzHg5P/66Ht6uoUlHu9EZod+inXhKo3qQgwXUT/y1w==} + dependencies: + buffer-from: 1.1.2 + source-map: 0.6.1 + dev: true + + /source-map@0.6.1: + resolution: {integrity: sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==} + engines: {node: '>=0.10.0'} + dev: true + + /terser@5.19.2: + resolution: {integrity: sha512-qC5+dmecKJA4cpYxRa5aVkKehYsQKc+AHeKl0Oe62aYjBL8ZA33tTljktDHJSaxxMnbI5ZYw+o/S2DxxLu8OfA==} + engines: {node: '>=10'} + hasBin: true + dependencies: + '@jridgewell/source-map': 0.3.5 + acorn: 8.10.0 + commander: 2.20.3 + source-map-support: 0.5.21 + dev: true + + /to-fast-properties@2.0.0: + resolution: {integrity: sha512-/OaKK0xYrs3DmxRYqL/yDc+FxFUVYhDlXMhRmv3z915w2HF1tnN1omB354j8VUGO/hbRzyD6Y3sA7v7GS/ceog==} + engines: {node: '>=4'} + + /to-regex-range@5.0.1: + resolution: {integrity: sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==} + engines: {node: '>=8.0'} + dependencies: + is-number: 7.0.0 + + /vite@4.4.6(sass@1.64.1)(terser@5.19.2): + resolution: {integrity: sha512-EY6Mm8vJ++S3D4tNAckaZfw3JwG3wa794Vt70M6cNJ6NxT87yhq7EC8Rcap3ahyHdo8AhCmV9PTk+vG1HiYn1A==} + engines: {node: ^14.18.0 || >=16.0.0} + hasBin: true + peerDependencies: + '@types/node': '>= 14' + less: '*' + lightningcss: ^1.21.0 + sass: '*' + stylus: '*' + sugarss: '*' + terser: ^5.4.0 + peerDependenciesMeta: + '@types/node': + optional: true + less: + optional: true + lightningcss: + optional: true + sass: + optional: true + stylus: + optional: true + sugarss: + optional: true + terser: + optional: true + dependencies: + esbuild: 0.18.16 + postcss: 8.4.27 + rollup: 3.26.3 + sass: 1.64.1 + terser: 5.19.2 + optionalDependencies: + fsevents: 2.3.2 + dev: true + + /vue-demi@0.14.5(vue@3.3.4): + resolution: {integrity: sha512-o9NUVpl/YlsGJ7t+xuqJKx8EBGf1quRhCiT6D/J0pfwmk9zUwYkC7yrF4SZCe6fETvSM3UNL2edcbYrSyc4QHA==} + engines: {node: '>=12'} + hasBin: true + requiresBuild: true + peerDependencies: + '@vue/composition-api': ^1.0.0-rc.1 + vue: ^3.0.0-0 || ^2.6.0 + peerDependenciesMeta: + '@vue/composition-api': + optional: true + dependencies: + vue: 3.3.4 + dev: false + + /vue@3.3.4: + resolution: {integrity: sha512-VTyEYn3yvIeY1Py0WaYGZsXnz3y5UnGi62GjVEqvEGPl6nxbOrCXbVOTQWBEJUqAyTUk2uJ5JLVnYJ6ZzGbrSw==} + dependencies: + '@vue/compiler-dom': 3.3.4 + '@vue/compiler-sfc': 3.3.4 + '@vue/runtime-dom': 3.3.4 + '@vue/server-renderer': 3.3.4(vue@3.3.4) + '@vue/shared': 3.3.4 diff --git a/public/background/bg1.jpg b/public/background/bg1.jpg new file mode 100644 index 0000000..d1c9d6c Binary files /dev/null and b/public/background/bg1.jpg differ diff --git a/public/background/bg2.jpg b/public/background/bg2.jpg new file mode 100644 index 0000000..606549b Binary files /dev/null and b/public/background/bg2.jpg differ diff --git a/public/background/bg3.jpg b/public/background/bg3.jpg new file mode 100644 index 0000000..0bf0bd7 Binary files /dev/null and b/public/background/bg3.jpg differ diff --git a/img/icon/favicon_64.png b/public/favicon.png similarity index 100% rename from img/icon/favicon_64.png rename to public/favicon.png diff --git a/img/icon/favicon_128.png b/public/icon/logo.png similarity index 100% rename from img/icon/favicon_128.png rename to public/icon/logo.png diff --git a/src/App.vue b/src/App.vue new file mode 100644 index 0000000..c2c3187 --- /dev/null +++ b/src/App.vue @@ -0,0 +1,56 @@ + + + + + diff --git a/src/api/index.js b/src/api/index.js new file mode 100644 index 0000000..2c9e15b --- /dev/null +++ b/src/api/index.js @@ -0,0 +1,32 @@ +import axios from "@/utils/request"; +import jsonpAdapter from "axios-jsonp"; + +/** + * 获取天气 + * https://api.oioweb.cn/doc/weather/GetWeather + */ +export const getWeather = () => { + return axios({ + method: "GET", + url: "https://api.oioweb.cn/api/weather/GetWeather", + }); +}; + +/** + * 获取搜索建议 + * https://suggestion.baidu.com + * @param {String} keyWord - 搜索关键字 + */ +export const getSearchSuggestions = async (keyWord) => { + try { + const response = await axios({ + url: `https://suggestion.baidu.com/su?wd=${keyWord}&cb=json`, + adapter: jsonpAdapter, + callbackParamName: "cb", + }); + return response.s; + } catch (error) { + console.error("处理搜索建议发生错误:", error); + return null; + } +}; diff --git a/src/components/Cover.vue b/src/components/Cover.vue new file mode 100644 index 0000000..e68a5f9 --- /dev/null +++ b/src/components/Cover.vue @@ -0,0 +1,111 @@ + + + + + diff --git a/src/components/Footer.vue b/src/components/Footer.vue new file mode 100644 index 0000000..9a16cf2 --- /dev/null +++ b/src/components/Footer.vue @@ -0,0 +1,17 @@ + + + diff --git a/src/components/SearchInp.vue b/src/components/SearchInp.vue new file mode 100644 index 0000000..b2ccb19 --- /dev/null +++ b/src/components/SearchInp.vue @@ -0,0 +1,189 @@ + + + + + diff --git a/src/components/SearchSuggestions.vue b/src/components/SearchSuggestions.vue new file mode 100644 index 0000000..46780ea --- /dev/null +++ b/src/components/SearchSuggestions.vue @@ -0,0 +1,164 @@ + + + + + diff --git a/src/components/Setting.vue b/src/components/Setting.vue new file mode 100644 index 0000000..e69de29 diff --git a/src/components/SvgIcon.vue b/src/components/SvgIcon.vue new file mode 100644 index 0000000..8cd18d0 --- /dev/null +++ b/src/components/SvgIcon.vue @@ -0,0 +1,43 @@ + + + + + diff --git a/src/components/WeatherTime.vue b/src/components/WeatherTime.vue new file mode 100644 index 0000000..4ba2a82 --- /dev/null +++ b/src/components/WeatherTime.vue @@ -0,0 +1,170 @@ + + + + + diff --git a/src/main.js b/src/main.js new file mode 100644 index 0000000..6563a82 --- /dev/null +++ b/src/main.js @@ -0,0 +1,23 @@ +import { createApp } from "vue"; +// Pinia +import { createPinia } from "pinia"; +import piniaPluginPersistedstate from "pinia-plugin-persistedstate"; +// IconFont +import SvgIcon from "@/components/SvgIcon.vue"; +import "@/utils/iconfont.js"; + +import App from "@/App.vue"; + +// 全局样式 +import "@/style/global.scss"; + +const app = createApp(App); + +// Pinia +const pinia = createPinia(); +pinia.use(piniaPluginPersistedstate); + +// 挂载 +app.use(pinia); +app.component("SvgIcon", SvgIcon); +app.mount("#app"); diff --git a/src/stores/index.js b/src/stores/index.js new file mode 100644 index 0000000..43ed26c --- /dev/null +++ b/src/stores/index.js @@ -0,0 +1,6 @@ +// Pinia +import useSetDataStore from "@/stores/setData"; +import useStatusDataStore from "@/stores/statusData"; + +export const setStore = () => useSetDataStore(); +export const statusStore = () => useStatusDataStore(); diff --git a/src/stores/setData.js b/src/stores/setData.js new file mode 100644 index 0000000..f0aa897 --- /dev/null +++ b/src/stores/setData.js @@ -0,0 +1,30 @@ +import { defineStore } from "pinia"; + +const useSetDataStore = defineStore("setData", { + state: () => { + return { + // 壁纸类别 + // 0 本地 / 1 必应 / 2 随机风景 / 3 随机动漫 / 4 自定义 + backgroundType: 0, + // 壁纸遮罩 + showBackgroundGray: true, + // 清空搜索框 + showCleanInput: true, + // 搜索框自动 focus + autoFocus: false, + // 时间样式 + timeStyle: "one", + // 是否显秒 + showSeconds: false, + // 是否显示搜索建议 + showSuggestions: true, + }; + }, + // 开启数据持久化 + persist: { + key: "setData", + storage: window.localStorage, + }, +}); + +export default useSetDataStore; diff --git a/src/stores/statusData.js b/src/stores/statusData.js new file mode 100644 index 0000000..0f77f95 --- /dev/null +++ b/src/stores/statusData.js @@ -0,0 +1,24 @@ +import { defineStore } from "pinia"; + +const useStatusDataStore = defineStore("statusData", { + state: () => { + return { + // 壁纸状态 + imgLoadStatus: false, + // 站点状态 + // normal 正常 / focus 搜索 / box 盒子 / set 设置 + siteStatus: "normal", + }; + }, + getters: {}, + actions: { + setImgLoadStatus(value) { + this.imgLoadStatus = value; + }, + setSiteStatus(value) { + this.siteStatus = value; + }, + }, +}); + +export default useStatusDataStore; diff --git a/src/style/global.scss b/src/style/global.scss new file mode 100644 index 0000000..86111e5 --- /dev/null +++ b/src/style/global.scss @@ -0,0 +1,131 @@ +:root { + --body-background-color: #333333; + --main-text-color: #ffffff; + --main-text-hover-color: #555555; + --main-background-color: #00000040; + --main-background-light-color: #ffffff30; + --main-background-hover-color: #ffffff; + --main-text-shadow: 0px 0px 8px #00000066; +} + +* { + margin: 0; + padding: 0; + user-select: none; +} + +html, +body { + width: 100%; + height: 100%; + background-color: var(--body-background-color); + overflow: hidden; + font-family: "HarmonyOS_Regular", sans-serif; +} + +#app { + width: 100vw; + height: 100vh; +} + +::selection { + color: var(--main-text-color); + background-color: var(--main-text-hover-color); +} + +// Transition 动画 +.fade-enter-active, +.fade-leave-active { + transition: opacity 0.3s ease; +} + +.fade-enter-from, +.fade-leave-to { + opacity: 0; +} + +.fadeUp-enter-active, +.fadeUp-leave-active { + transition: opacity 0.3s ease, transform 0.3s ease-in-out; +} + +.fadeUp-enter-from, +.fadeUp-leave-to { + opacity: 0; + transform: translateY(10px); +} + +.show-enter-active, +.show-leave-active { + transition: opacity 0.25s ease, transform 0.25s ease-in-out; +} + +.show-enter-from, +.show-leave-to { + opacity: 0; + transform: scale(0.6); +} + +// 全局动画 +@keyframes fade-up-in { + 0% { + opacity: 0; + } + 30% { + opacity: 0; + transform: translateY(30px); + } + 100% { + opacity: 1; + transform: translateY(0); + } +} + +@keyframes fade-time-in { + 0% { + opacity: 0; + } + 20% { + opacity: 0; + transform: translateY(-90px); + } + 100% { + opacity: 1; + transform: translateY(-140px); + } +} + +@keyframes fade-blur-in { + from { + filter: blur(20px) brightness(0.4); + transform: scale(1.2); + } + to { + filter: blur(0) brightness(1); + transform: scale(1); + } +} + +@keyframes separator-breathe { + 0% { + opacity: 0.8; + } + 70% { + opacity: 0.8; + } + 100% { + opacity: 0.2; + } +} + +@keyframes logo-breathe { + 0% { + transform: scale(1); + } + 50% { + transform: scale(1.1); + } + 100% { + transform: scale(1); + } +} diff --git a/src/utils/debounce.js b/src/utils/debounce.js new file mode 100644 index 0000000..bd9936e --- /dev/null +++ b/src/utils/debounce.js @@ -0,0 +1,22 @@ +/** + * 防抖函数 + * @param {Function} func - 要进行防抖处理的函数 + * @param {number} delay - 延迟时间,单位毫秒 + * @returns {Function} - 返回一个新的函数,该函数在指定的时间间隔内最多只会执行一次 + */ +const debounce = (func, delay) => { + let timerId; + + // 返回一个新的函数 + return (...args) => { + // 清除上一个定时器 + clearTimeout(timerId); + + // 设置新的定时器,在指定的延迟时间后执行函数 + timerId = setTimeout(() => { + func.apply(this, args); + }, delay); + }; +}; + +export default debounce; diff --git a/src/utils/iconfont.js b/src/utils/iconfont.js new file mode 100644 index 0000000..718886d --- /dev/null +++ b/src/utils/iconfont.js @@ -0,0 +1 @@ +window._iconfont_svg_string_4182315='',function(t){var c=(c=document.getElementsByTagName("script"))[c.length-1],l=c.getAttribute("data-injectcss"),c=c.getAttribute("data-disable-injectsvg");if(!c){var i,e,o,n,a,s=function(c,l){l.parentNode.insertBefore(c,l)};if(l&&!t.__iconfont__svg__cssinject__){t.__iconfont__svg__cssinject__=!0;try{document.write("")}catch(c){console&&console.log(c)}}i=function(){var c,l=document.createElement("div");l.innerHTML=t._iconfont_svg_string_4182315,(l=l.getElementsByTagName("svg")[0])&&(l.setAttribute("aria-hidden","true"),l.style.position="absolute",l.style.width=0,l.style.height=0,l.style.overflow="hidden",l=l,(c=document.body).firstChild?s(l,c.firstChild):c.appendChild(l))},document.addEventListener?~["complete","loaded","interactive"].indexOf(document.readyState)?setTimeout(i,0):(e=function(){document.removeEventListener("DOMContentLoaded",e,!1),i()},document.addEventListener("DOMContentLoaded",e,!1)):document.attachEvent&&(o=i,n=t.document,a=!1,h(),n.onreadystatechange=function(){"complete"==n.readyState&&(n.onreadystatechange=null,d())})}function d(){a||(a=!0,o())}function h(){try{n.documentElement.doScroll("left")}catch(c){return void setTimeout(h,50)}d()}}(window); \ No newline at end of file diff --git a/src/utils/request.js b/src/utils/request.js new file mode 100644 index 0000000..ef1dc36 --- /dev/null +++ b/src/utils/request.js @@ -0,0 +1,35 @@ +import axios from "axios"; + +// 全局配置 +axios.defaults.timeout = 30000; +axios.defaults.headers.common["X-Requested-With"] = "XMLHttpRequest"; +axios.defaults.withCredentials = false; + +// 请求拦截 +axios.interceptors.request.use( + (request) => { + return request; + }, + (error) => { + console.error("请求失败,请稍后重试"); + return Promise.reject(error); + } +); + +// 响应拦截 +axios.interceptors.response.use( + (response) => { + return response.data; + }, + (error) => { + if (error.response) { + const data = error.response?.data; + console.error("请求失败,请稍后重试:" + data); + } else { + console.error("请求失败,请稍后重试:" + error); + } + return Promise.reject(error); + } +); + +export default axios; diff --git a/src/utils/timeTools.js b/src/utils/timeTools.js new file mode 100644 index 0000000..0ea3de4 --- /dev/null +++ b/src/utils/timeTools.js @@ -0,0 +1,29 @@ +/** + * 获取当前时间 + * @returns {Object} 时间对象 + */ +export const getCurrentTime = () => { + const time = new Date(); + // 格式化 + const formatTime = (value) => (value < 10 ? "0" + value : value); + // 处理时间 + const year = time.getFullYear(); + const month = time.getMonth() + 1; + const day = formatTime(time.getDate()); + const hour = formatTime(time.getHours()); + const minute = formatTime(time.getMinutes()); + const second = formatTime(time.getSeconds()); + const weekdayArr = ["日", "一", "二", "三", "四", "五", "六"]; + const weekday = "周" + weekdayArr[time.getDay()]; + // 返回时间 + const currentTime = { + year, + month, + day, + hour, + minute, + second, + weekday, + }; + return currentTime; +}; diff --git a/vercel.json b/vercel.json deleted file mode 100644 index e42aa0f..0000000 --- a/vercel.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "version": 2, - "routes": [{ - "handle": "filesystem" - }, - { - "src": "/(.*)", - "status": 404, - "dest": "/" - } - ] -} diff --git a/vite.config.js b/vite.config.js new file mode 100644 index 0000000..42c1e4c --- /dev/null +++ b/vite.config.js @@ -0,0 +1,28 @@ +import { defineConfig } from "vite"; +import vue from "@vitejs/plugin-vue"; +import path from "path"; + +// https://vitejs.dev/config/ +export default defineConfig({ + plugins: [vue()], + server: { + host: "0.0.0.0", + port: 5588, + open: true, + }, + resolve: { + // 配置路径别名 + alias: { + "@": path.resolve(__dirname, "./src"), + }, + }, + build: { + minify: "terser", + terserOptions: { + compress: { + // 生产环境时移除 console + pure_funcs: ["console.log"], + }, + }, + }, +});