Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
zzx_123123
zui
提交
77d55e0c
Z
zui
项目概览
zzx_123123
/
zui
与 Fork 源项目一致
Fork自
易企天创 / zui
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
Z
zui
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
77d55e0c
编写于
8月 31, 2016
作者:
C
Catouse
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
* add page reload button to document in debug mode.
上级
b6b56e8a
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
128 addition
and
99 deletion
+128
-99
index.html
index.html
+1
-0
src/js/doc.js
src/js/doc.js
+115
-99
src/less/doc.less
src/less/doc.less
+12
-0
未找到文件。
index.html
浏览文件 @
77d55e0c
...
...
@@ -73,6 +73,7 @@
<i
class=
"icon icon-star"
></i>
<h2><a
class=
"name"
href=
"###"
>
图标
</a></h2>
<button
type=
"button"
class=
"btn btn-link"
id=
"pageTogger"
title=
"折叠/展开 章节"
data-toggle=
"tooltip"
></button>
<button
data-toggle=
"tooltip"
title=
"刷新"
type=
"button"
class=
"btn btn-link"
id=
"pageReloadBtn"
><i
class=
"icon-repeat"
></i></button>
<button
data-toggle=
"tooltip"
title=
"关闭(ESC)"
type=
"button"
class=
"btn btn-link path-close-btn path-btn"
id=
"pageCloseBtn"
><i
class=
"path-1"
></i></button>
</div>
</div>
...
...
src/js/doc.js
浏览文件 @
77d55e0c
...
...
@@ -58,7 +58,10 @@
};
var
debug
=
getQueryString
(
'
debug
'
,
0
);
if
(
debug
)
console
.
warn
(
"
DEBUG ENABLED.
"
);
if
(
debug
)
{
console
.
warn
(
"
DEBUG ENABLED.
"
);
$
(
'
#pageReloadBtn
'
).
show
();
}
var
chapters
=
{
basic
:
{
col
:
1
},
...
...
@@ -81,7 +84,7 @@
UNDEFINED
=
undefined
,
dataVersion
,
storageEnable
,
docIndex
,
iconsIndex
,
docIndex
,
iconsIndex
,
currentSection
,
zuiPkg
,
pkgLibs
=
{
standard
:
null
,
...
...
@@ -1154,12 +1157,115 @@
if
(
!
delayMutedPageLoading
)
stopPageLoading
();
};
var
loadPage
=
function
(
section
,
topic
,
waitRemote
)
{
section
=
section
||
currentSection
;
$pageContent
.
empty
();
$page
.
addClass
(
'
loading
'
);
$pageLoader
.
removeClass
(
'
with-error
'
).
addClass
(
'
loading
'
);
var
lastShowDataCall
;
loadData
(
section
.
url
,
function
(
data
,
dataType
)
{
var
showData
=
function
()
{
if
(
data
&&
window
.
marked
&&
section
.
targetType
===
'
markdown
'
)
{
var
$article
=
$
();
var
frontMatterIndex
=
data
.
indexOf
(
'
\n
---
\n
'
);
if
(
frontMatterIndex
>
-
1
)
data
=
data
.
substr
(
frontMatterIndex
+
5
);
var
$markdown
=
$
(
window
.
marked
(
data
));
var
$lastSection
,
checkFirstH1
=
true
;
var
hasH2
=
$markdown
.
filter
(
'
h2
'
).
length
>
0
;
var
$lastTemplate
=
null
;
$markdown
.
each
(
function
()
{
var
$tag
=
$
(
this
);
var
tagName
=
$tag
.
prop
(
'
tagName
'
);
if
(
!
tagName
||
tagName
===
'
STYLE
'
||
tagName
===
'
SCRIPT
'
)
{
$article
=
$article
.
add
(
$tag
);
return
;
}
if
(
tagName
===
'
TEMPLATE
'
||
tagName
===
'
HOLDER
'
)
{
$lastTemplate
=
$tag
;
return
;
}
else
if
(
$lastTemplate
)
{
$tag
.
attr
(
$lastTemplate
.
allAttrs
());
$lastTemplate
=
null
;
}
if
(
tagName
===
'
TABLE
'
)
{
$tag
.
addClass
(
'
table
'
);
}
if
(
checkFirstH1
)
{
if
(
tagName
===
'
H1
'
)
{
$pageHeader
.
find
(
'
h2 > .name
'
).
text
(
$tag
.
html
());
}
checkFirstH1
=
false
;
return
;
}
if
(
tagName
===
'
EXAMPLE
'
)
{
$tag
=
$
(
'
<div/>
'
).
attr
(
$tag
.
allAttrs
()).
html
(
$tag
.
html
()).
addClass
(
'
example
'
);
}
if
((
hasH2
&&
(
tagName
===
'
H1
'
||
tagName
===
'
H2
'
))
||
(
!
hasH2
&&
tagName
===
'
H3
'
))
{
if
(
$lastSection
)
{
$article
=
$article
.
add
(
$lastSection
);
}
$lastSection
=
$
(
'
<section><header><h3>
'
+
$tag
.
html
()
+
'
</h3></header><article></article></section>
'
);
}
else
{
if
(
hasH2
)
{
if
(
tagName
===
'
H3
'
)
{
$tag
=
$
(
'
<h4>
'
).
html
(
$tag
.
html
());
}
else
if
(
tagName
===
'
H4
'
)
{
$tag
=
$
(
'
<h5>
'
).
html
(
$tag
.
html
());
}
else
if
(
tagName
===
'
H5
'
)
{
$tag
=
$
(
'
<h6>
'
).
html
(
$tag
.
html
());
}
}
if
(
!
$lastSection
)
{
$lastSection
=
$
(
'
<article></article>
'
);
}
if
(
$lastSection
.
prop
(
'
tagName
'
)
===
'
ARTICLE
'
)
{
$lastSection
.
append
(
$tag
);
}
else
{
$lastSection
.
children
(
'
article
'
).
append
(
$tag
);
}
}
});
if
(
$lastSection
)
{
$article
=
$article
.
add
(
$lastSection
);
}
$pageContent
.
empty
().
append
(
$article
);
}
else
{
try
{
$pageContent
.
html
(
data
);
}
catch
(
e
)
{
console
.
error
(
'
Page data has error:
'
,
{
content
:
data
,
error
:
e
});
}
}
$pageBody
.
scrollTop
(
0
);
showPageTopic
(
topic
);
handlePageLoad
();
$pageAttrs
.
show
();
}
if
(
lastShowDataCall
)
clearTimeout
(
lastShowDataCall
);
if
(
$page
.
hasClass
(
'
openning
'
))
{
lastShowDataCall
=
setTimeout
(
showData
,
700
);
}
else
{
showData
();
}
},
400
,
waitRemote
);
if
(
$body
.
hasClass
(
'
page-open
'
))
{
if
(
debug
)
console
.
log
(
'
open section in open page
'
,
section
);
return
;
}
$body
.
addClass
(
'
page-open
'
);
};
var
openPage
=
function
(
$section
,
section
,
topic
)
{
var
pageId
=
section
.
chapter
+
'
-
'
+
section
.
id
;
if
(
$body
.
hasClass
(
'
page-open
'
)
&&
pageId
===
$body
.
attr
(
'
data-page
'
))
{
if
(
debug
)
console
.
warn
(
'
The page already showed.
'
);
return
;
}
currentSection
=
section
;
chooseSection
(
$section
,
false
,
true
);
// Send ga data
...
...
@@ -1274,103 +1380,7 @@
}
}
$pageContent
.
empty
();
$page
.
addClass
(
'
loading
'
);
$pageLoader
.
removeClass
(
'
with-error
'
).
addClass
(
'
loading
'
);
var
lastShowDataCall
;
loadData
(
section
.
url
,
function
(
data
)
{
var
showData
=
function
()
{
if
(
data
&&
window
.
marked
&&
section
.
targetType
===
'
markdown
'
)
{
var
$article
=
$
();
var
frontMatterIndex
=
data
.
indexOf
(
'
\n
---
\n
'
);
if
(
frontMatterIndex
>
-
1
)
data
=
data
.
substr
(
frontMatterIndex
+
5
);
var
$markdown
=
$
(
window
.
marked
(
data
));
var
$lastSection
,
checkFirstH1
=
true
;
var
hasH2
=
$markdown
.
filter
(
'
h2
'
).
length
>
0
;
var
$lastTemplate
=
null
;
$markdown
.
each
(
function
()
{
var
$tag
=
$
(
this
);
var
tagName
=
$tag
.
prop
(
'
tagName
'
);
if
(
!
tagName
||
tagName
===
'
STYLE
'
||
tagName
===
'
SCRIPT
'
)
{
$article
=
$article
.
add
(
$tag
);
return
;
}
if
(
tagName
===
'
TEMPLATE
'
||
tagName
===
'
HOLDER
'
)
{
$lastTemplate
=
$tag
;
return
;
}
else
if
(
$lastTemplate
)
{
$tag
.
attr
(
$lastTemplate
.
allAttrs
());
$lastTemplate
=
null
;
}
if
(
tagName
===
'
TABLE
'
)
{
$tag
.
addClass
(
'
table
'
);
}
if
(
checkFirstH1
)
{
if
(
tagName
===
'
H1
'
)
{
$pageHeader
.
find
(
'
h2 > .name
'
).
text
(
$tag
.
html
());
}
checkFirstH1
=
false
;
return
;
}
if
(
tagName
===
'
EXAMPLE
'
)
{
$tag
=
$
(
'
<div/>
'
).
attr
(
$tag
.
allAttrs
()).
html
(
$tag
.
html
()).
addClass
(
'
example
'
);
}
if
((
hasH2
&&
(
tagName
===
'
H1
'
||
tagName
===
'
H2
'
))
||
(
!
hasH2
&&
tagName
===
'
H3
'
))
{
if
(
$lastSection
)
{
$article
=
$article
.
add
(
$lastSection
);
}
$lastSection
=
$
(
'
<section><header><h3>
'
+
$tag
.
html
()
+
'
</h3></header><article></article></section>
'
);
}
else
{
if
(
hasH2
)
{
if
(
tagName
===
'
H3
'
)
{
$tag
=
$
(
'
<h4>
'
).
html
(
$tag
.
html
());
}
else
if
(
tagName
===
'
H4
'
)
{
$tag
=
$
(
'
<h5>
'
).
html
(
$tag
.
html
());
}
else
if
(
tagName
===
'
H5
'
)
{
$tag
=
$
(
'
<h6>
'
).
html
(
$tag
.
html
());
}
}
if
(
!
$lastSection
)
{
$lastSection
=
$
(
'
<article></article>
'
);
}
if
(
$lastSection
.
prop
(
'
tagName
'
)
===
'
ARTICLE
'
)
{
$lastSection
.
append
(
$tag
);
}
else
{
$lastSection
.
children
(
'
article
'
).
append
(
$tag
);
}
}
});
if
(
$lastSection
)
{
$article
=
$article
.
add
(
$lastSection
);
}
$pageContent
.
empty
().
append
(
$article
);
}
else
{
try
{
$pageContent
.
html
(
data
);
}
catch
(
e
)
{
console
.
error
(
'
Page data has error:
'
,
{
content
:
data
,
error
:
e
});
}
}
$pageBody
.
scrollTop
(
0
);
showPageTopic
(
topic
);
handlePageLoad
();
$pageAttrs
.
show
();
}
if
(
lastShowDataCall
)
clearTimeout
(
lastShowDataCall
);
if
(
$page
.
hasClass
(
'
openning
'
))
{
lastShowDataCall
=
setTimeout
(
showData
,
700
);
}
else
{
showData
();
}
},
400
);
if
(
$body
.
hasClass
(
'
page-open
'
))
{
if
(
debug
)
console
.
log
(
'
open section in open page
'
,
section
);
return
;
}
$body
.
addClass
(
'
page-open
'
);
loadPage
(
section
,
topic
);
toggleCompactMode
(
true
,
function
()
{
checkScrollbar
();
...
...
@@ -2146,6 +2156,12 @@
}
});
if
(
debug
)
{
$
(
'
#pageReloadBtn
'
).
on
(
'
click
'
,
function
()
{
loadPage
(
null
,
null
,
true
);
});
}
// init code copy function
initCopyable
();
...
...
src/less/doc.less
浏览文件 @
77d55e0c
...
...
@@ -1462,6 +1462,18 @@ body.query-enabled {
border-radius: 4px;
}
#pageReloadBtn {
position: absolute;
right: 70px;
top: 5px;
width: 48px;
height: 48px;
color: @color-gray;
display: none;
&:hover {color: @color-fore}
}
#pageBody {
padding: 15px 0;
position: absolute;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录