Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
智布道
OneBlog
提交
d7c4d4c9
O
OneBlog
项目概览
智布道
/
OneBlog
10 个月 前同步成功
通知
11
Star
2
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
O
OneBlog
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
d7c4d4c9
编写于
9月 25, 2018
作者:
智布道
👁
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
🎨
改进结构和代码格式
🔥
移除无用的js代码
上级
3f34450d
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
32 addition
and
151 deletion
+32
-151
blog-web/src/main/resources/static/js/zhyd.comment.js
blog-web/src/main/resources/static/js/zhyd.comment.js
+2
-9
blog-web/src/main/resources/static/js/zhyd.core.js
blog-web/src/main/resources/static/js/zhyd.core.js
+3
-121
blog-web/src/main/resources/static/js/zhyd.js
blog-web/src/main/resources/static/js/zhyd.js
+24
-13
blog-web/src/main/resources/templates/layout/footer.ftl
blog-web/src/main/resources/templates/layout/footer.ftl
+3
-8
未找到文件。
blog-web/src/main/resources/static/js/zhyd.comment.js
浏览文件 @
d7c4d4c9
...
...
@@ -80,7 +80,7 @@ $.extend({
+
'
<input type="hidden" name="pid" id="comment-pid" value="0" size="22" tabindex="1">
'
+
'
<textarea id="comment_content" class="form-control col-md-7 col-xs-12 valid" style="display: none"></textarea>
'
+
'
<textarea name="content" style="display: none"></textarea>
'
+
'
<div style="position: absolute;right: 10px;bottom: 70px;font-size: 14px;font-weight: 700;color: #ececec;z-index: 1;">
'
+
editorConfig
.
wmName
+
'
<br>
'
+
editorConfig
.
wmUrl
+
'
<br>
'
+
editorConfig
.
wmDesc
+
'
</div>
'
+
'
<div style="position: absolute;right: 10px;bottom: 70px;font-size: 14px;font-weight: 700;color: #ececec;z-index: 1;">
'
+
op
.
wmName
+
'
<br>
'
+
op
.
wmUrl
+
'
<br>
'
+
op
.
wmDesc
+
'
</div>
'
+
'
<a id="comment-form-btn" type="button" data-loading-text="正在提交评论..." class="btn btn-default btn-block">提交评论</a>
'
+
'
</form></div></div>
'
;
$box
.
html
(
commentBox
);
...
...
@@ -97,7 +97,7 @@ $.extend({
toolbar
:
[
"
bold
"
,
"
italic
"
,
"
|
"
,
"
code
"
,
"
quote
"
,
"
|
"
,
"
preview
"
,
"
|
"
,
"
guide
"
],
autoDownloadFontAwesome
:
false
,
// autofocus: true,
placeholder
:
"
说点什么吧
"
,
placeholder
:
options
.
placeholder
||
"
说点什么吧
"
,
renderingConfig
:
{
codeSyntaxHighlighting
:
true
},
...
...
@@ -401,10 +401,3 @@ $.extend({
}
});
$
(
function
()
{
$
.
comment
.
init
({
customMenu
:
true
});
$
(
"
#comment-form-btn
"
).
click
(
function
()
{
$
.
comment
.
submit
(
$
(
this
));
});
});
\ No newline at end of file
blog-web/src/main/resources/static/js/zhyd.core.js
浏览文件 @
d7c4d4c9
...
...
@@ -268,51 +268,16 @@
});
$
.
extend
({
tool
:
{
isEmpty
:
function
(
value
)
{
return
value
==
null
||
this
.
trim
(
value
)
==
""
;
},
isInteger
:
function
()
{
return
(
new
RegExp
(
/^
\d
+$/
).
test
(
this
));
},
isNumber
:
function
(
value
,
element
)
{
return
(
new
RegExp
(
/^-
?(?:\d
+|
\d{1,3}(?:
,
\d{3})
+
)(?:\.\d
+
)?
$/
).
test
(
this
));
},
trim
:
function
(
value
)
{
if
(
value
==
null
)
{
return
""
;
}
return
value
.
replace
(
/
(
^
\s
*
)
|
(\s
*$
)
|
\r
|
\n
/g
,
""
);
},
html2Txt
:
function
(
value
)
{
value
=
this
.
trim
(
value
);
value
=
value
.
replace
(
/
(\n)
/g
,
""
);
value
=
value
.
replace
(
/
(\t)
/g
,
""
);
value
=
value
.
replace
(
/
(\r)
/g
,
""
);
value
=
value
.
replace
(
/<
\/?[^
>
]
*>/g
,
""
);
value
=
value
.
replace
(
/
\s
*/g
,
""
);
return
value
;
},
currentPath
:
function
()
{
// 域
var
domain
=
document
.
domain
;
//
var domain = document.domain;
// 当前页
var
nowurl
=
document
.
URL
;
//
var nowurl = document.URL;
// 来源页
var
fromurl
=
document
.
referrer
;
//
var fromurl = document.referrer;
return
window
.
location
.
pathname
;
},
getMeta
:
function
(
name
)
{
var
meta
=
document
.
getElementsByTagName
(
'
meta
'
);
var
share_desc
=
''
;
for
(
var
i
in
meta
)
{
if
(
typeof
meta
[
i
].
name
!=
"
undefined
"
&&
meta
[
i
].
name
.
toLowerCase
()
==
name
.
toLowerCase
())
{
share_desc
=
meta
[
i
].
content
;
break
;
}
}
return
share_desc
;
},
random
:
function
(
min
,
max
)
{
return
Math
.
floor
((
Math
.
random
()
*
max
)
+
min
);
},
...
...
@@ -343,78 +308,8 @@
endsWith
:
function
(
str
)
{
return
new
RegExp
(
str
+
"
$
"
).
test
(
this
);
},
replaceSuffix
:
function
(
index
)
{
return
this
.
replace
(
/
\[[
0-9
]
+
\]
/
,
'
[
'
+
index
+
'
]
'
).
replace
(
'
#index#
'
,
index
);
},
getRequestURI
:
function
()
{
var
indexOf
=
this
.
indexOf
(
"
?
"
);
return
(
indexOf
==
-
1
)
?
this
:
this
.
substr
(
0
,
indexOf
);
},
getParams
:
function
(
encode
)
{
var
params
=
{},
indexOf
=
this
.
indexOf
(
"
?
"
);
if
(
indexOf
!=
-
1
)
{
var
str
=
this
.
substr
(
indexOf
+
1
),
strs
=
str
.
split
(
"
&
"
);
for
(
var
i
=
0
;
i
<
strs
.
length
;
i
++
)
{
var
item
=
strs
[
i
].
split
(
"
=
"
);
var
val
=
encode
?
item
[
1
].
encodeParam
()
:
item
[
1
];
params
[
item
[
0
]]
=
item
.
length
>
1
?
val
:
''
;
}
}
return
params
;
},
encodeParam
:
function
()
{
return
encodeURIComponent
(
this
);
},
replaceAll
:
function
(
os
,
ns
)
{
return
this
.
replace
(
new
RegExp
(
os
,
"
gm
"
),
ns
);
},
skipChar
:
function
(
ch
)
{
if
(
!
this
||
this
.
length
===
0
)
{
return
''
;
}
if
(
this
.
charAt
(
0
)
===
ch
)
{
return
this
.
substring
(
1
).
skipChar
(
ch
);
}
return
this
;
},
isPositiveInteger
:
function
()
{
return
(
new
RegExp
(
/^
[
1-9
]\d
*$/
).
test
(
this
));
},
isInteger
:
function
()
{
return
(
new
RegExp
(
/^
\d
+$/
).
test
(
this
));
},
isNumber
:
function
(
value
,
element
)
{
return
(
new
RegExp
(
/^-
?(?:\d
+|
\d{1,3}(?:
,
\d{3})
+
)(?:\.\d
+
)?
$/
).
test
(
this
));
},
isValidPwd
:
function
()
{
return
(
new
RegExp
(
/^
([
_
]
|
[
a-zA-Z0-9
]){6,32}
$/
).
test
(
this
));
},
isValidMail
:
function
()
{
return
(
new
RegExp
(
/^
\w
+
((
-
\w
+
)
|
(\.\w
+
))
*
\@[
A-Za-z0-9
]
+
((\.
|-
)[
A-Za-z0-9
]
+
)
*
\.[
A-Za-z0-9
]
+$/
).
test
(
this
.
trim
()));
},
isSpaces
:
function
()
{
for
(
var
i
=
0
;
i
<
this
.
length
;
i
+=
1
)
{
var
ch
=
this
.
charAt
(
i
);
if
(
ch
!=
'
'
&&
ch
!=
"
\n
"
&&
ch
!=
"
\t
"
&&
ch
!=
"
\r
"
)
{
return
false
;
}
}
return
true
;
},
isMobile
:
function
()
{
return
(
new
RegExp
(
/
(
^
[
0-9
]{11,11}
$
)
/
).
test
(
this
));
},
isUrl
:
function
()
{
return
(
new
RegExp
(
/^
[
a-zA-z
]
+:
\/\/([
a-zA-Z0-9
\-\.]
+
)([
-
\w
.
\/
?%&=:
]
*
)
$/
).
test
(
this
));
},
isExternalUrl
:
function
()
{
return
this
.
isUrl
()
&&
this
.
indexOf
(
"
://
"
+
document
.
domain
)
==
-
1
;
},
parseCurrency
:
function
(
num
)
{
var
numberValue
=
parseFloat
(
this
);
return
parseFloat
(
numberValue
.
toFixed
(
num
||
2
));
}
});
$
.
extend
(
Date
.
prototype
,
{
...
...
@@ -536,19 +431,6 @@
/* 鼠标点击弹出提示动画 */
$
.
fn
.
extend
({
// 翻牌效果
flipCard
:
function
(
options
)
{
var
op
=
$
.
extend
({},
options
);
return
this
.
each
(
function
()
{
var
$box
=
$
(
this
);
$box
.
removeClass
(
'
animation-rotate-up
'
).
removeClass
(
'
animation-rotate-up-back
'
);
$box
.
addClass
(
"
animation-rotate-up
"
);
setTimeout
(
function
()
{
$box
.
addClass
(
"
animation-rotate-up-back
"
);
},
500
);
});
},
// 文字向上冒泡
effectBubble
:
function
(
options
)
{
var
op
=
$
.
extend
({
...
...
blog-web/src/main/resources/static/js/zhyd.js
浏览文件 @
d7c4d4c9
...
...
@@ -28,15 +28,15 @@
* @since 1.0
*/
/
*/
/ 动态切换浏览器窗口title https://zhangge.net/
// 动态切换浏览器窗口title https://zhangge.net/
jQuery
(
document
).
ready
(
function
()
{
function
c
()
{
document.title = document[a] ? "
(●_●) 床前明月光.....《" + d + "》
" : d
document
.
title
=
document
[
a
]
?
"
麻溜儿回来~~~ |
"
+
d
+
"
"
:
d
}
var
a
,
b
,
d
=
document
.
title
;
"
undefined
"
!=
typeof
document
.
hidden
?
(
a
=
"
hidden
"
,
b
=
"
visibilitychange
"
)
:
"
undefined
"
!=
typeof
document
.
mozHidden
?
(
a
=
"
mozHidden
"
,
b
=
"
mozvisibilitychange
"
)
:
"
undefined
"
!=
typeof
document
.
webkitHidden
&&
(
a
=
"
webkitHidden
"
,
b
=
"
webkitvisibilitychange
"
);
"
undefined
"
==
typeof
document
.
addEventListener
&&
"
undefined
"
==
typeof
document
[
a
]
||
document
.
addEventListener
(
b
,
c
,
!
1
)
});
*/
});
function
initNavbar
()
{
$
(
"
.navbar .navbar-nav li
"
).
each
(
function
()
{
...
...
@@ -149,10 +149,7 @@ function initScrollMenu() {
}
var
PaymentUtils
=
window
.
payment
||
{
config
:
[{
url
:
appConfig
.
qiuniuBasePath
+
appConfig
.
zfbPraiseCode
,
desc
:
'
支付宝转账
'
},
{
url
:
appConfig
.
qiuniuBasePath
+
appConfig
.
wxPraiseCode
,
desc
:
'
微信转账
'
}],
config
:
[{
url
:
appConfig
.
qiuniuBasePath
+
appConfig
.
zfbPraiseCode
,
desc
:
'
支付宝转账
'
},
{
url
:
appConfig
.
qiuniuBasePath
+
appConfig
.
wxPraiseCode
,
desc
:
'
微信转账
'
}],
show
:
function
()
{
$
(
"
#reward
"
).
modal
(
'
show
'
);
this
.
change
(
0
);
...
...
@@ -246,8 +243,7 @@ $(function () {
$
.
bubble
.
init
();
}
getCurrentDate
();
setInterval
(
function
()
{
getCurrentDate
()
&&
setInterval
(
function
()
{
getCurrentDate
();
},
1000
);
...
...
@@ -288,15 +284,14 @@ $(function () {
}
}
/**
* 显示取链的表格
*/
/* 显示取链的表格 */
$
(
"
.showContent
"
).
click
(
function
()
{
$
(
this
).
toggleClass
(
'
fa-plus-square fa-minus-square
'
);
// $(".disable-content").toggleClass('fade-in hide');
$
(
"
.disable-content
"
).
slideToggle
(
400
);
});
/* 分享 */
if
(
/iphone|ipod|ipad|ipad|mobile/i
.
test
(
navigator
.
userAgent
.
toLowerCase
()))
{
$
(
'
.share-sd
'
).
click
(
function
()
{
$
(
'
#share
'
).
animate
({
...
...
@@ -318,6 +313,7 @@ $(function () {
});
}
/* 文章点赞 */
$
(
"
#social .like
"
).
click
(
function
()
{
var
$this
=
$
(
this
);
var
$a
=
$
(
this
).
find
(
"
a
"
);
...
...
@@ -347,6 +343,7 @@ $(function () {
});
});
/* 图片懒加载 */
$
(
"
img.lazy-img
"
).
lazyload
({
placeholder
:
appConfig
.
staticPath
+
"
/img/loading.gif
"
,
effect
:
"
fadeIn
"
,
...
...
@@ -406,6 +403,7 @@ $(function () {
});
}
/* 轮播图 */
$
(
'
#myCarousel
'
).
mouseover
(
function
()
{
$
(
"
.carousel-control
"
).
removeClass
(
"
hide
"
);
}).
mouseout
(
function
()
{
...
...
@@ -413,4 +411,17 @@ $(function () {
}).
carousel
({
interval
:
5000
});
});
/** 初始化评论插件 */
if
(
$
.
comment
)
{
$
.
comment
.
init
({
placeholder
:
'
说点什么吧
'
,
wmName
:
appConfig
.
siteName
,
wmUrl
:
appConfig
.
wwwPath
,
wmDesc
:
'
讲文明、要和谐
'
});
$
(
"
#comment-form-btn
"
).
click
(
function
()
{
$
.
comment
.
submit
(
$
(
this
));
});
}
});
\ No newline at end of file
blog-web/src/main/resources/templates/layout/footer.ftl
浏览文件 @
d7c4d4c9
...
...
@@ -197,6 +197,7 @@
<script type="text/javascript" src="https://cdn.bootcss.com/mustache.js/2.3.0/mustache.min.js"></script>
<script type="text/javascript">
var appConfig = {
siteName: '${config.siteName}',
wwwPath: '${config.siteUrl}',
cmsPath: '${config.cmsUrl}',
staticPath: '${config.staticWebSite}',
...
...
@@ -204,13 +205,7 @@
wxPraiseCode: '${config.wxPraiseCode}',
zfbPraiseCode: '${config.zfbPraiseCode}'
};
var editorConfig = {
wmName: '${config.siteName}',
wmUrl: '${config.siteUrl}',
wmDesc: '讲文明、要和谐'
};
</script>
<script type="text/javascript" src="${config.staticWebSite}/js/zhyd.core.js"></script>
<script type="text/javascript" src="${config.staticWebSite}/js/zhyd.js"></script>
<script type="text/javascript" src="${config.staticWebSite}/js/zhyd.comment.js"></script>
\ No newline at end of file
<script type="text/javascript" src="${config.staticWebSite}/js/zhyd.comment.js"></script>
<script type="text/javascript" src="${config.staticWebSite}/js/zhyd.js"></script>
\ No newline at end of file
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录