Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
wanjj_1210
ant-design
提交
b334404f
A
ant-design
项目概览
wanjj_1210
/
ant-design
与 Fork 源项目一致
从无法访问的项目Fork
通知
10
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
A
ant-design
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
b334404f
编写于
7月 10, 2015
作者:
Z
zhujun24
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
add components search
上级
5484e96c
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
91 addition
and
1 deletion
+91
-1
site/templates/layout.html
site/templates/layout.html
+9
-1
static/script.js
static/script.js
+48
-0
static/style.css
static/style.css
+34
-0
未找到文件。
site/templates/layout.html
浏览文件 @
b334404f
...
...
@@ -15,6 +15,7 @@
<link
rel=
"stylesheet"
href=
"/static/style.css"
>
<link
rel=
"stylesheet"
href=
"/static/tomorrow.css"
>
<script
src=
"https://a.alipayobjects.com/??jquery/jquery/1.11.1/jquery.js,es5-shim/4.0.5/es5-shim.js,es5-shim/4.0.5/es5-sham.js,html5shiv/3.7.2/src/html5shiv.js,react/0.13.3/react.js,bluebird/2.9.30/bluebird.js"
></script>
<script
charset=
"utf-8"
id=
"seajsnode"
src=
"http://static.alipayobjects.com/seajs/??seajs/2.2.2/sea.js,seajs-combo/1.0.1/seajs-combo.js,seajs-style/1.0.2/seajs-style.js"
></script>
<script
src=
"/static/script.js"
></script>
<script>
window
.
antdVersion
=
{
...
...
@@ -30,8 +31,15 @@
<img
width=
"60"
src=
"https://t.alipayobjects.com/images/rmsweb/T1B9hfXcdvXXXXXXXX.svg"
>
{{ config.site.name }}
</a>
<div
class=
"search"
>
<div
class=
"hidden"
>
{%- for item in resource.pages %}
{%- if item.meta.category === 'Components' %}
<input
type=
"hidden"
value=
"{{item.title}} {{item.meta.chinese}}"
/>
{%- endif %}
{%- endfor %}
</div>
<form>
<input
type=
"text"
placeholder=
"search"
>
<input
class=
"search-input"
type=
"text"
placeholder=
"search"
>
<button
type=
"submit"
></button>
</form>
</div>
...
...
static/script.js
浏览文件 @
b334404f
$
(
function
()
{
// 获取搜索数据
var
searchData
=
[];
$
(
'
.hidden input
'
).
each
(
function
(
i
,
item
)
{
var
obj
=
{};
obj
.
english
=
item
.
value
.
split
(
'
'
)[
0
];
obj
.
chinese
=
item
.
value
.
split
(
'
'
)[
1
];
obj
.
value
=
item
.
value
.
toLowerCase
().
replace
(
/
\s
+/g
,
""
);
searchData
.
push
(
obj
);
});
seajs
.
config
({
base
:
'
http://static.alipayobjects.com
'
,
alias
:
{
'
jquery
'
:
'
jquery/1.7.2/jquery
'
,
'
autocomplete
'
:
'
arale-autocomplete/1.4.1/autocomplete
'
}
});
seajs
.
use
([
'
jquery
'
,
'
autocomplete
'
],
function
(
$
,
AutoComplete
){
$
(
function
()
{
var
ac
=
new
AutoComplete
({
trigger
:
'
.search-input
'
,
selectFirst
:
true
,
submitOnEnter
:
false
,
dataSource
:
searchData
,
html
:
'
<strong>{{english}}</strong> <span>{{chinese}}</span>
'
,
filter
:
function
(
data
,
query
)
{
var
result
=
[];
query
=
query
.
toLowerCase
().
replace
(
/^
\s
+|
\s
+$/g
,
''
);
if
(
!
query
)
return
result
;
$
.
each
(
data
,
function
(
index
,
item
)
{
if
(
new
RegExp
(
query
).
test
(
item
.
value
))
{
result
.
push
(
item
);
}
});
return
result
;
}
}).
render
();
ac
.
on
(
'
itemSelected
'
,
function
(
item
)
{
$
(
ac
.
get
(
'
trigger
'
)).
val
(
'
正转到
'
+
item
.
english
+
'
'
+
item
.
chinese
).
attr
(
'
disabled
'
,
'
disabled
'
);
location
.
href
=
'
/components/
'
+
item
.
english
.
toLowerCase
();
});
});
});
$
(
'
.component-demos .icon-all
'
).
on
(
'
click
'
,
function
()
{
if
(
$
(
this
).
hasClass
(
'
expand
'
))
{
$
(
this
).
removeClass
(
'
expand
'
);
...
...
static/style.css
浏览文件 @
b334404f
...
...
@@ -754,6 +754,40 @@ footer ul li > a {
animation
:
Load5
2s
cubic-bezier
(
0.645
,
0.045
,
0.355
,
1
)
infinite
alternate
;
-webkit-animation
:
Load5
2s
cubic-bezier
(
0.645
,
0.045
,
0.355
,
1
)
infinite
alternate
;
}
/* autocomplete */
.ui-select
ul
{
outline
:
none
;
position
:
relative
;
list-style-type
:
none
;
padding
:
0
;
margin
:
0
;
text-align
:
left
;
background-color
:
#fff
;
border-radius
:
3px
;
box-shadow
:
0
1px
5px
#ccc
;
background-clip
:
padding-box
;
border
:
1px
solid
#ccc
;
}
.ui-select-item
{
width
:
156px
;
padding
:
10px
12px
;
clear
:
both
;
font-size
:
14px
;
font-weight
:
normal
;
color
:
#666
;
white-space
:
nowrap
;
text-overflow
:
ellipsis
;
overflow
:
hidden
;
}
.ui-select-item-hover
{
cursor
:
pointer
;
background-color
:
#eaf8fe
;
}
/* autocomplete end */
@keyframes
Load5
{
0
%
{
opacity
:
0
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录