提交 d7c4d4c9 编写于 作者: 智布道's avatar 智布道 👁

🎨 改进结构和代码格式

🔥 移除无用的js代码
上级 3f34450d
......@@ -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
......@@ -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({
......
......@@ -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
......@@ -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.
先完成此消息的编辑!
想要评论请 注册