Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
gitcode_dev
开源百科
提交
668da058
开
开源百科
项目概览
gitcode_dev
/
开源百科
通知
253
Star
3
Fork
3
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
17
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
代码片段
项目成员
Pages
开
开源百科
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
17
Issue
17
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
代码片段
代码片段
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
668da058
编写于
2月 17, 2021
作者:
X
xjh22222228
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
refactor(nav.config): Remove searchEngineList
上级
10d0d680
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
59 addition
and
49 deletion
+59
-49
data/search.json
data/search.json
+47
-0
nav.config.ts
nav.config.ts
+0
-42
src/components/search-engine/search-engine.component.ts
src/components/search-engine/search-engine.component.ts
+3
-3
src/types/index.d.ts
src/types/index.d.ts
+1
-1
src/utils/index.ts
src/utils/index.ts
+3
-1
src/view/index/side/index.component.ts
src/view/index/side/index.component.ts
+5
-2
未找到文件。
data/search.json
0 → 100644
浏览文件 @
668da058
[
{
"name"
:
"站内"
,
"icon"
:
"https://raw.sevencdn.com/xjh22222228/nav/image/logo.png"
,
"placeholder"
:
"站内搜索"
,
"blocked"
:
false
},
{
"name"
:
"百度"
,
"url"
:
"https://www.baidu.com/s?wd="
,
"icon"
:
"https://raw.sevencdn.com/xjh22222228/nav/image/baidu.svg"
,
"placeholder"
:
"百度一下"
,
"blocked"
:
false
},
{
"name"
:
"Google"
,
"url"
:
"https://www.google.com/search?q="
,
"icon"
:
"https://raw.sevencdn.com/xjh22222228/nav/image/google.svg"
,
"blocked"
:
false
},
{
"name"
:
"必应"
,
"url"
:
"https://cn.bing.com/search?q="
,
"icon"
:
"https://raw.sevencdn.com/xjh22222228/nav/image/bing.svg"
,
"blocked"
:
false
},
{
"name"
:
"GitHub"
,
"url"
:
"https://github.com/search?q="
,
"icon"
:
"https://raw.sevencdn.com/xjh22222228/nav/image/github.svg"
,
"placeholder"
:
"Search GitHub"
,
"blocked"
:
false
},
{
"name"
:
"知乎"
,
"url"
:
"https://www.zhihu.com/search?type=content&q="
,
"icon"
:
"https://raw.sevencdn.com/xjh22222228/nav/image/zhihu.svg"
,
"blocked"
:
false
},
{
"name"
:
"豆瓣"
,
"url"
:
"https://search.douban.com/book/subject_search?search_text="
,
"icon"
:
"https://raw.sevencdn.com/xjh22222228/nav/image/douban.svg"
,
"placeholder"
:
"书名、作者、ISBN"
,
"blocked"
:
false
}
]
\ No newline at end of file
nav.config.ts
浏览文件 @
668da058
...
...
@@ -25,48 +25,6 @@ const c: IConfig = {
// 默认主题: Light | Sim | Side | App
theme
:
'
Light
'
,
// 搜索引擎列表, 为空时不显示搜索引擎
searchEngineList
:
[
{
name
:
'
站内
'
,
icon
:
'
https://raw.sevencdn.com/xjh22222228/nav/image/logo.png
'
,
placeholder
:
'
站内搜索
'
},
{
name
:
'
百度
'
,
url
:
'
https://www.baidu.com/s?wd=
'
,
icon
:
'
https://raw.sevencdn.com/xjh22222228/nav/image/baidu.svg
'
,
placeholder
:
'
百度一下
'
},
{
name
:
'
Google
'
,
url
:
'
https://www.google.com/search?q=
'
,
icon
:
'
https://raw.sevencdn.com/xjh22222228/nav/image/google.svg
'
,
},
{
name
:
'
必应
'
,
url
:
'
https://cn.bing.com/search?q=
'
,
icon
:
'
https://raw.sevencdn.com/xjh22222228/nav/image/bing.svg
'
,
},
{
name
:
'
GitHub
'
,
url
:
'
https://github.com/search?q=
'
,
icon
:
'
https://raw.sevencdn.com/xjh22222228/nav/image/github.svg
'
,
placeholder
:
'
Search GitHub
'
},
{
name
:
'
知乎
'
,
url
:
'
https://www.zhihu.com/search?type=content&q=
'
,
icon
:
'
https://raw.sevencdn.com/xjh22222228/nav/image/zhihu.svg
'
,
},
{
name
:
'
豆瓣
'
,
url
:
'
https://search.douban.com/book/subject_search?search_text=
'
,
icon
:
'
https://raw.sevencdn.com/xjh22222228/nav/image/douban.svg
'
,
placeholder
:
'
书名、作者、ISBN
'
}
],
// 网站底部内容, 版权信息、备案号, 可以是 HTML
footerContent
:
`
<div style="font-weight: bold;">共收录
\$
{total}个网站</div>
...
...
src/components/search-engine/search-engine.component.ts
浏览文件 @
668da058
// Copyright @ 2018-2021 xiejiahe. All rights reserved. MIT license.
import
hotkeys
from
'
hotkeys-js
'
import
config
from
'
../../../nav.config
'
import
{
Component
}
from
'
@angular/core
'
import
{
getDefaultSearchEngine
,
setDefaultSearchEngine
,
queryString
}
from
'
../../utils
'
import
{
Router
}
from
'
@angular/router
'
import
*
as
searchEngineList
from
'
../../../data/search.json
'
@
Component
({
selector
:
'
app-search-engine
'
,
...
...
@@ -12,7 +12,7 @@ import { Router } from '@angular/router'
styleUrls
:
[
'
./search-engine.component.scss
'
]
})
export
class
SearchEngineComponent
{
searchEngineList
=
config
.
searchEngineLis
t
searchEngineList
=
(
searchEngineList
as
any
).
defaul
t
currentEngine
=
getDefaultSearchEngine
()
showEngine
=
false
keyword
=
queryString
().
q
...
...
@@ -54,7 +54,7 @@ export class SearchEngineComponent {
}
clickEngineItem
(
index
)
{
this
.
currentEngine
=
config
.
searchEngineList
[
index
]
this
.
currentEngine
=
this
.
searchEngineList
[
index
]
this
.
toggleEngine
()
this
.
inputFocus
()
setDefaultSearchEngine
(
this
.
currentEngine
)
...
...
src/types/index.d.ts
浏览文件 @
668da058
...
...
@@ -56,6 +56,7 @@ export interface ISearchEngineProps {
url
?:
string
icon
:
string
|
null
placeholder
?:
string
blocked
:
boolean
}
export
interface
IConfig
{
...
...
@@ -66,7 +67,6 @@ export interface IConfig {
description
:
string
keywords
:
string
theme
:
ThemeType
searchEngineList
:
ISearchEngineProps
[]
footerContent
?:
string
|
null
baiduStatisticsUrl
?:
string
cnzzStatisticsUrl
?:
string
...
...
src/utils/index.ts
浏览文件 @
668da058
...
...
@@ -6,12 +6,14 @@ import config from '../../nav.config'
import
Clipboard
from
'
clipboard
'
import
{
INavFourProp
,
INavProps
,
ISearchEngineProps
}
from
'
../types
'
import
*
as
db
from
'
../../data/db.json
'
import
*
as
s
from
'
../../data/search.json
'
export
const
websiteList
=
getWebsiteList
()
let
total
=
0
const
{
lightThemeConfig
,
searchEngineList
}
=
config
const
{
lightThemeConfig
}
=
config
const
{
backgroundLinear
}
=
lightThemeConfig
const
searchEngineList
:
ISearchEngineProps
[]
=
(
s
as
any
).
default
export
function
randomInt
(
max
:
number
)
{
return
Math
.
floor
(
Math
.
random
()
*
max
)
...
...
src/view/index/side/index.component.ts
浏览文件 @
668da058
...
...
@@ -4,7 +4,7 @@
import
config
from
'
../../../../nav.config
'
import
{
Component
}
from
'
@angular/core
'
import
{
Router
,
ActivatedRoute
}
from
'
@angular/router
'
import
{
INavProps
,
INavThreeProp
}
from
'
../../../types
'
import
{
INavProps
,
INavThreeProp
,
ISearchEngineProps
}
from
'
../../../types
'
import
{
fuzzySearch
,
queryString
,
...
...
@@ -13,6 +13,9 @@ import {
}
from
'
../../../utils
'
import
{
websiteList
}
from
'
../../../store
'
import
{
LOGO_CDN
}
from
'
../../../constants
'
import
*
as
s
from
'
../../../../data/search.json
'
const
searchEngineList
:
ISearchEngineProps
[]
=
(
s
as
any
).
default
@
Component
({
selector
:
'
app-home
'
,
...
...
@@ -28,7 +31,7 @@ export default class HomeComponent {
title
:
string
=
config
.
title
.
trim
().
split
(
/
\s
/
)[
0
]
openIndex
=
queryString
().
page
contentEl
:
HTMLElement
searchEngineList
=
config
.
searchEngineList
searchEngineList
=
searchEngineList
constructor
(
private
router
:
Router
,
private
activatedRoute
:
ActivatedRoute
)
{}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录