Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
大白技术控
yanglr2010
提交
e6447686
Y
yanglr2010
项目概览
大白技术控
/
yanglr2010
通知
1
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
Y
yanglr2010
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
e6447686
编写于
7月 23, 2019
作者:
EvanOne(文一)
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
refactor: Change es6 to es5
上级
f3e48af2
变更
21
隐藏空白更改
内联
并排
Showing
21 changed file
with
88 addition
and
90 deletion
+88
-90
layout/_common/config.pug
layout/_common/config.pug
+4
-4
layout/_common/footer.pug
layout/_common/footer.pug
+6
-6
layout/_common/head.pug
layout/_common/head.pug
+5
-5
layout/_common/header.pug
layout/_common/header.pug
+3
-3
layout/_common/sidebar.pug
layout/_common/sidebar.pug
+14
-14
layout/_components/copyright.pug
layout/_components/copyright.pug
+4
-4
layout/_components/pagination.pug
layout/_components/pagination.pug
+1
-1
layout/_components/recent-posts.pug
layout/_components/recent-posts.pug
+2
-2
layout/_mixins/post-header.pug
layout/_mixins/post-header.pug
+2
-2
layout/_mixins/posts-sort.pug
layout/_mixins/posts-sort.pug
+1
-1
layout/_scripts/cdn.pug
layout/_scripts/cdn.pug
+2
-2
layout/_third-party/comments/disqus.pug
layout/_third-party/comments/disqus.pug
+2
-2
layout/_third-party/comments/gitalk.pug
layout/_third-party/comments/gitalk.pug
+2
-2
layout/_third-party/comments/gitment.pug
layout/_third-party/comments/gitment.pug
+1
-1
layout/_third-party/comments/livere.pug
layout/_third-party/comments/livere.pug
+1
-1
layout/_third-party/comments/valine.pug
layout/_third-party/comments/valine.pug
+2
-2
layout/page.pug
layout/page.pug
+4
-4
source/js/algolia-search.js
source/js/algolia-search.js
+5
-8
source/js/copy.js
source/js/copy.js
+13
-15
source/js/sidebar.js
source/js/sidebar.js
+1
-1
source/js/utils.js
source/js/utils.js
+13
-10
未找到文件。
layout/_common/config.pug
浏览文件 @
e6447686
-
let
algolia = 'undefined';
let
env = process.env;
var
algolia = 'undefined';
var
env = process.env;
if (theme.algolia_search.enable) {
algolia = JSON.stringify({
...
...
@@ -17,8 +17,8 @@
}
script.
let
Stun = window.Stun || {};
let
CONFIG = {
var
Stun = window.Stun || {};
var
CONFIG = {
root: '!{ config.root }',
algolia: !{algolia},
notification: {
...
...
layout/_common/footer.pug
浏览文件 @
e6447686
footer#footer
-
let
footer = theme.footer
let
nowYear = new Date().getFullYear()
let
startYear = footer.copyright.enable ? footer.copyright.since || nowYear : nowYear
let
endYear = footer.copyright.enable ? footer.copyright.end || nowYear : nowYear
var
footer = theme.footer
var
nowYear = new Date().getFullYear()
var
startYear = footer.copyright.enable ? footer.copyright.since || nowYear : nowYear
var
endYear = footer.copyright.enable ? footer.copyright.end || nowYear : nowYear
div.footer-inner
if footer.copyright.enable || footer.beian.enable
...
...
@@ -31,7 +31,7 @@ footer#footer
div
if footer.powered.enable
span.footer-powered
-
let
HEXO_URL = "http://hexo.io/";
-
var
HEXO_URL = "http://hexo.io/";
!= _p("footer.powered", link_to(HEXO_URL, "hexo", { external: true }))
if footer.powered.version
...
...
@@ -42,7 +42,7 @@ footer#footer
if footer.theme.enable
span= _p("footer.theme") + " - "
-
let
STUN_URL = "https://github.com/liuyib/hexo-theme-stun/";
-
var
STUN_URL = "https://github.com/liuyib/hexo-theme-stun/";
!= link_to(STUN_URL, "stun", { external: true })
if footer.theme.version
...
...
layout/_common/head.pug
浏览文件 @
e6447686
-
let
pageTitle = page.title || config.subtitle || ""
var
pageTitle = page.title || config.subtitle || ""
if (page.type === "tags") pageTitle = _p("title.tags")
if (page.type === "categories") pageTitle = _p("title.categories")
...
...
@@ -11,10 +11,10 @@
pageTitle ? pageTitle += " | " + config.title : pageTitle = config.title
let
pageDescription = page.description || page.title || config.description || ""
let
pageKeywords = [config.author, config.title, config.keywords].filter(i => !!i).join(", ")
let
pageAuthor = config.email ? `${config.author}: ${config.email}` : config.author
let
pageCopyright = config.copyright || config.author
var
pageDescription = page.description || page.title || config.description || ""
var
pageKeywords = [config.author, config.title, config.keywords].filter(i => !!i).join(", ")
var
pageAuthor = config.email ? `${config.author}: ${config.email}` : config.author
var
pageCopyright = config.copyright || config.author
meta(charset="UTF-8")
meta(http-equiv="X-UA-Compatible" content="IE=edge")
...
...
layout/_common/header.pug
浏览文件 @
e6447686
...
...
@@ -19,9 +19,9 @@ header#header(
div.header-nav-menu
each value, name in (theme.menu || [])
if name && value
-
let
menuItem = value.split('||')
-
let
menuItemPath = _.trim(_.get(menuItem, '[0]'))
-
let
menuItemIcon = _.trim(_.get(menuItem, '[1]'))
-
var
menuItem = value.split('||')
-
var
menuItemPath = _.trim(_.get(menuItem, '[0]'))
-
var
menuItemIcon = _.trim(_.get(menuItem, '[1]'))
span
a(href=menuItemPath ? menuItemPath : "/")
if !theme.menu_settings.text_only
...
...
layout/_common/sidebar.pug
浏览文件 @
e6447686
aside#sidebar
div.sidebar-inner
-
let
isShowPostToc = theme.toc.enable && is_post()
-
var
isShowPostToc = theme.toc.enable && is_post()
if isShowPostToc
div.sidebar-nav
span.sidebar-nav-toc.current= _p("sidebar.catalog")
...
...
@@ -8,7 +8,7 @@ aside#sidebar
section(class=`${isShowPostToc ? "" : "hide"}`).sidebar-toc
if page.content
-
let
tocMaxDepth = page.toc_max_depth || theme.toc.max_depth || 6
-
var
tocMaxDepth = page.toc_max_depth || theme.toc.max_depth || 6
div!= toc(page.content, {list_number: theme.toc.number, max_depth: tocMaxDepth})
section(class=`${isShowPostToc ? "hide" : ""}`).sidebar-overview
...
...
@@ -24,9 +24,9 @@ aside#sidebar
div.sidebar-social
for value, name in (theme.social || [])
if name && value
-
let
socialItem = value.split('||')
-
let
socialLinkPath = _.trim(_.get(socialItem, '[0]'))
-
let
socialLinkIcon = _.trim(_.get(socialItem, '[1]'))
-
var
socialItem = value.split('||')
-
var
socialLinkPath = _.trim(_.get(socialItem, '[0]'))
-
var
socialLinkIcon = _.trim(_.get(socialItem, '[1]'))
span.sidebar-social-item
a(href=socialLinkPath target="_blank" rel="noopener"
data-popover=_p(`social.${name}`) data-popover-pos="up")
...
...
@@ -42,7 +42,7 @@ aside#sidebar
if theme.feed.enable
div.sidebar-feed
-
let
feedEmail = theme.feed.email
-
var
feedEmail = theme.feed.email
if feedEmail
span.sidebar-feed-email
a(href=feedEmail target="_blank" rel="noopener")
...
...
@@ -50,7 +50,7 @@ aside#sidebar
span Email
span= _p("sidebar.subscribe")
-
let
feedRSS = theme.feed.rss
-
var
feedRSS = theme.feed.rss
if feedRSS
span.sidebar-feed-rss
a(href=url_for(feedRSS) target="_blank" rel="noopener")
...
...
@@ -59,9 +59,9 @@ aside#sidebar
span= _p("sidebar.subscribe")
if theme.menu
-
let
menuArchives = _.trim(_.get(theme.menu.archives.split('||'), '[0]'))
-
let
menuCategories = _.trim(_.get(theme.menu.categories.split('||'), '[0]'))
-
let
menuTags = _.trim(_.get(theme.menu.tags.split('||'), '[0]'))
-
var
menuArchives = _.trim(_.get(theme.menu.archives.split('||'), '[0]'))
-
var
menuCategories = _.trim(_.get(theme.menu.categories.split('||'), '[0]'))
-
var
menuTags = _.trim(_.get(theme.menu.tags.split('||'), '[0]'))
div.sidebar-state
if theme.menu.archives
div.sidebar-state-item.sidebar-state-posts
...
...
@@ -80,10 +80,10 @@ aside#sidebar
div.sidebar-state-item-name= _p("sidebar.tags")
if theme.creative_commons.enable && theme.creative_commons.sidebar
-
let
themeCC = theme.creative_commons
-
let
ccLicense = themeCC.license && themeCC.license.toLowerCase()
-
let
ccLanguage = (themeCC.language && themeCC.language.toLowerCase()) || "en"
-
let
ccURL = `https://creativecommons.org/licenses/${ccLicense}/4.0/deed.${ccLanguage}`
-
var
themeCC = theme.creative_commons
-
var
ccLicense = themeCC.license && themeCC.license.toLowerCase()
-
var
ccLanguage = (themeCC.language && themeCC.language.toLowerCase()) || "en"
-
var
ccURL = `https://creativecommons.org/licenses/${ccLicense}/4.0/deed.${ccLanguage}`
div.sidebar-cc
a(href=ccURL target="_blank" rel="noopener"
data-popover="Creative Commons" data-popover-pos="up")
...
...
layout/_components/copyright.pug
浏览文件 @
e6447686
-
let
themeCC = theme.creative_commons
let
ccLicense = themeCC.license && themeCC.license.toLowerCase()
let
ccLanguage = (themeCC.language && themeCC.language.toLowerCase()) || "en"
let
ccURL = `https://creativecommons.org/licenses/${ccLicense}/4.0/deed.${ccLanguage}`
var
themeCC = theme.creative_commons
var
ccLicense = themeCC.license && themeCC.license.toLowerCase()
var
ccLanguage = (themeCC.language && themeCC.language.toLowerCase()) || "en"
var
ccURL = `https://creativecommons.org/licenses/${ccLicense}/4.0/deed.${ccLanguage}`
div.post-footer-copyright
div.copyright-author
...
...
layout/_components/pagination.pug
浏览文件 @
e6447686
-
let
options = {
var
options = {
prev_text: '<i class="fa fa-chevron-left"></i>',
next_text: '<i class="fa fa-chevron-right"></i>',
mid_size: 1
...
...
layout/_components/recent-posts.pug
浏览文件 @
e6447686
section#recent-posts
-
let
postLists = theme.post_list.paginate.home ? page.posts : site.posts
-
var
postLists = theme.post_list.paginate.home ? page.posts : site.posts
- postLists.each(function (post) {
article.post-item
+postHeader(post)
...
...
@@ -12,7 +12,7 @@ section#recent-posts
if theme.auto_excerpt && theme.auto_excerpt.enable
- const content = strip_html(post.content)
-
let
excerpt = content.substring(0, theme.auto_excerpt.length)
-
var
excerpt = content.substring(0, theme.auto_excerpt.length)
- content.length > theme.auto_excerpt.length ? excerpt += '......' : ''
div!= excerpt
else
...
...
layout/_mixins/post-header.pug
浏览文件 @
e6447686
...
...
@@ -36,13 +36,13 @@ mixin postHeader(post)
span= wordcount(post.content)
if theme.post_meta.reading_time.enable
-
let
postReadingTime = theme.post_meta.reading_time
-
var
postReadingTime = theme.post_meta.reading_time
span.post-meta-reading-time
i(class=`fa fa-${postReadingTime.icon}`)
if !theme.post_meta.icon_only
span= _p("post.reading_time") + " "
-
let
READING_TIME_UNIT = "m";
-
var
READING_TIME_UNIT = "m";
span= min2read(post.content, {cn: postReadingTime.speed.zh, en: postReadingTime.speed.en}) + READING_TIME_UNIT
if theme.valine && theme.valine.enable && theme.valine.visitor
...
...
layout/_mixins/posts-sort.pug
浏览文件 @
e6447686
mixin articleSort(posts)
section.article-sort
-
let
year, tmpYear
-
var
year, tmpYear
- posts.each(function (post) {
if post.date
- tmpYear = full_date(post.date, "YYYY")
...
...
layout/_scripts/cdn.pug
浏览文件 @
e6447686
...
...
@@ -11,9 +11,9 @@ if theme.cdn && theme.cdn.js
script(src=url_for(url))
if theme.canvas_ribbon && theme.canvas_ribbon.enable
-
let
ribbon = theme.canvas_ribbon;
-
var
ribbon = theme.canvas_ribbon;
script(src=theme.cdn.canvas_ribbon size=ribbon.size alpha=ribbon.alpha zIndex=ribbon.zIndex)
if theme.canvas_nest && theme.canvas_nest.enable
-
let
nest = theme.canvas_nest;
-
var
nest = theme.canvas_nest;
script(src=theme.cdn.canvas_nest color=nest.color pointColor=nest.pointColor opacity=nest.opacity count=nest.count zIndex=nest.zIndex)
layout/_third-party/comments/disqus.pug
浏览文件 @
e6447686
script.
let
disqus_config = function () {
var
disqus_config = function () {
this.page.url = '!{ page.permalink }';
this.page.identifier = '!{ page.path }';
this.page.title = '!{ page.title }';
};
(function() {
let
d = document, s = d.createElement('script');
var
d = document, s = d.createElement('script');
s.src = 'https://!{ theme.disqus.shortname }.disqus.com/embed.js';
s.setAttribute('data-timestamp', '' + +new Date());
(d.head || d.body).appendChild(s);
...
...
layout/_third-party/comments/gitalk.pug
浏览文件 @
e6447686
...
...
@@ -3,12 +3,12 @@ script(src="https://cdn.jsdelivr.net/npm/gitalk@latest/dist/gitalk.min.js")
script(src="https://cdn.jsdelivr.net/npm/js-md5@latest/src/md5.min.js")
-
let
lang = _.get(theme, 'gitalk.language')
var
lang = _.get(theme, 'gitalk.language')
? theme.gitalk.language : config.language;
script.
window.onload = function() {
let
gitalk = new Gitalk({
var
gitalk = new Gitalk({
id: md5('!{ page.path }'),
clientID: '!{ theme.gitalk.client_id }',
clientSecret: '!{ theme.gitalk.client_secret }',
...
...
layout/_third-party/comments/gitment.pug
浏览文件 @
e6447686
...
...
@@ -4,7 +4,7 @@ script(src="https://cdn.jsdelivr.net/npm/js-md5@latest/src/md5.min.js")
script.
function renderGitment() {
let
gitment = new Gitment({
var
gitment = new Gitment({
id: md5('!{ page.path }'),
owner: "!{ theme.gitment.owner }",
repo: "!{ theme.gitment.repo }",
...
...
layout/_third-party/comments/livere.pug
浏览文件 @
e6447686
script.
window.onload = function() {
(function(d, s) {
let
j, e = d.getElementsByTagName(s)[0];
var
j, e = d.getElementsByTagName(s)[0];
if (typeof LivereTower === 'function') { return; }
j = d.createElement(s);
...
...
layout/_third-party/comments/valine.pug
浏览文件 @
e6447686
...
...
@@ -3,8 +3,8 @@ script(src='https://cdn.jsdelivr.net/npm/valine@latest/dist/Valine.min.js')
script.
window.onload = function() {
let
GUEST_INFO = ['nick', 'mail', 'link'];
let
guest_info = '!{ theme.valine.meta }';
var
GUEST_INFO = ['nick', 'mail', 'link'];
var
guest_info = '!{ theme.valine.meta }';
guest_info = guest_info.split(',').filter(function(item) {
return GUEST_INFO.indexOf(item) > -1;
...
...
layout/page.pug
浏览文件 @
e6447686
...
...
@@ -5,10 +5,10 @@ block content
div.tag-cloud.main-content-layout
div.tag-cloud-title= _p("page.tags") + " - "
span.tag-cloud-num= site.tags.length
-
let
min_font = theme.tag_cloud ? theme.tag_cloud.min_size : 14
-
let
max_font = theme.tag_cloud ? theme.tag_cloud.max_size : 20
-
let
start_color = theme.tag_cloud ? theme.tag_cloud.start_color : "#a4d8fa"
-
let
end_color = theme.tag_cloud ? theme.tag_cloud.end_color : "#1b9ef3"
-
var
min_font = theme.tag_cloud ? theme.tag_cloud.min_size : 14
-
var
max_font = theme.tag_cloud ? theme.tag_cloud.max_size : 20
-
var
start_color = theme.tag_cloud ? theme.tag_cloud.start_color : "#a4d8fa"
-
var
end_color = theme.tag_cloud ? theme.tag_cloud.end_color : "#1b9ef3"
div.tag-cloud-item!= tagcloud({min_font: min_font, max_font: max_font, amount: theme.tag_cloud.max_amount, color: true, start_color, end_color})
else if (page.title === "categories")
div.category.main-content
...
...
source/js/algolia-search.js
浏览文件 @
e6447686
...
...
@@ -68,17 +68,15 @@ $(document).ready(function () {
item
:
function
(
data
)
{
var
link
=
data
.
permalink
?
data
.
permalink
:
CONFIG
.
root
+
data
.
path
;
return
(
'
<a href="
'
+
link
+
'
" class="algolia-hit-item-link">
'
+
data
.
_highlightResult
.
title
.
value
+
'
<a href="
'
+
link
+
'
" class="algolia-hit-item-link">
'
+
data
.
_highlightResult
.
title
.
value
+
'
</a>
'
);
},
empty
:
function
(
data
)
{
return
(
'
<div id="algolia-hits-empty">
'
+
algolia
.
languages
.
hits_empty
.
replace
(
/
\$\{
query}/
,
data
.
query
)
+
algolia
.
languages
.
hits_empty
.
replace
(
/
\$\{
query}/
,
data
.
query
)
+
'
</div>
'
);
}
...
...
@@ -102,9 +100,8 @@ $(document).ready(function () {
return
(
stats
+
'
<span class="algolia-logo pull-right">
'
+
'
<img src="
'
+
CONFIG
.
root
+
'
images/algolia.svg" alt="Algolia" />
'
+
'
<img src="
'
+
CONFIG
.
root
+
'
images/algolia.svg" alt="Algolia" />
'
+
'
</span>
'
);
}
...
...
source/js/copy.js
浏览文件 @
e6447686
...
...
@@ -7,26 +7,24 @@ $(document).ready(function test () {
var
lang
=
item
.
getAttribute
(
'
class
'
)
.
split
(
/
\s
/
)
.
filter
(
e
=>
e
!==
CODEBLOCK_CLASS_NAME
);
var
codeHeader
=
$
(
`
<figcaption class="custom">
<span>
${
lang
}
</span>
</figcaption>
`
)[
0
];
.
filter
(
function
(
e
)
{
return
e
!==
CODEBLOCK_CLASS_NAME
}
);
var
codeHeader
=
$
(
'
<figcaption class="custom">
'
+
'
<span>
'
+
lang
+
'
</span>
'
+
'
</figcaption>
'
)[
0
];
item
.
insertBefore
(
codeHeader
,
$
(
item
).
children
().
first
()[
0
]);
}
});
var
$copyIcon
=
$
(
`
<div class="copy-button">
<i class="fa fa-clipboard"></i>
</div>
`
);
var
COPY_BUTTON_WRAPPER
=
`
figure.highlight figcaption,
.post-footer-copyright
`
;
var
$copyIcon
=
$
(
'
<div class="copy-button">
'
+
'
<i class="fa fa-clipboard"></i>
'
+
'
</div>
'
);
var
COPY_BUTTON_WRAPPER
=
'
figure.highlight figcaption, .post-footer-copyright
'
;
// Add a copy button to the selected elements.
$
(
COPY_BUTTON_WRAPPER
).
append
(
$copyIcon
);
...
...
source/js/sidebar.js
浏览文件 @
e6447686
...
...
@@ -81,7 +81,7 @@ $(document).ready(function () {
});
if
(
currHeading
!==
lastHeading
)
{
var
targetLink
=
$
(
`.sidebar-toc a[href="#
${
currHeading
}
"]`
);
var
targetLink
=
$
(
'
.sidebar-toc a[href="#
'
+
currHeading
+
'
"]
'
);
// If the relevant "<a>" is not found, remain the state of the toc,
// either, remove styles for all active states.
...
...
source/js/utils.js
浏览文件 @
e6447686
...
...
@@ -78,14 +78,14 @@ Stun.utils = Stun.$u = {
};
if
(
!
$
(
'
.stun-alert
'
)[
0
])
{
var
$alert
=
$
(
`
<div class="stun-message">
<div class="stun-alert stun-alert-
${
status
}
">
<i class="stun-alert-icon fa fa-
${
icon
[
status
]}
"></i>
<span class="stun-alert-description">
${
text
}
</span>
</div>
</div>
`
);
var
$alert
=
$
(
'
<div class="stun-message">
'
+
'
<div class="stun-alert stun-alert-
'
+
status
+
'
">
'
+
'
<i class="stun-alert-icon fa fa-
'
+
icon
[
status
]
+
'
"></i>
'
+
'
<span class="stun-alert-description">
'
+
text
+
'
</span>
'
+
'
</div>
'
+
'
</div>
'
);
$
(
'
body
'
).
append
(
$alert
);
}
...
...
@@ -167,8 +167,11 @@ Stun.utils = Stun.$u = {
addIconToExternalLink
:
function
(
selector
)
{
if
(
!
$
(
selector
)[
0
])
return
;
var
$icon
=
$
(
`<i class="external-link fa fa-
${
CONFIG
.
external_link
.
icon_name
}
"></i>`
);
var
$icon
=
$
(
'
<i class="external-link fa fa-
'
+
CONFIG
.
external_link
.
icon_name
+
'
"></i>
'
);
$
(
selector
).
find
(
'
a[target="_blank"]
'
).
append
(
$icon
);
},
// Back the page to top.
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录