Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openeuler
website
提交
fc072878
W
website
项目概览
openeuler
/
website
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
W
website
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
fc072878
编写于
5月 05, 2020
作者:
L
Librahang
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Fix the issue "Not precise location in the docs".
上级
c86d9392
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
79 addition
and
36 deletion
+79
-36
themes/project/layouts/partials/scripts.html
themes/project/layouts/partials/scripts.html
+79
-36
未找到文件。
themes/project/layouts/partials/scripts.html
浏览文件 @
fc072878
...
...
@@ -5,40 +5,31 @@
integrity=
"sha384-Tc5IQib027qvyjSMfHjOMaLkfuWVxZxUPnCJA7l2mCWNIpG9mGCD8wGNIcPD7Txa"
crossorigin=
"anonymous"
></script>
<script
src=
"//cdnjs.cloudflare.com/ajax/libs/jstree/3.3.4/jstree.min.js"
></script>
<script
src=
"//cdnjs.cloudflare.com/ajax/libs/jquery-cookie/1.4.1/jquery.cookie.min.js"
></script>
<script
src=
"//cdnjs.cloudflare.com/ajax/libs/waypoints/4.0.1/jquery.waypoints.min.js"
></script>
<script
src=
"//cdnjs.cloudflare.com/ajax/libs/Counter-Up/1.0/jquery.counterup.min.js"
></script>
<script
src=
"//cdnjs.cloudflare.com/ajax/libs/jquery-parallax/1.1.3/jquery-parallax.js"
></script>
<script
src=
"{{ .Site.BaseURL }}js/front.js"
></script>
<!-- owl carousel -->
<script
src=
"{{ .Site.BaseURL }}js/owl.carousel.min.js"
></script>
<!-- used to for mobile -->
<script
src=
"{{ .Site.BaseURL }}js/flexible.js"
></script>
<script
src=
"{{ .Site.BaseURL }}js/common.js"
></script>
<script
src=
"{{ .Site.BaseURL }}js/dist/jso.js"
></script>
<script
src=
"{{ .Site.BaseURL }}js/cla.js?t=20191230"
></script>
<div
id=
"mask"
onclick=
"hideNav()"
></div>
<script
type=
"text/javascript"
>
$
(
document
).
ready
(
function
()
{
function
getRelativePath
()
{
var
url
=
location
.
href
;
var
arrURL
=
url
.
split
(
"
//
"
);
return
arrURL
[
1
].
substring
(
arrURL
[
1
].
indexOf
(
"
/
"
));
var
arrURL
=
url
.
split
(
'
//
'
);
return
arrURL
[
1
].
substring
(
arrURL
[
1
].
indexOf
(
'
/
'
));
}
function
getCurrentID
(
wholeData
,
relativeURL
)
{
for
(
var
j
in
wholeData
)
{
var
href
=
wholeData
[
j
].
a_attr
.
href
;
var
text
=
wholeData
[
j
].
text
;
//debugger;
if
((
href
==
relativeURL
)
||
(
text
.
indexOf
(
relativeURL
)
>=
0
))
{
//console.log(wholeData[j].id);
if
((
href
===
relativeURL
)
||
(
text
.
indexOf
(
relativeURL
)
>=
0
))
{
return
wholeData
[
j
].
id
;
}
else
{
if
(
wholeData
[
j
].
children
.
length
>
0
)
{
...
...
@@ -49,9 +40,8 @@
}
}
}
return
""
;
return
''
;
}
if
(
$
(
'
#docstreeview
'
).
length
)
{
$
(
'
#docstreeview
'
).
jstree
();
$
(
'
#docstreeview
'
).
jstree
().
hide_dots
();
...
...
@@ -74,41 +64,94 @@
}
}
});
/* select the node by the relative url
var currentAElement = $('#docstreeview').find("a[href='" + getRelativePath() + "']");
if (currentAElement.length) {
console.log("click");
currentAElement.trigger("click");
}*/
$
(
"
#docstreeview
"
).
on
(
"
ready.jstree
"
,
function
(
e
,
data
)
{
$
(
"
#docstreeview
"
).
fadeIn
(
"
slow
"
)
$
(
'
#docstreeview
'
).
on
(
'
ready.jstree
'
,
function
(
e
,
data
)
{
$
(
'
#docstreeview
'
).
fadeIn
(
'
slow
'
);
var
relativeURL
=
getRelativePath
();
var
wholeData
=
$
(
"
#docstreeview
"
).
jstree
().
get_json
();
var
wholeData
=
$
(
'
#docstreeview
'
).
jstree
().
get_json
();
var
currentID
=
getCurrentID
(
wholeData
,
relativeURL
);
console
.
log
(
currentID
);
$
(
"
#docstreeview
"
).
jstree
().
_open_to
(
currentID
);
$
(
'
#docstreeview
'
).
jstree
().
_open_to
(
currentID
);
$
(
'
#docstreeview
'
).
jstree
().
select_node
(
currentID
);
$
(
'
#docstreeview
'
).
jstree
().
open_node
(
currentID
);
var
data
=
$
(
'
#docstreeview
'
).
jstree
().
get_json
();
var
nodeList
=
[];
/*把树状平铺,用于查看是否有上一页下一页*/
var
getAllData
=
function
(
Arr
)
{
for
(
var
i
=
0
;
i
<
Arr
.
length
;
i
++
)
{
var
tempNode
=
{};
tempNode
.
id
=
Arr
[
i
].
id
;
var
href
=
Arr
[
i
].
a_attr
.
href
;
if
(
href
===
'
#
'
)
{
/*转为jq对象特殊处理*/
var
jqNode
=
$
(
Arr
[
i
].
text
);
tempNode
.
href
=
jqNode
.
find
(
'
a
'
).
attr
(
'
href
'
);
}
else
{
tempNode
.
href
=
href
;
}
nodeList
.
push
(
tempNode
);
if
(
Arr
[
i
].
children
!==
[])
{
getAllData
(
Arr
[
i
].
children
);
}
}
};
/*获取上一页、下一页*/
var
nextAndPevious
=
function
(
arr
,
id
)
{
var
result
=
[];
for
(
var
i
=
0
;
i
<
arr
.
length
;
i
++
)
{
if
(
arr
[
i
].
id
===
id
)
{
if
(
i
===
0
)
{
result
.
push
(
null
);
}
else
{
result
.
push
(
arr
[
i
-
1
].
href
);
}
if
(
i
===
arr
.
length
-
1
)
{
result
.
push
(
null
);
}
else
{
result
.
push
(
arr
[
i
+
1
].
href
);
}
}
}
return
result
;
};
getAllData
(
wholeData
);
var
nextAndPeviousArr
=
nextAndPevious
(
nodeList
,
currentID
);
if
(
nextAndPeviousArr
[
0
]
==
null
)
{
$
(
'
#docPreviousPage
'
).
attr
(
'
disabled
'
,
'
disabled
'
);
}
else
{
$
(
'
#docPreviousPage
'
).
attr
(
'
href
'
,
nextAndPeviousArr
[
0
]);
}
if
(
nextAndPeviousArr
[
1
]
==
null
)
{
$
(
'
#docNextPage
'
).
attr
(
'
disabled
'
,
'
disabled
'
);
}
else
{
$
(
'
#docNextPage
'
).
attr
(
'
href
'
,
nextAndPeviousArr
[
1
]);
}
});
}
function
showNav
()
{
$
(
'
#menu
'
).
css
({
"
transform
"
:
"
translateX(0)
"
}).
attr
(
"
onoff
"
,
"
on
"
);
'
transform
'
:
'
translateX(0)
'
}).
attr
(
'
onoff
'
,
'
on
'
);
}
function
hideNav
()
{
$
(
'
#menu
'
).
css
({
"
transform
"
:
"
translateX(-100%)
"
}).
attr
(
"
onoff
"
,
"
off
"
);
'
transform
'
:
'
translateX(-100%)
'
}).
attr
(
'
onoff
'
,
'
off
'
);
}
$
(
"
#slideNav
"
).
bind
(
'
click
'
,
function
()
{
if
(
$
(
'
#menu
'
).
attr
(
"
onoff
"
)
==
"
on
"
)
{
$
(
'
#slideNav
'
).
bind
(
'
click
'
,
function
()
{
if
(
$
(
'
#menu
'
).
attr
(
'
onoff
'
)
===
'
on
'
)
{
hideNav
();
}
else
{
showNav
();
}
})
});
$
(
'
a[href^="#"][href!="#"]
'
).
click
(
function
()
{
var
target
=
document
.
getElementById
(
decodeURI
(
this
.
hash
).
split
(
'
#
'
)[
1
]);
if
(
!
target
)
return
;
var
targetOffset
=
$
(
target
).
offset
().
top
-
140
+
"
px
"
;
$
(
'
html,body
'
).
animate
({
scrollTop
:
targetOffset
},
300
);
return
false
;
});
});
</script>
</script>
\ No newline at end of file
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录