0"
cdkDropList
(cdkDropListDropped)="handleDrop($event)"
diff --git a/src/components/web-list/index.component.scss b/src/components/web-list/index.component.scss
index 2a7690bb5d..338744ca98 100644
--- a/src/components/web-list/index.component.scss
+++ b/src/components/web-list/index.component.scss
@@ -1,8 +1,17 @@
+@media (max-width: 768px) {
+ .container.overflowScroll {
+ padding: 0;
+ flex-wrap: nowrap;
+ overflow: hidden;
+ overflow-x: auto;
+ }
+}
+
.container {
margin-top: 15px;
margin-bottom: 15px;
display: flex;
- padding: 0 30px;
+ padding: 0 10px;
max-width: 960px;
flex-wrap: wrap;
gap: 25px;
diff --git a/src/components/web-list/index.component.ts b/src/components/web-list/index.component.ts
index 78734f0d79..c4a097073d 100644
--- a/src/components/web-list/index.component.ts
+++ b/src/components/web-list/index.component.ts
@@ -19,6 +19,7 @@ let DEFAULT_WEBSITE: Array
= []
export class WebListComponent implements OnInit {
@Input() max: number = 110
@Input() search = true
+ @Input() overflow = false
websiteList: INavProps[] = websiteList
dataList: IWebProps[] = []
diff --git a/src/styles.scss b/src/styles.scss
index 1dd87b7d8d..53d26a550f 100644
--- a/src/styles.scss
+++ b/src/styles.scss
@@ -133,7 +133,7 @@ b {
.down-arrow {
display: inline-block;
align-self: center;
- margin-left: 15px;
+ margin-left: 5px;
cursor: pointer;
transition: 0.1s linear;
color: #666;
diff --git a/src/view/side/index.component.html b/src/view/side/index.component.html
index 01ac406282..48712b6855 100644
--- a/src/view/side/index.component.html
+++ b/src/view/side/index.component.html
@@ -51,13 +51,12 @@
[autoplay]="settings.sideThemeAutoplay"
[height]="settings.sideThemeHeight"
/>
-
-
-
+
0; else noData">
diff --git a/src/view/side/index.component.scss b/src/view/side/index.component.scss
index bd986c8e7d..89e3dd5f54 100644
--- a/src/view/side/index.component.scss
+++ b/src/view/side/index.component.scss
@@ -1,8 +1,4 @@
@media (max-width: 768px) {
- .search-sm {
- display: block;
- margin-top: 10px;
- }
.content {
padding-right: 12px !important;
}
@@ -37,16 +33,6 @@
z-index: 9;
position: relative;
text-align: center;
- ::ng-deep .search-engine {
- z-index: 10;
- position: absolute;
- top: 50%;
- left: 50%;
- transform: translate(-50%, -50%);
- .input-wrapper {
- width: 330px !important;
- }
- }
}
}
@@ -73,7 +59,7 @@
.ant-menu-item {
padding-right: 40px;
- padding-left: 32px !important;
+ padding-left: 38px !important;
}
::ng-deep.ant-menu-title-content {
display: flex;
diff --git a/src/view/system/index.component.html b/src/view/system/index.component.html
index 556f1e04eb..88c7c7c3d0 100644
--- a/src/view/system/index.component.html
+++ b/src/view/system/index.component.html
@@ -89,6 +89,12 @@
{{ $t('_logout') }}
+
+
+
{{ date }}
diff --git a/src/view/system/index.component.ts b/src/view/system/index.component.ts
index ce0cdcd2b4..40fb511834 100644
--- a/src/view/system/index.component.ts
+++ b/src/view/system/index.component.ts
@@ -6,6 +6,7 @@ import { Component } from '@angular/core'
import { $t } from 'src/locale'
import { isLogin, userLogout } from 'src/utils/user'
import { Router } from '@angular/router'
+import { VERSION } from 'src/constants'
@Component({
selector: 'app-system',
@@ -17,6 +18,8 @@ export default class SystemComponent {
isLogin: boolean = isLogin
showLoginModal: boolean = !isLogin
currentMenu: string = ''
+ date = document.getElementById('META-NAV')?.dataset?.['date'] || ''
+ currentVersionSrc = `https://img.shields.io/badge/current-v${VERSION}-red.svg?longCache=true&style=flat-square`
constructor(private router: Router) {}
diff --git a/src/view/system/info/index.component.ts b/src/view/system/info/index.component.ts
index 49696cd0ca..794cb0db75 100644
--- a/src/view/system/info/index.component.ts
+++ b/src/view/system/info/index.component.ts
@@ -18,7 +18,7 @@ export default class SystemInfoComponent {
token = getToken()
config = config
date = document.getElementById('META-NAV')?.dataset?.['date'] || $t('_unknow')
- currentVersionSrc = `https://img.shields.io/badge/release-v${VERSION}-red.svg?longCache=true&style=flat-square`
+ currentVersionSrc = `https://img.shields.io/badge/current-v${VERSION}-red.svg?longCache=true&style=flat-square`
constructor() {}
From 3be29fd28396b097134fdef2bb6dc0a78e4f27b1 Mon Sep 17 00:00:00 2001
From: xjh22222228
Date: Sun, 28 Jul 2024 12:10:24 +0800
Subject: [PATCH 13/71] docs: update
---
README.md | 9 +--
README_en.md | 153 ---------------------------------------------------
2 files changed, 2 insertions(+), 160 deletions(-)
delete mode 100644 README_en.md
diff --git a/README.md b/README.md
index 2513647b0e..6f18cc5a0b 100644
--- a/README.md
+++ b/README.md
@@ -201,13 +201,8 @@ Thank you for your [contribution](https://github.com/xjh22222228/nav/issues), me
感谢您的认可:
-| ID | 支持金额 |
-| --------------------------------------- |----------- |
-| [aiyou9](https://github.com/aiyou9) | ¥ 100 |
-| [lastares](https://github.com/lastares) | ¥ 25.00 |
-| [MrJxySteven](https://github.com/MrJxySteven) | ¥ 20.00 |
-| [admol](https://github.com/admol) | ¥ 6.66 |
-| 路人甲 | ¥ 50.00 |
+
+
## License
diff --git a/README_en.md b/README_en.md
deleted file mode 100644
index 48102bea94..0000000000
--- a/README_en.md
+++ /dev/null
@@ -1,153 +0,0 @@
-
-
-
-
-
- Discovery Navigation
-
A purely static, powerful navigation website that supports SEO and online editing, I hope you will like it
- Built-in collection of up to 800+ high-quality websites to help you work, study and live
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-## Preview
-
-- [https://nav3.cn/](https://nav3.cn/)
-- [https://faxian.vercel.app/](https://faxian.vercel.app/)
-- [https://xjh22222228.github.io/nav-web/](https://xjh22222228.github.io/nav-web/)
-
-
-
-
-
-
-
-
-
-## Features
-
-`Discovery Navigation The idea is to make it simple and convenient without relying on back-end services, without complicated configuration and database configuration concepts, so it can be used out of the box.
-
-- 🍰 Built-in 800+utility sites.
-- 🍰 Support SEO.
-- 🍰 It is completely static and provides automatic deployment functions.
-- 🍰 The trigeminal tree has a clear structure and clear classification.
-- 🍰 Support one website to associate multiple URLs
-- 🍰 The coexistence of beauty and simplicity is no longer the era of killing Matt.
-- 🍰 Completely open source, easy to customize.
-- 🍰 Support multiple browsing modes and innovation.
-- 🍰 Support footprint memory.
-- 🍰 Support mobile browsing.
-- 🍰 Support search query.
-- 🍰 Support custom engine search.
-- 🍰 A variety of theme switching.
-- 🍰 Support dark mode.
-- 🍰 Support background management, no need to deploy.
-- 🍰 Support import from Chrome bookmarks
-
-## Deploy
-
-Its as easy as counting numbers "3 2 1" that simple!
-
-#### Method one (github-pages free)
-
-1、Fork the current project.
-
-2、[https://github.com/settings/tokens](https://github.com/settings/tokens) apply for a token, check the corresponding permissions, if you don’t understand, select all, copy and save the token.
-
-3、https://github.com/username/nav/settings/secrets/actions/new Create a new application token, name fill in TOKEN (All are uppercase).
-
-4、Go to https://github.com/username/nav/actions
-
-5、Be sure to modify the project configuration file [nav.config.ts](nav.config.ts)
-
-6、After 5 minutes, open https://username.github.io/nav , you will see a very powerful navigation website.
-
-#### Method 2 (Free Vercel)
-
-The steps are the same as the first method, except that the fourth step is not needed.
-For specific use, follow the steps [https://github.com/apps/vercel](https://github.com/apps/vercel)
-
-#### Method 3 (Free Netlify)
-
-[https://www.netlify.com/](https://www.netlify.com/)
-
-## System admin
-
-Modify the routing address to `system`, such as: https://www.nav3.cn/#/light Change to https://www.nav3.cn/#/system
-
-## Bookmark import
-
-Support importing from Chrome bookmarks (WebKit kernel should be supported~), it will automatically detect navigation that meets the three-level classification, and all others will be set as unclassified:
-
-
-
-The browser opens chrome://bookmarks/ to export the bookmarks to get the html file, and then import it from the background of the navigation website.
-
-## Upgrade
-
-```bash
-git remote add upstream https://github.com/xjh22222228/nav.git
-git fetch upstream main
-git merge upstream/main --allow-unrelated-histories
-git push
-```
-
-## Update log
-
-[CHANGELOG](https://github.com/xjh22222228/nav/releases)
-
-## Development and construction
-
-NODE: >= v18
-
-```bash
-# Download
-git clone --depth=1 https://github.com/xjh22222228/nav.git
-
-cd nav
-
-# Installation dependencies(Node:v18)
-yarn
-
-# Start
-yarn start
-
-# Build
-yarn build
-```
-
-## contribute
-
-Thank you for your [contribution](https://github.com/xjh22222228/nav/issues), men.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-## Suggest
-
-If you have any functional suggestions, you can initiate an [issue](https://github.com/xjh22222228/nav/issues), Thank you.
-
-## LICENSE
-
-[MIT](./LICENSE)
From 30b87162721e411762ad6a595046bccfdf8b356c Mon Sep 17 00:00:00 2001
From: xjh22222228
Date: Sun, 28 Jul 2024 12:41:35 +0800
Subject: [PATCH 14/71] style: remove weblist drag
---
src/components/web-list/index.component.html | 4 ---
src/components/web-list/index.component.ts | 38 ++++----------------
2 files changed, 7 insertions(+), 35 deletions(-)
diff --git a/src/components/web-list/index.component.html b/src/components/web-list/index.component.html
index 13a8a6daa7..8ab5364324 100644
--- a/src/components/web-list/index.component.html
+++ b/src/components/web-list/index.component.html
@@ -2,9 +2,6 @@
class="container web-list dark-scrollbar"
[class.overflowScroll]="overflow"
*ngIf="dataList.length > 0"
- cdkDropList
- (cdkDropListDropped)="handleDrop($event)"
- cdkDropListOrientation="horizontal"
>
diff --git a/src/components/web-list/index.component.ts b/src/components/web-list/index.component.ts
index c4a097073d..a2a28c21cd 100644
--- a/src/components/web-list/index.component.ts
+++ b/src/components/web-list/index.component.ts
@@ -2,7 +2,6 @@
// See https://github.com/xjh22222228/nav
import { Component, OnInit, Input } from '@angular/core'
-import { CdkDragDrop, moveItemInArray } from '@angular/cdk/drag-drop'
import { websiteList } from 'src/store'
import { IWebProps, INavProps } from 'src/types'
import { setWebsiteList, queryString, fuzzySearch } from 'src/utils'
@@ -72,39 +71,16 @@ export class WebListComponent implements OnInit {
r(websiteList)
// @ts-ignore
- this.dataList = dataList.sort((a, b) => a.index - b.index)
+ this.dataList = dataList.sort((a: any, b: any) => {
+ const aIdx =
+ a.index == null || a.index === '' ? Number.MAX_SAFE_INTEGER : a.index
+ const bIdx =
+ b.index == null || b.index === '' ? Number.MAX_SAFE_INTEGER : b.index
+ return aIdx - bIdx
+ })
DEFAULT_WEBSITE = this.dataList
}
- handleDrop(event: CdkDragDrop): void {
- moveItemInArray(this.dataList, event.previousIndex, event.currentIndex)
-
- const m: Record = {}
-
- for (let i = 1; i <= this.dataList.length; i++) {
- const item = this.dataList[i - 1]
- m[`${item.name}${item.url}`] = i
- }
-
- function r(nav: any) {
- if (!Array.isArray(nav)) return
-
- for (let i = 0; i < nav.length; i++) {
- const item = nav[i]
- if (item.url) {
- const k = `${item.name}${item.url}`
- if (m[k]) {
- item.index = m[k]
- }
- } else {
- r(item.nav)
- }
- }
- }
- r(websiteList)
- setWebsiteList(websiteList)
- }
-
goUrl(url: string) {
window.open(url)
}
From 668c4a5b25b7c775b506b3312007d28c0d1b593e Mon Sep 17 00:00:00 2001
From: xjh22222228
Date: Sun, 28 Jul 2024 16:15:51 +0800
Subject: [PATCH 15/71] fix: add loop
---
package.json | 2 +-
scripts/internal.mjs | 8 +++++
src/components/move-web/index.component.html | 2 +-
src/components/move-web/index.component.ts | 16 +++++----
src/components/swiper/index.component.ts | 1 +
src/utils/bookmark.ts | 2 +-
src/view/system/bookmark/index.component.ts | 37 +++++++++++---------
yarn.lock | 8 ++---
8 files changed, 45 insertions(+), 31 deletions(-)
diff --git a/package.json b/package.json
index 92624d7a61..90971a9d14 100644
--- a/package.json
+++ b/package.json
@@ -57,7 +57,7 @@
"@angular/compiler-cli": "^18.0.1",
"@types/jasmine": "~5.1.4",
"@types/nprogress": "^0.2.3",
- "info-web": "^0.0.14",
+ "info-web": "^0.0.15",
"jasmine-core": "~5.1.2",
"karma": "~6.4.3",
"karma-chrome-launcher": "~3.2.0",
diff --git a/scripts/internal.mjs b/scripts/internal.mjs
index d9d281604f..5e9ed0abcb 100644
--- a/scripts/internal.mjs
+++ b/scripts/internal.mjs
@@ -319,6 +319,14 @@ function setWeb(nav) {
delete webItem.__desc__
delete webItem.__name__
+ // 节省空间
+ if (!webItem.top) {
+ delete webItem.top
+ }
+ if (!webItem.ownVisible) {
+ delete webItem.ownVisible
+ }
+
// 兼容现有标签,以id为key
for (let k in webItem.urls) {
if (k === TAG_ID_NAME1) {
diff --git a/src/components/move-web/index.component.html b/src/components/move-web/index.component.html
index 8e039dcef3..a8f8e77289 100644
--- a/src/components/move-web/index.component.html
+++ b/src/components/move-web/index.component.html
@@ -54,7 +54,7 @@
- {{ $t('_copy') }}
+ {{ $t('_copy') }}
diff --git a/src/components/move-web/index.component.ts b/src/components/move-web/index.component.ts
index d82b264376..a488ebb73a 100644
--- a/src/components/move-web/index.component.ts
+++ b/src/components/move-web/index.component.ts
@@ -19,7 +19,7 @@ export class MoveWebComponent {
websiteList: INavProps[] = websiteList
twoOptList: INavTwoProp[] = []
threeOptList: INavThreeProp[] = []
- checked = false
+ isCopy = false
oneSelect: number | undefined
twoSelect: number | undefined
threeSelect: number | undefined
@@ -91,11 +91,12 @@ export class MoveWebComponent {
const threeSelect = this.threeSelect as number
try {
+ const moveSites = JSON.parse(JSON.stringify(this.moveSites))
if (this.level === 2) {
if (this.oneSelect == null) {
return this.message.error($t('_sel1'))
}
- this.moveSites.forEach((item: any) => {
+ moveSites.forEach((item: any) => {
const exists = this.websiteList[oneSelect].nav.find(
(el: any) => el.title === item.title
)
@@ -105,7 +106,7 @@ export class MoveWebComponent {
} else {
this.websiteList[oneSelect].nav.unshift(item)
- if (!this.checked) {
+ if (!this.isCopy) {
const [a, b, c, d] = indexs
this.websiteList[a].nav.splice(d, 1)
}
@@ -117,7 +118,7 @@ export class MoveWebComponent {
if (this.twoSelect == null) {
return this.message.error($t('_sel2'))
}
- this.moveSites.forEach((item: any) => {
+ moveSites.forEach((item: any) => {
const exists = this.websiteList[oneSelect].nav[twoSelect].nav.find(
(el: any) => el.title === item.title
)
@@ -127,7 +128,7 @@ export class MoveWebComponent {
} else {
this.websiteList[oneSelect].nav[twoSelect].nav.unshift(item)
- if (!this.checked) {
+ if (!this.isCopy) {
const [a, b, c, d] = indexs
this.websiteList[a].nav[b].nav.splice(d, 1)
}
@@ -144,7 +145,8 @@ export class MoveWebComponent {
`move web: indexs数量不正确${indexs.join(',')}`
)
}
- this.moveSites.forEach((item: any) => {
+ moveSites.forEach((item: any) => {
+ item.id = item.id + 'copy'
const exists = this.websiteList[oneSelect].nav[twoSelect].nav[
threeSelect
].nav.find((el: any) => el.name === item.name)
@@ -156,7 +158,7 @@ export class MoveWebComponent {
threeSelect
].nav.unshift(item)
- if (!this.checked) {
+ if (!this.isCopy) {
const [a, b, c, d] = indexs
this.websiteList[a].nav[b].nav[c].nav.splice(d, 1)
}
diff --git a/src/components/swiper/index.component.ts b/src/components/swiper/index.component.ts
index 8563618bef..a8f979fe9f 100644
--- a/src/components/swiper/index.component.ts
+++ b/src/components/swiper/index.component.ts
@@ -36,6 +36,7 @@ export class SwiperComponent {
return
}
this.mySwiper = new Swiper(el, {
+ loop: true,
autoplay: this.autoplay
? {
delay: 5000,
diff --git a/src/utils/bookmark.ts b/src/utils/bookmark.ts
index 29c35a9ece..075414dc71 100644
--- a/src/utils/bookmark.ts
+++ b/src/utils/bookmark.ts
@@ -213,7 +213,7 @@ export function parseBookmark(htmlStr: string) {
}
} catch (error) {
console.log(error)
- return error
+ throw error
}
// 增量导入
diff --git a/src/view/system/bookmark/index.component.ts b/src/view/system/bookmark/index.component.ts
index dd078b04fe..82972a53c3 100644
--- a/src/view/system/bookmark/index.component.ts
+++ b/src/view/system/bookmark/index.component.ts
@@ -14,19 +14,18 @@ import { websiteList } from 'src/store'
@Component({
selector: 'system-bookmark',
templateUrl: './index.component.html',
- styleUrls: ['./index.component.scss']
+ styleUrls: ['./index.component.scss'],
})
export default class SystemBookmarkComponent {
$t = $t
websiteList: INavProps[] = websiteList
- constructor (
+ constructor(
private message: NzMessageService,
- private notification: NzNotificationService,
+ private notification: NzNotificationService
) {}
- ngOnInit () {
- }
+ ngOnInit() {}
onBookChange(e: any) {
const that = this
@@ -35,19 +34,23 @@ export default class SystemBookmarkComponent {
const file = files[0]
const fileReader = new FileReader()
fileReader.readAsText(file)
- fileReader.onload = function() {
+ fileReader.onload = function () {
const html = this.result as string
- const result = parseBookmark(html)
- if (!Array.isArray(result)) {
- that.notification.error(
- $t('_errorBookTip'),
- `${result?.message ?? ''}`
- )
- } else {
- that.message.success($t('_importSuccess'))
- that.websiteList = result
- setWebsiteList(that.websiteList)
- setTimeout(() => window.location.reload(), 2000)
+ try {
+ const result = parseBookmark(html)
+ if (!Array.isArray(result)) {
+ that.notification.error(
+ $t('_errorBookTip'),
+ `${result?.message ?? ''}`
+ )
+ } else {
+ that.message.success($t('_importSuccess'))
+ that.websiteList = result
+ setWebsiteList(that.websiteList)
+ setTimeout(() => window.location.reload(), 2000)
+ }
+ } catch (error) {
+ that.notification.error($t('_errorBookTip'), `${error.message}`)
}
}
}
diff --git a/yarn.lock b/yarn.lock
index c076518e6e..bc0fbda4d1 100644
--- a/yarn.lock
+++ b/yarn.lock
@@ -4108,10 +4108,10 @@ inflight@^1.0.4:
once "^1.3.0"
wrappy "1"
-info-web@^0.0.14:
- version "0.0.14"
- resolved "https://registry.yarnpkg.com/info-web/-/info-web-0.0.14.tgz#c0c04083c7f4ba3d1918b94c436830fd574e07b8"
- integrity sha512-EQJ4YXidFA4vm7Fc334UB+C+J1WI2SSts3zH/ru3ZPdbHN3pnCSe3m3nAiUau3GC29o5lqVsCUw327FA1UkPgQ==
+info-web@^0.0.15:
+ version "0.0.15"
+ resolved "https://registry.yarnpkg.com/info-web/-/info-web-0.0.15.tgz#67dab586e53ed135ed6f2f1477bdb57ab632aa3a"
+ integrity sha512-Jl50WthP3q8RJ/J4pnAz0/4prq9SFCuYu95/NROIcwjyTUqHHYJJiIXr8kQ7oEyhkRQlP/HQCdXxmdCaJgBZ3g==
dependencies:
axios "^1.7.2"
rollup "^4.18.0"
From 2472ea987f10cab8656e1073a1abd2590a0b91e0 Mon Sep 17 00:00:00 2001
From: xjh22222228
Date: Tue, 30 Jul 2024 14:30:09 +0800
Subject: [PATCH 16/71] refactor: change indexdb & update style & add card
style
---
README.md | 2 +-
package.json | 3 +-
scripts/internal.mjs | 3 +
src/app/alert-event.ts | 1 +
src/app/app-routing.module.ts | 1 +
src/app/app.component.ts | 5 +-
src/app/app.module.ts | 1 +
src/components/card/index.component.html | 47 +++++++-
src/components/card/index.component.scss | 64 +++++++++++
src/components/card/index.component.ts | 14 ++-
src/components/create-web/index.component.ts | 3 +-
src/components/fixbar/index.component.ts | 1 +
src/components/footer/footer.component.ts | 1 +
src/components/icon-git/icon-git.component.ts | 1 +
src/components/login/login.component.ts | 1 +
src/components/logo/logo.component.html | 8 +-
src/components/logo/logo.component.ts | 1 +
src/components/move-web/index.component.ts | 1 +
src/components/no-data/no-data.component.ts | 7 +-
src/components/search-engine/index.ts | 3 +-
.../search-engine/search-engine.component.ts | 1 +
src/components/swiper/index.component.ts | 1 +
.../toolbar-title/index.component.html | 15 ---
.../toolbar-title/index.component.ts | 2 +-
src/components/upload/index.component.ts | 1 +
src/components/web-list/index.component.ts | 49 +++++---
.../web-more-menu/index.component.ts | 1 +
src/constants/index.ts | 1 +
src/dark.scss | 17 ++-
src/locale/english.ts | 4 +
src/locale/index.ts | 11 +-
src/locale/zh_CN.ts | 4 +
src/main.html | 2 +-
src/pipe/safeHtml.pipe.ts | 1 +
src/services/index.ts | 1 +
src/store/index.ts | 1 +
src/styles.scss | 11 +-
src/types/index.d.ts | 17 ++-
src/utils/bookmark.ts | 1 +
src/utils/http.ts | 1 +
src/utils/index.ts | 50 +++++---
src/utils/mitt.ts | 1 +
src/utils/user.ts | 4 +
src/view/app/default/app.component.html | 63 ++++------
src/view/app/default/app.component.scss | 95 +--------------
src/view/app/default/app.component.ts | 47 +++++---
src/view/light/index.component.html | 35 +++---
src/view/light/index.component.scss | 9 --
src/view/light/index.component.ts | 50 +++++---
src/view/shortcut/index.component.ts | 1 +
src/view/side/index.component.html | 108 +++++++++++-------
src/view/side/index.component.scss | 76 +++++-------
src/view/side/index.component.ts | 70 ++++++------
src/view/sim/index.component.html | 6 +-
src/view/sim/index.component.ts | 48 +++++---
src/view/super/index.component.html | 4 +-
src/view/super/index.component.ts | 43 ++++---
src/view/system/about/index.component.ts | 10 +-
src/view/system/angle-mark/index.component.ts | 14 +--
.../system/bookmark-export/index.component.ts | 1 +
src/view/system/bookmark/index.component.ts | 1 +
src/view/system/collect/index.component.html | 11 --
src/view/system/collect/index.component.ts | 8 +-
src/view/system/index.component.ts | 1 +
src/view/system/info/index.component.ts | 1 +
src/view/system/search/index.component.ts | 1 +
src/view/system/setting/index.component.html | 27 +++++
src/view/system/setting/index.component.ts | 1 +
src/view/system/tag/index.component.ts | 1 +
src/view/system/vip-auth/index.component.html | 14 ++-
src/view/system/vip-auth/index.component.ts | 1 +
src/view/system/web/index.component.ts | 1 +
yarn.lock | 19 +++
73 files changed, 666 insertions(+), 466 deletions(-)
diff --git a/README.md b/README.md
index 6f18cc5a0b..78cb8d89cf 100644
--- a/README.md
+++ b/README.md
@@ -138,7 +138,7 @@ npm run server
```bash
git pull
-git remote add upstream https://github.com/xjh22222228/nav.git
+git remote add upstream https://gitee.com/xiejiahe/nav.git
git fetch upstream main
git merge upstream/main --allow-unrelated-histories --no-edit
git push
diff --git a/package.json b/package.json
index 90971a9d14..e28e42daa1 100644
--- a/package.json
+++ b/package.json
@@ -18,7 +18,7 @@
"build-gh-pages": "npm run setup && ng build --base-href ./ --index src/index.html",
"build": "npm run setup && ng build --index src/index.html",
"watch": "ng build --watch --configuration development",
- "update": "git pull && (git remote add upstream https://github.com/xjh22222228/nav.git || true) && git fetch upstream main && git merge upstream/main --allow-unrelated-histories --no-edit && git push",
+ "update": "git pull && (git remote add upstream https://gitee.com/xiejiahe/nav.git || true) && git fetch upstream main && git merge upstream/main --allow-unrelated-histories --no-edit && git push",
"pull": "git pull",
"server": "pm2 start server.js",
"restartServer": "pm2 restart server"
@@ -42,6 +42,7 @@
"file-saver": "^2.0.5",
"hotkeys-js": "^3.13.7",
"js-base64": "^3.7.7",
+ "localforage": "^1.10.0",
"mitt": "^3.0.1",
"ng-zorro-antd": "^18.0.0",
"nprogress": "^0.2.0",
diff --git a/scripts/internal.mjs b/scripts/internal.mjs
index 5e9ed0abcb..22efa39f62 100644
--- a/scripts/internal.mjs
+++ b/scripts/internal.mjs
@@ -162,6 +162,7 @@ const TAG_ID_NAME3 = 'Github'
settings.sideFooterHTML ||= ''
settings.sideThemeHeight ??= 0
settings.sideThemeAutoplay ??= true
+ settings.sideCollapsed ??= false
settings.sideThemeImages ||= [
{
src: banner2,
@@ -192,6 +193,8 @@ const TAG_ID_NAME3 = 'Github'
settings.spiderTitle ??= 'NO'
settings.spiderQty ??= 20
settings.loadingCode ??= ''
+
+ settings.appCardStyle ??= 'common'
fs.writeFileSync(settingsPath, JSON.stringify(settings), {
encoding: 'utf-8',
})
diff --git a/src/app/alert-event.ts b/src/app/alert-event.ts
index a1a79b05ac..eeabe35588 100644
--- a/src/app/alert-event.ts
+++ b/src/app/alert-event.ts
@@ -1,3 +1,4 @@
+// 开源项目MIT,未经作者同意,不得以抄袭/复制代码/修改源代码版权信息,允许商业途径。
// @ts-nocheck
import { NzMessageService } from 'ng-zorro-antd/message'
import { NzNotificationService } from 'ng-zorro-antd/notification'
diff --git a/src/app/app-routing.module.ts b/src/app/app-routing.module.ts
index a0e7ab4c67..71a54b0b7e 100644
--- a/src/app/app-routing.module.ts
+++ b/src/app/app-routing.module.ts
@@ -1,3 +1,4 @@
+// 开源项目MIT,未经作者同意,不得以抄袭/复制代码/修改源代码版权信息,允许商业途径。
// Copyright @ 2018-present xiejiahe. All rights reserved. MIT license.
// See https://github.com/xjh22222228/nav
diff --git a/src/app/app.component.ts b/src/app/app.component.ts
index 97a4b9fb9a..74a64795f6 100644
--- a/src/app/app.component.ts
+++ b/src/app/app.component.ts
@@ -1,9 +1,10 @@
+// 开源项目MIT,未经作者同意,不得以抄袭/复制代码/修改源代码版权信息,允许商业途径。
// Copyright @ 2018-present xiejiahe. All rights reserved. MIT license.
// See https://github.com/xjh22222228/nav
import { Component } from '@angular/core'
import { Router, ActivatedRoute } from '@angular/router'
-import { queryString, setLocation } from '../utils'
+import { queryString, setLocation, isMobile } from '../utils'
import { en_US, NzI18nService, zh_CN } from 'ng-zorro-antd/i18n'
import { getLocale } from 'src/locale'
import { settings } from 'src/store'
@@ -54,7 +55,7 @@ export class AppComponent {
goRoute() {
// is App
- if (settings.appTheme !== 'Current' && 'ontouchstart' in window) {
+ if (settings.appTheme !== 'Current' && isMobile()) {
const url = (this.router.url.split('?')[0] || '').toLowerCase()
const { page, id, q } = queryString()
const queryParams = { page, id, q }
diff --git a/src/app/app.module.ts b/src/app/app.module.ts
index 684e254e33..c8e1963df2 100644
--- a/src/app/app.module.ts
+++ b/src/app/app.module.ts
@@ -1,3 +1,4 @@
+// 开源项目MIT,未经作者同意,不得以抄袭/复制代码/修改源代码版权信息,允许商业途径。
// Copyright @ 2018-present xiejiahe. All rights reserved. MIT license.
// See https://github.com/xjh22222228/nav
diff --git a/src/components/card/index.component.html b/src/components/card/index.component.html
index f75a7d224c..2272e4bc40 100644
--- a/src/components/card/index.component.html
+++ b/src/components/card/index.component.html
@@ -1,6 +1,9 @@
-
+
+
+
+
= {}
@Input() indexs: Array
= []
- @Input() cardStyle: string = 'standard'
+ @Input() cardStyle: ICardType = 'standard'
$t = $t
objectKeys = Object.keys
@@ -85,6 +86,15 @@ export class CardComponent implements OnInit {
})
}
+ handleJump(e: any, url?: string) {
+ e.stopPropagation()
+ e.preventDefault()
+ if (!url) {
+ return
+ }
+ window.open(url)
+ }
+
get getRate() {
if (!this.dataSource.rate) {
return null
diff --git a/src/components/create-web/index.component.ts b/src/components/create-web/index.component.ts
index bb2dbac745..61b8211bc8 100644
--- a/src/components/create-web/index.component.ts
+++ b/src/components/create-web/index.component.ts
@@ -1,3 +1,4 @@
+// 开源项目MIT,未经作者同意,不得以抄袭/复制代码/修改源代码版权信息,允许商业途径。
// Copyright @ 2018-present xiejiahe. All rights reserved. MIT license.
// See https://github.com/xjh22222228/nav
@@ -216,7 +217,7 @@ export class CreateWebComponent {
title = title.trim()
const urlArr = this.validateForm.get('urlArr')?.value || []
urlArr.forEach((item: any) => {
- if (item.id != null) {
+ if (item.id) {
urls[item.id] = item.url
}
})
diff --git a/src/components/fixbar/index.component.ts b/src/components/fixbar/index.component.ts
index 7142449f87..82cf97a378 100644
--- a/src/components/fixbar/index.component.ts
+++ b/src/components/fixbar/index.component.ts
@@ -1,3 +1,4 @@
+// 开源项目MIT,未经作者同意,不得以抄袭/复制代码/修改源代码版权信息,允许商业途径。
// Copyright @ 2018-present xiejiahe. All rights reserved. MIT license.
// See https://github.com/xjh22222228/nav
diff --git a/src/components/footer/footer.component.ts b/src/components/footer/footer.component.ts
index e3834f07f5..1f3a7379bf 100644
--- a/src/components/footer/footer.component.ts
+++ b/src/components/footer/footer.component.ts
@@ -1,3 +1,4 @@
+// 开源项目MIT,未经作者同意,不得以抄袭/复制代码/修改源代码版权信息,允许商业途径。
// Copyright @ 2018-present xiejiahe. All rights reserved. MIT license.
// See https://github.com/xjh22222228/nav
diff --git a/src/components/icon-git/icon-git.component.ts b/src/components/icon-git/icon-git.component.ts
index 19e997050b..ed5830e1e5 100644
--- a/src/components/icon-git/icon-git.component.ts
+++ b/src/components/icon-git/icon-git.component.ts
@@ -1,3 +1,4 @@
+// 开源项目MIT,未经作者同意,不得以抄袭/复制代码/修改源代码版权信息,允许商业途径。
// Copyright @ 2018-present xiejiahe. All rights reserved. MIT license.
import { Component, OnInit } from '@angular/core'
diff --git a/src/components/login/login.component.ts b/src/components/login/login.component.ts
index 4205080496..0f1d813982 100644
--- a/src/components/login/login.component.ts
+++ b/src/components/login/login.component.ts
@@ -1,3 +1,4 @@
+// 开源项目MIT,未经作者同意,不得以抄袭/复制代码/修改源代码版权信息,允许商业途径。
// Copyright @ 2018-present xiejiahe. All rights reserved. MIT license.
// See https://github.com/xjh22222228/nav
diff --git a/src/components/logo/logo.component.html b/src/components/logo/logo.component.html
index c6fa29cd0b..a01afe7848 100644
--- a/src/components/logo/logo.component.html
+++ b/src/components/logo/logo.component.html
@@ -5,12 +5,16 @@
[ngStyle]="{ width: size + 'px', height: size + 'px' }"
(error)="onError()"
draggable="false"
->
+/>
{{ name ? name[0] : '' }}
diff --git a/src/components/logo/logo.component.ts b/src/components/logo/logo.component.ts
index 6009a6112b..650b86d3bd 100644
--- a/src/components/logo/logo.component.ts
+++ b/src/components/logo/logo.component.ts
@@ -1,3 +1,4 @@
+// 开源项目MIT,未经作者同意,不得以抄袭/复制代码/修改源代码版权信息,允许商业途径。
import { Component, Input } from '@angular/core'
import { getCDN } from 'src/services'
diff --git a/src/components/move-web/index.component.ts b/src/components/move-web/index.component.ts
index a488ebb73a..d444db9f02 100644
--- a/src/components/move-web/index.component.ts
+++ b/src/components/move-web/index.component.ts
@@ -1,3 +1,4 @@
+// 开源项目MIT,未经作者同意,不得以抄袭/复制代码/修改源代码版权信息,允许商业途径。
// Copyright @ 2018-present xiejiahe. All rights reserved. MIT license.
// See https://github.com/xjh22222228/nav
diff --git a/src/components/no-data/no-data.component.ts b/src/components/no-data/no-data.component.ts
index 1448d7f190..b1cffd8df1 100644
--- a/src/components/no-data/no-data.component.ts
+++ b/src/components/no-data/no-data.component.ts
@@ -1,17 +1,18 @@
+// 开源项目MIT,未经作者同意,不得以抄袭/复制代码/修改源代码版权信息,允许商业途径。
// Copyright @ 2018-present xiejiahe. All rights reserved. MIT license.
import { Component } from '@angular/core'
-import { $t } from 'src/locale';
+import { $t } from 'src/locale'
@Component({
selector: 'app-no-data',
templateUrl: './no-data.component.html',
- styleUrls: ['./no-data.component.scss']
+ styleUrls: ['./no-data.component.scss'],
})
export class NoDataComponent {
$t = $t
goBack = () => {
- history.go(-1);
+ history.go(-1)
}
}
diff --git a/src/components/search-engine/index.ts b/src/components/search-engine/index.ts
index 39680b8fbf..c4fc109f6b 100644
--- a/src/components/search-engine/index.ts
+++ b/src/components/search-engine/index.ts
@@ -1,8 +1,9 @@
+// 开源项目MIT,未经作者同意,不得以抄袭/复制代码/修改源代码版权信息,允许商业途径。
export enum SearchType {
All = 1,
Title,
Desc,
Url,
- Current
+ Current,
}
diff --git a/src/components/search-engine/search-engine.component.ts b/src/components/search-engine/search-engine.component.ts
index 5b7e430283..585746496e 100644
--- a/src/components/search-engine/search-engine.component.ts
+++ b/src/components/search-engine/search-engine.component.ts
@@ -1,3 +1,4 @@
+// 开源项目MIT,未经作者同意,不得以抄袭/复制代码/修改源代码版权信息,允许商业途径。
// @ts-nocheck
// Copyright @ 2018-present xiejiahe. All rights reserved. MIT license.
diff --git a/src/components/swiper/index.component.ts b/src/components/swiper/index.component.ts
index a8f979fe9f..205ad77323 100644
--- a/src/components/swiper/index.component.ts
+++ b/src/components/swiper/index.component.ts
@@ -1,3 +1,4 @@
+// 开源项目MIT,未经作者同意,不得以抄袭/复制代码/修改源代码版权信息,允许商业途径。
// Copyright @ 2018-present xiejiahe. All rights reserved. MIT license.
// See https://github.com/xjh22222228/nav
diff --git a/src/components/toolbar-title/index.component.html b/src/components/toolbar-title/index.component.html
index 1429383845..7c1c8865b9 100644
--- a/src/components/toolbar-title/index.component.html
+++ b/src/components/toolbar-title/index.component.html
@@ -3,26 +3,11 @@
*ngIf="dataSource && dataSource.title"
>
-
-
-
-
-
-
{{ dataSource.title }} x {{ dataSource.nav.length }}
diff --git a/src/components/toolbar-title/index.component.ts b/src/components/toolbar-title/index.component.ts
index 6750a0578c..9f78faa341 100644
--- a/src/components/toolbar-title/index.component.ts
+++ b/src/components/toolbar-title/index.component.ts
@@ -1,3 +1,4 @@
+// 开源项目MIT,未经作者同意,不得以抄袭/复制代码/修改源代码版权信息,允许商业途径。
// Copyright @ 2018-present xiejiahe. All rights reserved. MIT license.
// See https://github.com/xjh22222228/nav
@@ -15,7 +16,6 @@ import event from 'src/utils/mitt'
export class ToolbarTitleWebComponent implements OnInit {
@Input() index: number = 0
@Input() dataSource!: INavThreeProp
- @Input() arrowType: '1' | '2' = '1'
@Output() onCollapse = new EventEmitter()
isLogin = isLogin
diff --git a/src/components/upload/index.component.ts b/src/components/upload/index.component.ts
index acfb51a4fd..9a2e0edefd 100644
--- a/src/components/upload/index.component.ts
+++ b/src/components/upload/index.component.ts
@@ -1,3 +1,4 @@
+// 开源项目MIT,未经作者同意,不得以抄袭/复制代码/修改源代码版权信息,允许商业途径。
// Copyright @ 2018-present xiejiahe. All rights reserved. MIT license.
// See https://github.com/xjh22222228/nav
diff --git a/src/components/web-list/index.component.ts b/src/components/web-list/index.component.ts
index a2a28c21cd..cef42283cc 100644
--- a/src/components/web-list/index.component.ts
+++ b/src/components/web-list/index.component.ts
@@ -1,12 +1,14 @@
+// 开源项目MIT,未经作者同意,不得以抄袭/复制代码/修改源代码版权信息,允许商业途径。
// Copyright @ 2018-present xiejiahe. All rights reserved. MIT license.
// See https://github.com/xjh22222228/nav
import { Component, OnInit, Input } from '@angular/core'
import { websiteList } from 'src/store'
import { IWebProps, INavProps } from 'src/types'
-import { setWebsiteList, queryString, fuzzySearch } from 'src/utils'
+import { queryString, fuzzySearch } from 'src/utils'
import { isLogin } from 'src/utils/user'
import { ActivatedRoute } from '@angular/router'
+import event from 'src/utils/mitt'
let DEFAULT_WEBSITE: Array = []
@@ -23,28 +25,35 @@ export class WebListComponent implements OnInit {
websiteList: INavProps[] = websiteList
dataList: IWebProps[] = []
- constructor(private activatedRoute: ActivatedRoute) {}
+ constructor(private activatedRoute: ActivatedRoute) {
+ const init = () => {
+ this.getTopWeb()
+ this.activatedRoute.queryParams.subscribe(() => {
+ const { q } = queryString()
+ const result = fuzzySearch(this.websiteList, q)
- ngOnInit() {
- this.getTopWeb()
-
- this.activatedRoute.queryParams.subscribe(() => {
- const { q } = queryString()
- const result = fuzzySearch(this.websiteList, q)
-
- if (this.search && q.trim()) {
- if (result.length === 0) {
- this.dataList = []
+ if (this.search && q.trim()) {
+ if (result.length === 0) {
+ this.dataList = []
+ } else {
+ this.dataList = result[0].nav.slice(0, this.max)
+ }
} else {
- this.dataList = result[0].nav.slice(0, this.max)
+ this.dataList = DEFAULT_WEBSITE
}
- } else {
- this.dataList = DEFAULT_WEBSITE
- }
- setWebsiteList(this.websiteList)
- })
+ })
+ }
+ if (window.__FINISHED__) {
+ init()
+ } else {
+ event.on('WEB_FINISH', () => {
+ init()
+ })
+ }
}
+ ngOnInit() {}
+
// 获取置顶WEB
getTopWeb() {
const dataList: IWebProps[] = []
@@ -82,7 +91,9 @@ export class WebListComponent implements OnInit {
}
goUrl(url: string) {
- window.open(url)
+ if (url) {
+ window.open(url)
+ }
}
trackByItemWeb(a: any, item: any) {
diff --git a/src/components/web-more-menu/index.component.ts b/src/components/web-more-menu/index.component.ts
index 7cda9db9ec..c72d3ea7fd 100644
--- a/src/components/web-more-menu/index.component.ts
+++ b/src/components/web-more-menu/index.component.ts
@@ -1,3 +1,4 @@
+// 开源项目MIT,未经作者同意,不得以抄袭/复制代码/修改源代码版权信息,允许商业途径。
// Copyright @ 2018-present xiejiahe. All rights reserved. MIT license.
// See https://github.com/xjh22222228/nav
diff --git a/src/constants/index.ts b/src/constants/index.ts
index e5d0749718..d2e95435df 100644
--- a/src/constants/index.ts
+++ b/src/constants/index.ts
@@ -1,3 +1,4 @@
+// 开源项目MIT,未经作者同意,不得以抄袭/复制代码/修改源代码版权信息,允许商业途径。
// Copyright @ 2018-present xiejiahe. All rights reserved. MIT license.
// See https://github.com/xjh22222228/nav
diff --git a/src/dark.scss b/src/dark.scss
index 6724982fb3..e49b5c5e7a 100644
--- a/src/dark.scss
+++ b/src/dark.scss
@@ -75,18 +75,27 @@
&-scrollbar {
&::-webkit-scrollbar {
- width: 12px;
- height: 12px;
+ width: 10px;
+ height: 10px;
background-color: rgb(39, 39, 39);
}
&::-webkit-scrollbar-thumb {
background-color: rgb(96, 96, 96);
- border: 3px solid rgb(39, 39, 39);
- border-radius: 20px;
+ border: 2px solid rgb(39, 39, 39);
+ border-radius: 100px;
&:hover {
background-color: rgb(136, 136, 136);
}
}
+ &::-webkit-scrollbar-cornet {
+ display: block;
+ }
+ }
+ // 全局滚动条细边
+ &-scrollbar-border {
+ &::-webkit-scrollbar-thumb {
+ border: 3px solid rgb(39, 39, 39);
+ }
}
&-item-hover:hover {
diff --git a/src/locale/english.ts b/src/locale/english.ts
index 9e1c5f6e7b..cd048a34ae 100644
--- a/src/locale/english.ts
+++ b/src/locale/english.ts
@@ -1,4 +1,6 @@
+// 开源项目MIT,未经作者同意,不得以抄袭/复制代码/修改源代码版权信息,允许商业途径。
const english: Record = {
+ _loading: 'Loading...',
_webTitle: 'Discovery Navigation',
_uncategorized: 'Unclassified',
_modifySuccess: 'Modification succeeded!',
@@ -220,6 +222,8 @@ const english: Record = {
_spiderBuildTip:
'After the construction is completed, the data is correct. Please go to the website management and click save once, otherwise the data will not be permanently stored',
_associatedLabels: 'Labels',
+ _menuCollapse: 'Menu Collapse',
+ _retro: 'Retro',
}
export default english
diff --git a/src/locale/index.ts b/src/locale/index.ts
index 67aa757f0c..b1ba9d6737 100644
--- a/src/locale/index.ts
+++ b/src/locale/index.ts
@@ -1,15 +1,18 @@
-import english from "./english"
-import zh_CN from "./zh_CN"
+// 开源项目MIT,未经作者同意,不得以抄袭/复制代码/修改源代码版权信息,允许商业途径。
+import english from './english'
+import zh_CN from './zh_CN'
import { STORAGE_KEY_MAP } from 'src/constants'
import { settings } from 'src/store'
const o = {
en: english,
- cn: zh_CN
+ cn: zh_CN,
}
export function getLocale(): string {
- return window.localStorage.getItem(STORAGE_KEY_MAP.language) || settings.language
+ return (
+ window.localStorage.getItem(STORAGE_KEY_MAP.language) || settings.language
+ )
}
const l = getLocale()
diff --git a/src/locale/zh_CN.ts b/src/locale/zh_CN.ts
index 4fe6fd7b65..fdd5d32461 100644
--- a/src/locale/zh_CN.ts
+++ b/src/locale/zh_CN.ts
@@ -1,4 +1,6 @@
+// 开源项目MIT,未经作者同意,不得以抄袭/复制代码/修改源代码版权信息,允许商业途径。
const zhCN: Record = {
+ _loading: '加载中...',
_webTitle: '发现导航',
_uncategorized: '未分类',
_modifySuccess: '修改成功!',
@@ -211,6 +213,8 @@ const zhCN: Record = {
_spiderBuildTip:
'构建完成后对数据无误,请到网站管理点击一次保存,否则数据不会永久存储',
_associatedLabels: '关联标签',
+ _menuCollapse: '菜单默认收起',
+ _retro: '复古',
}
export default zhCN
diff --git a/src/main.html b/src/main.html
index 4b413ec6c5..4b98089ba0 100644
--- a/src/main.html
+++ b/src/main.html
@@ -39,7 +39,7 @@
-
+
diff --git a/src/pipe/safeHtml.pipe.ts b/src/pipe/safeHtml.pipe.ts
index 8909b6ebcd..b31087de77 100644
--- a/src/pipe/safeHtml.pipe.ts
+++ b/src/pipe/safeHtml.pipe.ts
@@ -1,3 +1,4 @@
+// 开源项目MIT,未经作者同意,不得以抄袭/复制代码/修改源代码版权信息,允许商业途径。
// Copyright @ 2018-present xiejiahe. All rights reserved. MIT license.
// See https://github.com/xjh22222228/nav
diff --git a/src/services/index.ts b/src/services/index.ts
index d42244b558..0fd8d97996 100644
--- a/src/services/index.ts
+++ b/src/services/index.ts
@@ -1,3 +1,4 @@
+// 开源项目MIT,未经作者同意,不得以抄袭/复制代码/修改源代码版权信息,允许商业途径。
// Copyright @ 2018-present xiejiahe. All rights reserved. MIT license.
import config from '../../nav.config'
diff --git a/src/store/index.ts b/src/store/index.ts
index 724b4b6e29..4da2a35c10 100644
--- a/src/store/index.ts
+++ b/src/store/index.ts
@@ -1,3 +1,4 @@
+// 开源项目MIT,未经作者同意,不得以抄袭/复制代码/修改源代码版权信息,允许商业途径。
// Copyright @ 2018-present xiejiahe. All rights reserved. MIT license.
import { websiteList as w } from '../utils'
diff --git a/src/styles.scss b/src/styles.scss
index 53d26a550f..add79d0a3b 100644
--- a/src/styles.scss
+++ b/src/styles.scss
@@ -15,11 +15,7 @@ body {
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
-webkit-overflow-scrolling: touch;
- // font: 14px/1.5 -apple-system, BlinkSystemFont, 'Segoe UI', Roboto, Ubuntu,
- // 'Helvetica Neue', Helevetica, Arial, 'PingFang SC', 'Hiragino Sans GB',
- // 'Microsoft YaHei UI', 'Microsoft YaHei', 'Source Han Sans CN', sans-serif;
font-size: 14px;
- // color: #333;
}
footer,
@@ -79,6 +75,13 @@ em {
.center {
text-align: center;
}
+.position-center {
+ z-index: 9;
+ position: absolute;
+ top: 50%;
+ left: 50%;
+ transform: translate(-50%, -50%);
+}
.text-align-left {
text-align: left;
}
diff --git a/src/types/index.d.ts b/src/types/index.d.ts
index 94af660824..fa99956034 100644
--- a/src/types/index.d.ts
+++ b/src/types/index.d.ts
@@ -1,3 +1,4 @@
+// 开源项目MIT,未经作者同意,不得以抄袭/复制代码/修改源代码版权信息,允许商业途径。
// Copyright @ 2018-present xiejiahe. All rights reserved. MIT license.
// See https://github.com/xjh22222228/nav
@@ -9,6 +10,8 @@ export type ThemeType =
| 'App'
| 'Shortcut'
+export type ICardType = 'standard' | 'column' | 'example' | 'common'
+
type OverType = 'overflow' | 'ellipsis'
type Spider = 'NO' | 'EMPTY' | 'ALWAYS'
@@ -111,7 +114,9 @@ export interface ISettings {
checkUrl: boolean
errorUrlCount?: number
- lightCardStyle: string
+ appCardStyle: ICardType
+
+ lightCardStyle: ICardType
lightOverType: OverType
lightImages: Record[]
lightFooterHTML: string
@@ -120,7 +125,7 @@ export interface ISettings {
simThemeDesc: string
simThemeHeight: number
simThemeAutoplay: boolean
- simCardStyle: string
+ simCardStyle: ICardType
simTitle: string
simOverType: OverType
simFooterHTML: string
@@ -128,9 +133,10 @@ export interface ISettings {
sideThemeImages: Record[]
sideThemeHeight: number
sideThemeAutoplay: boolean
- sideCardStyle: string
+ sideCardStyle: ICardType
sideTitle: string
sideFooterHTML: string
+ sideCollapsed: boolean
shortcutThemeImages: Record[]
shortcutThemeShowWeather: boolean
@@ -138,7 +144,7 @@ export interface ISettings {
superTitle: string
superOverType: OverType
- superCardStyle: string
+ superCardStyle: ICardType
superImages: Record[]
superFooterHTML: string
@@ -170,4 +176,7 @@ export type internalProps = {
declare global {
const Swiper: any
+ interface Window {
+ __FINISHED__: boolean // 记录已取 web 数据
+ }
}
diff --git a/src/utils/bookmark.ts b/src/utils/bookmark.ts
index 075414dc71..78e97779d5 100644
--- a/src/utils/bookmark.ts
+++ b/src/utils/bookmark.ts
@@ -1,3 +1,4 @@
+// 开源项目MIT,未经作者同意,不得以抄袭/复制代码/修改源代码版权信息,允许商业途径。
// Copyright @ 2018-present xie.jiahe. All rights reserved. MIT license.
// See https://github.com/xjh22222228/nav
diff --git a/src/utils/http.ts b/src/utils/http.ts
index e94efcd5f0..5cfd1de4db 100644
--- a/src/utils/http.ts
+++ b/src/utils/http.ts
@@ -1,3 +1,4 @@
+// 开源项目MIT,未经作者同意,不得以抄袭/复制代码/修改源代码版权信息,允许商业途径。
// Copyright @ 2018-present xiejiahe. All rights reserved. MIT license.
import axios from 'axios'
diff --git a/src/utils/index.ts b/src/utils/index.ts
index 4c7e8ce645..a8d666129a 100644
--- a/src/utils/index.ts
+++ b/src/utils/index.ts
@@ -1,3 +1,4 @@
+// 开源项目MIT,未经作者同意,不得以抄袭/复制代码/修改源代码版权信息,允许商业途径。
// Copyright @ 2018-present xiejiahe. All rights reserved. MIT license.
// See https://github.com/xjh22222228/nav
@@ -15,8 +16,10 @@ import { STORAGE_KEY_MAP } from 'src/constants'
import { isLogin } from './user'
import { SearchType } from 'src/components/search-engine/index'
import { getIconUrl } from 'src/services'
+import localforage from 'localforage'
+import event from 'src/utils/mitt'
-export const websiteList: INavProps[] = getWebsiteList()
+export let websiteList: INavProps[] = []
const searchEngineList: ISearchEngineProps[] = (s as any).default
@@ -247,14 +250,14 @@ export function adapterWebsiteList(websiteList: any[]) {
return websiteList
}
-export function getWebsiteList(): INavProps[] {
- let webSiteList = adapterWebsiteList((db as any).default)
- const scriptElAll = document.querySelectorAll('script')
- const scriptUrl = scriptElAll[scriptElAll.length - 1].src
- const storageScriptUrl = window.localStorage.getItem(STORAGE_KEY_MAP.s_url)
+;(async () => {
+ let data = adapterWebsiteList((db as any).default)
+ const metaEl = document.getElementById('META-NAV')
+ const date = metaEl?.dataset?.['date'] || ''
+ const storageDate = window.localStorage.getItem(STORAGE_KEY_MAP.s_url)
// 检测到网站更新,清除缓存本地保存记录失效
- if (storageScriptUrl !== scriptUrl) {
+ if (storageDate !== date) {
const whiteList = [
STORAGE_KEY_MAP.token,
STORAGE_KEY_MAP.isDark,
@@ -268,25 +271,30 @@ export function getWebsiteList(): INavProps[] {
}
window.localStorage.removeItem(key)
}
- window.localStorage.setItem(STORAGE_KEY_MAP.s_url, scriptUrl)
- return webSiteList
+ window.localStorage.setItem(STORAGE_KEY_MAP.s_url, date)
+ localforage.removeItem(STORAGE_KEY_MAP.website)
+ data.forEach((item) => {
+ websiteList.push(item)
+ })
+ event.emit('WEB_FINISH')
+ window.__FINISHED__ = true
+ return
}
try {
- const w: any = window.localStorage.getItem(STORAGE_KEY_MAP.website)
- const json = JSON.parse(w)
- if (Array.isArray(json)) {
- webSiteList = json
- }
+ const dbData: any =
+ (await localforage.getItem(STORAGE_KEY_MAP.website)) || data
+ dbData.forEach((item: any) => {
+ websiteList.push(item)
+ })
+ event.emit('WEB_FINISH')
+ window.__FINISHED__ = true
} catch {}
-
- return webSiteList
-}
+})()
export function setWebsiteList(v?: INavProps[]) {
v = v || websiteList
-
- window.localStorage.setItem(STORAGE_KEY_MAP.website, JSON.stringify(v))
+ localforage.setItem(STORAGE_KEY_MAP.website, v)
}
export function toggleCollapseAll(wsList?: INavProps[]): boolean {
@@ -521,3 +529,7 @@ export function downloadAsFile(str: string, fileName: string) {
document.body.removeChild(a)
URL.revokeObjectURL(url)
}
+
+export function isMobile() {
+ return 'ontouchstart' in window
+}
diff --git a/src/utils/mitt.ts b/src/utils/mitt.ts
index 9ea06008e5..d887cdf106 100644
--- a/src/utils/mitt.ts
+++ b/src/utils/mitt.ts
@@ -1,3 +1,4 @@
+// 开源项目MIT,未经作者同意,不得以抄袭/复制代码/修改源代码版权信息,允许商业途径。
import mitt from 'mitt'
export default mitt()
diff --git a/src/utils/user.ts b/src/utils/user.ts
index c3f53bcb57..3339d011c0 100644
--- a/src/utils/user.ts
+++ b/src/utils/user.ts
@@ -1,5 +1,8 @@
+// 开源项目MIT,未经作者同意,不得以抄袭/复制代码/修改源代码版权信息,允许商业途径。
// Copyright @ 2018-present xiejiahe. All rights reserved. MIT license.
// See https://github.com/xjh22222228/nav
+import localforage from 'localforage'
+
export function getToken() {
return window.localStorage.getItem('token') || ''
}
@@ -30,6 +33,7 @@ export function removeWebsite() {
export function userLogout() {
const code = getAuthCode()
+ localforage.clear()
window.localStorage.clear()
setAuthCode(code)
}
diff --git a/src/view/app/default/app.component.html b/src/view/app/default/app.component.html
index 6f86171788..c9031dd909 100644
--- a/src/view/app/default/app.component.html
+++ b/src/view/app/default/app.component.html
@@ -1,7 +1,7 @@