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

refactor: Optimize code

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