Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenDocCN
theme-apachecn
提交
9153c49c
T
theme-apachecn
项目概览
OpenDocCN
/
theme-apachecn
通知
0
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
T
theme-apachecn
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
9153c49c
编写于
4月 13, 2016
作者:
J
Johan Preynat
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Update theme.js to use window.gitbook
上级
87f6e236
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
13 addition
and
19 deletion
+13
-19
src/js/theme/index.js
src/js/theme/index.js
+0
-2
src/js/theme/loading.js
src/js/theme/loading.js
+3
-3
src/js/theme/navigation.js
src/js/theme/navigation.js
+1
-4
src/js/theme/sidebar.js
src/js/theme/sidebar.js
+7
-8
src/js/theme/toolbar.js
src/js/theme/toolbar.js
+2
-2
未找到文件。
src/js/theme/index.js
浏览文件 @
9153c49c
...
...
@@ -28,8 +28,6 @@ function init() {
sidebar
.
toggle
();
}
});
navigation
.
notify
();
}
gitbook
.
events
.
on
(
'
start
'
,
init
);
...
...
src/js/theme/loading.js
浏览文件 @
9153c49c
var
state
=
gitbook
.
state
;
var
gitbook
=
window
.
gitbook
;
function
showLoading
(
p
)
{
state
.
$book
.
addClass
(
'
is-loading
'
);
gitbook
.
state
.
$book
.
addClass
(
'
is-loading
'
);
p
.
always
(
function
()
{
state
.
$book
.
removeClass
(
'
is-loading
'
);
gitbook
.
state
.
$book
.
removeClass
(
'
is-loading
'
);
});
return
p
;
...
...
src/js/theme/navigation.js
浏览文件 @
9153c49c
...
...
@@ -3,8 +3,6 @@ var url = require('url');
var
loading
=
require
(
'
./loading
'
);
var
state
=
gitbook
.
state
;
var
usePushState
=
(
typeof
history
.
pushState
!==
'
undefined
'
);
function
handleNavigation
(
relativeUrl
,
push
)
{
...
...
@@ -58,7 +56,6 @@ function handleNavigation(relativeUrl, push) {
$
(
'
.book-summary .summary
'
).
scrollTop
(
scrollPosition
);
// Update state
state
.
update
(
$
(
'
html
'
));
preparePage
();
})
.
fail
(
function
(
e
)
{
...
...
@@ -74,7 +71,7 @@ function updateNavigationPosition() {
$
(
'
.navigation-next
'
).
css
(
'
margin-right
'
,
(
bodyInnerWidth
-
pageWrapperWidth
)
+
'
px
'
);
}
function
preparePage
(
notify
)
{
function
preparePage
()
{
var
$bookBody
=
$
(
'
.book-body
'
);
var
$bookInner
=
$bookBody
.
find
(
'
.body-inner
'
);
var
$pageWrapper
=
$bookInner
.
find
(
'
.page-wrapper
'
);
...
...
src/js/theme/sidebar.js
浏览文件 @
9153c49c
var
$
=
require
(
'
jquery
'
);
var
storage
=
gitbook
.
storage
;
var
state
=
gitbook
.
state
;
var
platform
=
require
(
'
./platform
'
);
var
gitbook
=
window
.
gitbook
;
// Toggle sidebar with or withour animation
function
toggleSidebar
(
_state
,
animation
)
{
if
(
state
!=
null
&&
isOpen
()
==
_state
)
return
;
if
(
gitbook
.
state
!=
null
&&
isOpen
()
==
_state
)
return
;
if
(
animation
==
null
)
animation
=
true
;
state
.
$book
.
toggleClass
(
'
without-animation
'
,
!
animation
);
state
.
$book
.
toggleClass
(
'
with-summary
'
,
_state
);
gitbook
.
state
.
$book
.
toggleClass
(
'
without-animation
'
,
!
animation
);
gitbook
.
state
.
$book
.
toggleClass
(
'
with-summary
'
,
_state
);
storage
.
set
(
'
sidebar
'
,
isOpen
());
gitbook
.
storage
.
set
(
'
sidebar
'
,
isOpen
());
}
// Return true if sidebar is open
function
isOpen
()
{
return
state
.
$book
.
hasClass
(
'
with-summary
'
);
return
gitbook
.
state
.
$book
.
hasClass
(
'
with-summary
'
);
}
// Prepare sidebar: state and toggle button
function
init
()
{
// Init last state if not mobile
if
(
!
platform
.
isMobile
())
{
toggleSidebar
(
storage
.
get
(
'
sidebar
'
,
true
),
false
);
toggleSidebar
(
gitbook
.
storage
.
get
(
'
sidebar
'
,
true
),
false
);
}
// Close sidebar after clicking a link on mobile
...
...
src/js/theme/toolbar.js
浏览文件 @
9153c49c
var
$
=
require
(
'
jquery
'
);
var
events
=
gitbook
.
events
;
var
gitbook
=
window
.
gitbook
;
// List of created buttons
var
buttons
=
[];
...
...
@@ -171,7 +171,7 @@ function updateAllButtons() {
}
// When page changed, reset buttons
events
.
bind
(
'
page.change
'
,
function
()
{
gitbook
.
events
.
on
(
'
page.change
'
,
function
()
{
updateAllButtons
();
});
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录