Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
大白技术控
yanglr2010
提交
499ab9f2
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,发现更多精彩内容 >>
提交
499ab9f2
编写于
12月 30, 2019
作者:
EvanOne(文一)
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
refactor: Make some error handing
上级
180fd3b9
变更
18
隐藏空白更改
内联
并排
Showing
18 changed file
with
95 addition
and
59 deletion
+95
-59
layout/_layout.pug
layout/_layout.pug
+2
-2
layout/_partials/config.pug
layout/_partials/config.pug
+41
-19
layout/_partials/head/head.pug
layout/_partials/head/head.pug
+2
-2
layout/_partials/header/header.pug
layout/_partials/header/header.pug
+2
-2
layout/_partials/search/index.pug
layout/_partials/search/index.pug
+2
-2
layout/_third-party/comments/index.pug
layout/_third-party/comments/index.pug
+1
-1
layout/_third-party/pjax.pug
layout/_third-party/pjax.pug
+5
-5
layout/_third-party/search/algolia.pug
layout/_third-party/search/algolia.pug
+1
-1
layout/_third-party/search/index.pug
layout/_third-party/search/index.pug
+2
-2
scripts/filters/external-link.js
scripts/filters/external-link.js
+1
-1
scripts/filters/lazyload.js
scripts/filters/lazyload.js
+1
-1
scripts/filters/shake-file.js
scripts/filters/shake-file.js
+1
-1
source/css/_variables/index.styl
source/css/_variables/index.styl
+1
-1
source/js/header.js
source/js/header.js
+1
-1
source/js/scroll.js
source/js/scroll.js
+16
-9
source/js/sidebar.js
source/js/sidebar.js
+7
-3
source/js/stun-boot.js
source/js/stun-boot.js
+6
-3
source/js/utils.js
source/js/utils.js
+3
-3
未找到文件。
layout/_layout.pug
浏览文件 @
499ab9f2
...
...
@@ -26,7 +26,7 @@ html(lang=config.language)
if page.comments
include ./_partials/widgets/comments.pug
if theme.sidebar.enable
if theme.sidebar
&& theme.sidebar
.enable
aside#sidebar.sidebar
div.sidebar-inner
include ./_partials/sidebar/sidebar.pug
...
...
@@ -39,7 +39,7 @@ html(lang=config.language)
include ./_partials/widgets/loading-bar.pug
if theme.back2top.enable
if theme.back2top
&& theme.back2top
.enable
include ./_partials/widgets/back2top.pug
include ./_partials/search/index.pug
...
...
layout/_partials/config.pug
浏览文件 @
499ab9f2
-
var algolia = "undefined";
var env = process.env;
if (theme.algolia_search.enable) {
if (theme.algolia_search
&& theme.algolia_search
.enable) {
algolia = JSON.stringify({
appId: env.ALGOLIA_APP_ID || config.algolia.appId || config.algolia.applicationID,
apiKey: env.ALGOLIA_API_KEY || config.algolia.apiKey,
...
...
@@ -23,25 +23,27 @@
}
var sidebar = "undefined";
if (theme.sidebar.enable) {
if (theme.sidebar
&& theme.sidebar
.enable) {
sidebar = JSON.stringify({
offsetTop: theme.sidebar.offsetTop,
renderToc
Depth: theme.toc.max_depth
tocMax
Depth: theme.toc.max_depth
});
}
var back2top = "undefined";
if (theme.back2top.enable) {
if (theme.back2top
&& theme.back2top
.enable) {
back2top = JSON.stringify({
enable: theme.back2top.enable,
animation: theme.back2top.icon.animation
enable: theme.back2top.enable
});
}
var header = "undefined";
if (theme.header) {
var isScrollDownIcon =
(theme.header.scroll_down_icon && theme.header.scroll_down_icon.enable) || false;
header = JSON.stringify({
scrollDownIcon:
theme.header.scroll_down_icon.enable
,
scrollDownIcon:
isScrollDownIcon
,
});
}
...
...
@@ -53,40 +55,60 @@
}
var gallery_waterfall = "undefined";
if (theme.gallery_waterfall.enable) {
if (theme.gallery_waterfall
&& theme.gallery_waterfall
.enable) {
gallery_waterfall = JSON.stringify(theme.gallery_waterfall);
}
var lazyload = "undefined";
if (theme.lazyload.enable) {
if (theme.lazyload
&& theme.lazyload
.enable) {
lazyload = JSON.stringify(theme.lazyload);
}
var zoom_image = "undefined";
if (theme.zoom_image.enable) {
if (theme.zoom_image
&& theme.zoom_image
.enable) {
zoom_image = JSON.stringify(theme.zoom_image);
}
var pjax_config = "undefined";
if (theme.pjax.enable) {
if (theme.pjax
&& theme.pjax
.enable) {
pjax_config = JSON.stringify({
scrollTo2screen: theme.pjax.scrollTo2screen
});
}
var external_link = "undefined";
if (theme.external_link.icon.enable) {
external_link = JSON.stringify({
icon: {
enable: theme.external_link.icon.enable,
name: theme.external_link.icon.name
if (theme.external_link) {
var iconConfig = {};
var iconEnable = false;
var iconName = '';
if (theme.external_link.icon) {
iconEnable = theme.external_link.icon.enable;
if (iconEnable) {
iconName = theme.external_link.icon.name;
}
iconConfig = { enable: iconEnable, name: iconName }
}
external_link = JSON.stringify({
icon: iconConfig
});
}
var shortcuts = JSON.stringify({
switch_post: theme.shortcuts.switch_post.enable
});
var shortcuts = "undefined";
if (theme.shortcuts) {
isSwitchPost = false;
if (theme.shortcuts.switch_post && theme.shortcuts.switch_post.enable) {
isSwitchPost = true;
}
shortcuts = JSON.stringify({
switch_post: isSwitchPost
});
}
var prompt = JSON.stringify({
copy_success: __("prompt.copy.success"),
...
...
layout/_partials/head/head.pug
浏览文件 @
499ab9f2
...
...
@@ -78,13 +78,13 @@ if theme.fancybox
- if (theme.cdn.fancybox_css) fancybox_css = theme.cdn.fancybox_css
link(rel="stylesheet" href=fancybox_css type="text/css")
if page.comments ||
theme.pjax.enable
if page.comments ||
(theme.pjax && theme.pjax.enable)
if theme.gitalk && theme.gitalk.enable
- var gitalk_css = "https://cdn.jsdelivr.net/npm/gitalk@latest/dist/gitalk.min.css"
- if (theme.cdn.gitalk_css) gitalk_css = theme.cdn.gitalk_css
link(rel="stylesheet" href=gitalk_css type="text/css")
if theme.algolia_search.enable
if theme.algolia_search
&& theme.algolia_search
.enable
- var instantsearch_css = "https://cdn.jsdelivr.net/npm/instantsearch.js@2.1.1/dist/instantsearch.min.css"
- if (theme.cdn.instantsearch_css) instantsearch_css = theme.cdn.instantsearch_css
link(rel="stylesheet" href=instantsearch_css type="text/css")
...
...
layout/_partials/header/header.pug
浏览文件 @
499ab9f2
...
...
@@ -8,7 +8,7 @@ nav.header-nav
div.header-nav-menu
+menuItem(theme.menu)
if
theme.algolia_search.enable || theme.local_search.enable
if
(theme.algolia_search && theme.algolia_search.enable) || (theme.local_search && theme.local_search.enable)
div.header-nav-search
if !theme.menu_settings.text_only
i(class=`${fa_prefix} fa-search`)
...
...
@@ -27,6 +27,6 @@ div.header-info(style=`${
div.header-info-title= config.title
div.header-info-subtitle= config.subtitle
if theme.header.scroll_down_icon && theme.header.scroll_down_icon.enable
if theme.header
&& theme.header
.scroll_down_icon && theme.header.scroll_down_icon.enable
div.header-info-scrolldown
i.fa.fa-angle-down.header-info-scrolldown__icon
layout/_partials/search/index.pug
浏览文件 @
499ab9f2
if theme.algolia_search.enable
if theme.algolia_search
&& theme.algolia_search
.enable
include ./algolia.pug
else if theme.local_search.enable
else if theme.local_search
&& theme.local_search
.enable
include ./localsearch.pug
layout/_third-party/comments/index.pug
浏览文件 @
499ab9f2
if page.comments ||
theme.pjax.enable
if page.comments ||
(theme.pjax && theme.pjax.enable)
if theme.disqus && theme.disqus.enable
include ./disqus.pug
else if theme.valine && theme.valine.enable
...
...
layout/_third-party/pjax.pug
浏览文件 @
499ab9f2
...
...
@@ -53,7 +53,7 @@ script.
document.addEventListener('pjax:send', function () {
$('.header-nav-menu').removeClass('show');
if (CONFIG.pjax.scrollTo2screen) {
if (CONFIG.pjax
&& CONFIG.pjax
.scrollTo2screen) {
$('html').velocity('scroll', {
duration: 500,
offset: $('#header').height(),
...
...
@@ -95,9 +95,9 @@ script.
$(this).parent().append($(this).remove());
});
Stun.utils.pjaxReloadBoot();
Stun.utils.pjaxReloadScroll();
Stun.utils.pjaxReloadHeader();
Stun.utils.pjaxReloadSidebar();
Stun.utils.pjaxReloadBoot
&& Stun.utils.pjaxReloadBoot
();
Stun.utils.pjaxReloadScroll
&& Stun.utils.pjaxReloadScroll
();
Stun.utils.pjaxReloadHeader
&& Stun.utils.pjaxReloadHeader
();
Stun.utils.pjaxReloadSidebar
&& Stun.utils.pjaxReloadSidebar
();
}, false);
}, false);
layout/_third-party/search/algolia.pug
浏览文件 @
499ab9f2
...
...
@@ -41,7 +41,7 @@ script.
var algolia = CONFIG.algolia;
if (!(algolia.appId && algolia.apiKey && algolia.indexName)) {
if (!
algolia && !
(algolia.appId && algolia.apiKey && algolia.indexName)) {
return console.error('Algolia setting is invalid.');
}
...
...
layout/_third-party/search/index.pug
浏览文件 @
499ab9f2
if theme.algolia_search.enable
if theme.algolia_search
&& theme.algolia_search
.enable
include ./algolia.pug
else if theme.local_search.enable
else if theme.local_search
&& theme.local_search
.enable
include ./localsearch.pug
scripts/filters/external-link.js
浏览文件 @
499ab9f2
...
...
@@ -4,7 +4,7 @@
hexo
.
extend
.
filter
.
register
(
'
after_post_render
'
,
function
(
data
)
{
var
theme
=
hexo
.
theme
.
config
;
if
(
!
theme
.
external_link
.
icon
.
enable
)
return
;
if
(
!
(
theme
.
external_link
&&
theme
.
external_link
.
icon
&&
theme
.
external_link
.
icon
.
enable
)
)
return
;
var
url
=
require
(
'
url
'
);
var
cheerio
;
...
...
scripts/filters/lazyload.js
浏览文件 @
499ab9f2
...
...
@@ -4,7 +4,7 @@
hexo
.
extend
.
filter
.
register
(
'
after_post_render
'
,
function
(
data
)
{
var
theme
=
hexo
.
theme
.
config
;
if
(
!
theme
.
lazyload
.
enable
)
return
;
if
(
!
(
theme
.
lazyload
&&
theme
.
lazyload
.
enable
)
)
return
;
var
cheerio
;
...
...
scripts/filters/shake-file.js
浏览文件 @
499ab9f2
...
...
@@ -7,7 +7,7 @@ hexo.extend.filter.register('after_generate', () => {
if
(
!
theme
.
shake_file
)
return
;
if
(
!
theme
.
sidebar
.
enable
)
{
if
(
!
(
theme
.
sidebar
&&
theme
.
sidebar
.
enable
)
)
{
hexo
.
route
.
remove
(
'
js/sidebar.js
'
);
}
});
source/css/_variables/index.styl
浏览文件 @
499ab9f2
...
...
@@ -29,7 +29,7 @@ $md-width = 992px - 0.02px
$lg-width = 1200px - 0.02px
// Width
$sidebar-width = convert(hexo-config('sidebar.width') || '280px')
$sidebar-width
= convert(hexo-config('sidebar.width') || '280px')
$content-aside-gap = 20px
$content-width = $sm-width
$main-sidebar-gap = 30px
...
...
source/js/header.js
浏览文件 @
499ab9f2
...
...
@@ -167,7 +167,7 @@ $(document).ready(function () {
});
Stun
.
utils
.
pjaxReloadHeader
=
function
()
{
if
(
CONFIG
.
header
.
scrollDownIcon
)
{
if
(
CONFIG
.
header
&&
CONFIG
.
header
.
scrollDownIcon
)
{
$
(
'
.header-info-scrolldown
'
).
on
(
'
click
'
,
function
()
{
$
(
'
#container
'
).
velocity
(
'
scroll
'
,
{
offset
:
$
(
'
#header
'
).
height
()
...
...
source/js/scroll.js
浏览文件 @
499ab9f2
...
...
@@ -42,6 +42,9 @@ $(document).ready(function () {
prevScrollTop
=
scrollTop
;
}
// Initializaiton
headerNavScroll
();
function
scrollHeadingToTop
(
anchor
)
{
$
(
anchor
)
.
velocity
(
'
stop
'
)
...
...
@@ -51,6 +54,7 @@ $(document).ready(function () {
});
}
var
isBack2topEnable
=
CONFIG
.
back2top
&&
CONFIG
.
back2top
.
enable
;
var
isBack2topShow
=
false
;
// Back the page to top.
...
...
@@ -71,19 +75,22 @@ $(document).ready(function () {
}
}
// Initialization
headerNavScroll
();
back2top
();
if
(
isBack2topEnable
)
{
// Initializaiton
back2top
();
$
(
'
#back2top
'
).
on
(
'
click
'
,
function
()
{
$
(
'
body
'
).
velocity
(
'
stop
'
).
velocity
(
'
scroll
'
);
});
}
$
(
window
).
on
(
'
DOMContentLoaded
'
,
back2top
);
$
(
window
).
on
(
'
scroll
'
,
Stun
.
utils
.
throttle
(
function
()
{
headerNavScroll
();
back2top
();
},
100
));
$
(
'
#back2top
'
).
on
(
'
click
'
,
function
()
{
$
(
'
body
'
).
velocity
(
'
stop
'
).
velocity
(
'
scroll
'
);
});
if
(
isBack2topEnable
)
{
back2top
();
}
},
100
));
Stun
.
utils
.
pjaxReloadScroll
=
function
()
{
// Click the heading.
...
...
source/js/sidebar.js
浏览文件 @
499ab9f2
$
(
document
).
ready
(
function
()
{
var
tocDepth
=
CONFIG
.
sidebar
.
renderTocDepth
;
var
tocDepth
=
(
CONFIG
.
sidebar
&&
CONFIG
.
sidebar
.
tocMaxDepth
)
||
4
;
// Optimize selector by theme config.
var
HEADING_SELECTOR
=
'
h1,h2,h3,h4,h5,h6,
'
.
slice
(
0
,
tocDepth
*
3
).
slice
(
0
,
-
1
);
...
...
@@ -97,7 +97,11 @@ $(document).ready(function () {
}
// Distance from sidebar to top.
var
SIDEBAR_STICKY_TOP
=
parseInt
(
CONFIG
.
sidebar
.
offsetTop
);
var
sidebarToTop
=
0
;
if
(
CONFIG
.
sidebar
&&
CONFIG
.
sidebar
.
offsetTop
)
{
sidebarToTop
=
parseInt
(
CONFIG
.
sidebar
.
offsetTop
);
}
// Sticky the sidebar when it arrived the top.
function
sidebarSticky
()
{
...
...
@@ -105,7 +109,7 @@ $(document).ready(function () {
var
targetY
=
document
.
getElementById
(
'
main
'
).
getBoundingClientRect
().
top
;
if
(
targetY
<
SIDEBAR_STICKY_TOP
)
{
if
(
targetY
<
sidebarToTop
)
{
$sidebar
.
addClass
(
'
sticky
'
);
}
else
{
$sidebar
.
removeClass
(
'
sticky
'
);
...
...
source/js/stun-boot.js
浏览文件 @
499ab9f2
$
(
document
).
ready
(
function
()
{
Stun
.
utils
.
showThemeInConsole
();
CONFIG
.
shortcuts
.
switch_post
&&
Stun
.
utils
.
registerHotkeyToSwitchPost
();
if
(
CONFIG
.
shortcuts
&&
CONFIG
.
shortcuts
.
switch_post
)
{
Stun
.
utils
.
registerHotkeyToSwitchPost
();
}
// Not reload this, because it's changeless.
if
(
CONFIG
.
external_link
)
{
...
...
@@ -16,9 +19,9 @@ $(document).ready(function () {
CONFIG
.
gallery_waterfall
&&
this
.
showImageToWaterfall
();
if
(
CONFIG
.
external_link
)
{
var
WRAPP
ER
=
'
.archive, .post-header-title
'
;
var
CONTAIN
ER
=
'
.archive, .post-header-title
'
;
this
.
addIconToExternalLink
(
WRAPP
ER
);
this
.
addIconToExternalLink
(
CONTAIN
ER
);
}
if
(
CONFIG
.
fancybox
)
{
...
...
source/js/utils.js
浏览文件 @
499ab9f2
...
...
@@ -261,7 +261,7 @@ Stun.utils = Stun.$u = {
$
(
'
.stun-message
'
).
remove
();
}
var
faPrefix
=
CONFIG
.
fontawesome
.
prefix
;
var
faPrefix
=
(
CONFIG
.
fontawesome
&&
CONFIG
.
fontawesome
.
prefix
)
||
'
fa
'
;
var
$alert
=
$
(
'
<div class="stun-message">
'
+
'
<div class="stun-alert stun-alert-
'
+
status
+
'
">
'
+
...
...
@@ -398,7 +398,7 @@ Stun.utils = Stun.$u = {
return
;
}
var
faPrefix
=
CONFIG
.
fontawesome
.
prefix
;
var
faPrefix
=
(
CONFIG
.
fontawesome
&&
CONFIG
.
fontawesome
.
prefix
)
||
'
fa
'
;
var
$wrapper
=
$
(
'
<span class="external-link"></span>
'
);
var
$icon
=
$
(
'
<i class="
'
+
faPrefix
+
'
fa-
'
+
...
...
@@ -539,7 +539,7 @@ Stun.utils = Stun.$u = {
}
});
var
faPrefix
=
CONFIG
.
fontawesome
.
prefix
;
var
faPrefix
=
(
CONFIG
.
fontawesome
&&
CONFIG
.
fontawesome
.
prefix
)
||
'
fa
'
;
var
$copyIcon
=
$
(
'
<div class="copy-button" data-popover=
'
+
CONFIG
.
prompt
.
copy_button
+
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录