提交 250db90c 编写于 作者: EvanOne(文一)'s avatar EvanOne(文一)

refactor: Optimize code

上级 82e7afe0
...@@ -62,15 +62,20 @@ post: ...@@ -62,15 +62,20 @@ post:
author: Author author: Author
link: Link link: Link
license_title: Copyright license_title: Copyright
license_content: 'All articles in this blog are licensed under license_content: All articles in this blog are licensed under
<a href="%s" rel="external nofollow" target="_blank">%s</a> unless stating additionally' <a href="%s" rel="external nofollow" target="_blank">%s</a> unless stating additionally
# Search # Algolia search
algolia_search: algolia_search:
input_placeholder: Search for Posts input_placeholder: Search for Posts
hits_empty: "We didn't find any results for the search: ${query}" hits_empty: "We didn't find any results for the search: ${query}"
hits_stats: "${hits} results found in ${time} ms" hits_stats: "${hits} results found in ${time} ms"
# Local search
local_search:
input_placeholder: Start to search
hits_empty: We didn't find any results for the search
# Reward # Reward
reward: reward:
btn_text: Buy me a coffee btn_text: Buy me a coffee
...@@ -87,7 +92,7 @@ back2top: Back to top ...@@ -87,7 +92,7 @@ back2top: Back to top
# Site footer # Site footer
footer: footer:
powered: 'Powered by %s' powered: Powered by %s
theme: Theme theme: Theme
uv: Visitors uv: Visitors
pv: Views pv: Views
......
...@@ -56,14 +56,14 @@ post: ...@@ -56,14 +56,14 @@ post:
read_more: 阅读全文 read_more: 阅读全文
fire: 热度 fire: 热度
sticky: 置顶文章 sticky: 置顶文章
untitled: ( 文章未命名 ) untitled: ( 文章无标题 )
end: 本文结束,感谢您的阅读 end: 本文结束,感谢您的阅读
copyright: copyright:
author: 本文作者 author: 本文作者
link: 本文链接 link: 本文链接
license_title: 版权声明 license_title: 版权声明
license_content: '本博客所有文章除特别声明外,均采用 license_content: 本博客所有文章除特别声明外,均采用
<a href="%s" rel="external nofollow" target="_blank">%s</a> 许可协议。转载请注明出处!' <a href="%s" rel="external nofollow" target="_blank">%s</a> 许可协议。转载请注明出处!
# Algolia 搜索 # Algolia 搜索
algolia_search: algolia_search:
...@@ -71,6 +71,11 @@ algolia_search: ...@@ -71,6 +71,11 @@ algolia_search:
hits_empty: "没有找到任何搜索结果:${query}" hits_empty: "没有找到任何搜索结果:${query}"
hits_stats: "找到 ${hits} 条搜索结果,耗时 ${time} 毫秒" hits_stats: "找到 ${hits} 条搜索结果,耗时 ${time} 毫秒"
# 本地搜索
local_search:
input_placeholder: 开始搜索
hits_empty: 没有找到任何搜索结果
# 打赏 # 打赏
reward: reward:
btn_text: 请我喝杯咖啡~ btn_text: 请我喝杯咖啡~
...@@ -87,7 +92,7 @@ back2top: 回到顶部 ...@@ -87,7 +92,7 @@ back2top: 回到顶部
# 网站底部 # 网站底部
footer: footer:
powered: ' %s 强力驱动' powered: 由 %s 强力驱动
theme: 主题 theme: 主题
uv: 访问人数 uv: 访问人数
pv: 浏览总量 pv: 浏览总量
......
if theme.google_adsense && theme.google_adsense.enable if theme.google_adsense && theme.google_adsense.enable
include ./google_adsense.pug include ./google-adsense.pug
$(document).ready(function () { $(document).ready(function () {
$('.header-nav-search').on('click', function () { $('.header-nav-search').on('click', function (e) {
e.stopPropagation();
$('body').css('overflow', 'hidden'); $('body').css('overflow', 'hidden');
$('.algolia-popup') $('.algolia-popup')
.velocity('stop') .velocity('stop')
...@@ -20,9 +22,7 @@ $(document).ready(function () { ...@@ -20,9 +22,7 @@ $(document).ready(function () {
closeSearch(); closeSearch();
}); });
$(document).on('keydown', function (ev) { $(document).on('keydown', function (e) {
var e = ev || window.event;
// Escape <=> 27 // Escape <=> 27
if (e.keyCode === Stun.utils.codeToKeyCode('Escape')) { if (e.keyCode === Stun.utils.codeToKeyCode('Escape')) {
closeSearch(); closeSearch();
......
...@@ -5,8 +5,7 @@ $(document).ready(function () { ...@@ -5,8 +5,7 @@ $(document).ready(function () {
$menu.removeClass('show'); $menu.removeClass('show');
}); });
$('.header-nav-menu a').on('click', function (ev) { $('.header-nav-menu a').on('click', function (e) {
var e = ev || window.event;
e.stopPropagation(); e.stopPropagation();
}); });
......
...@@ -17,9 +17,7 @@ $(document).ready(function () { ...@@ -17,9 +17,7 @@ $(document).ready(function () {
}); });
// Click the post toc. // Click the post toc.
$('.toc-link').on('click', function (ev) { $('.toc-link').on('click', function (e) {
var e = ev || window.event;
e.preventDefault(); e.preventDefault();
scrollHeadingToTop($(this).attr('href')); scrollHeadingToTop($(this).attr('href'));
}); });
......
...@@ -74,7 +74,8 @@ Stun.utils = Stun.$u = { ...@@ -74,7 +74,8 @@ Stun.utils = Stun.$u = {
var codes = { var codes = {
ArrowLeft: 37, ArrowLeft: 37,
ArrowRight: 39, ArrowRight: 39,
Escape: 27 Escape: 27,
Enter: 13
}; };
return codes[code]; return codes[code];
...@@ -264,8 +265,7 @@ Stun.utils = Stun.$u = { ...@@ -264,8 +265,7 @@ Stun.utils = Stun.$u = {
registerSwitchPost: function () { registerSwitchPost: function () {
var _this = this; var _this = this;
$(document).on('keydown', function (ev) { $(document).on('keydown', function (e) {
var e = ev || window.event;
var isPrev = e.keyCode === _this.codeToKeyCode('ArrowLeft'); var isPrev = e.keyCode === _this.codeToKeyCode('ArrowLeft');
var isNext = e.keyCode === _this.codeToKeyCode('ArrowRight'); var isNext = e.keyCode === _this.codeToKeyCode('ArrowRight');
...@@ -315,8 +315,7 @@ Stun.utils = Stun.$u = { ...@@ -315,8 +315,7 @@ Stun.utils = Stun.$u = {
closeZoom(); closeZoom();
}); });
$('.zoom-image').on('click', function (ev) { $('.zoom-image').on('click', function (e) {
var e = ev || window.event;
e.stopPropagation(); e.stopPropagation();
isZoom = true; isZoom = true;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册