修复了一些问题

This commit is contained in:
kate522 committed 2026-08-25 20:15:55 +08:00
1 parent c484ee6ef3
commit e877ceb560
28 files changed
+565 -535

No files matched your search

+48 -48
View File
@@ -1,5 +1,5 @@
$.fn.FixedInput = function (action) {
var _this = $(this);
jQuery.fn.FixedInput = function (action) {
var _this = jQuery(this);
if (!_this.attr('on-start')) {
_this
.on('click', '.fixed-body', function () {
@@ -12,7 +12,7 @@ $.fn.FixedInput = function (action) {
case 'show':
_this.addClass('show');
return setTimeout(() => {
$(_this.find('textarea,input')[0]).focus();
jQuery(_this.find('textarea,input')[0]).focus();
}, 100);
case 'hide':
_this.find('#cancel-comment-reply-link').click();
@@ -25,25 +25,25 @@ $.fn.FixedInput = function (action) {
//移动端浮动的input|暂时仅用在评论
_win.bd.on('click', '[fixed-input]', function () {
var _this = $(this);
// var _input = $(_this.attr('data-input'));
var _fixed = $(_this.attr('fixed-input'));
var _this = jQuery(this);
// var _input = jQuery(_this.attr('data-input'));
var _fixed = jQuery(_this.attr('fixed-input'));
scrollTopTo('#comments');
_fixed.FixedInput('show');
//_input.length && _input.focus();
});
var $comments = $('#comments-title');
var $cancel = $('#cancel-comment-reply-link');
var $author = $('#comment-user-info');
var $submit = $('#commentform #submit');
var $comments = jQuery('#comments-title');
var $cancel = jQuery('#cancel-comment-reply-link');
var $author = jQuery('#comment-user-info');
var $submit = jQuery('#commentform #submit');
var $com_ajax_url = _win.ajax_url;
var $com_list = $('#postcomments .commentlist');
var $com_list = jQuery('#postcomments .commentlist');
//评论ajax翻页
_win.bd.on('click', '.commentlist .pagenav a,.comment-orderby', function () {
var _this = $(this);
$('#cancel-comment-reply-link').click();
var _this = jQuery(this);
jQuery('#cancel-comment-reply-link').click();
if (_this.hasClass('pag-jump')) {
_this.addClass('ajax-next');
@@ -51,28 +51,28 @@ _win.bd.on('click', '.commentlist .pagenav a,.comment-orderby', function () {
}
var ajax_replace = !_this.attr('no-replace');
return post_ajax($(this), '.commentlist', '.commentlist', '.comment', '', '.pagenav', '', '', ajax_replace);
return post_ajax(jQuery(this), '.commentlist', '.commentlist', '.comment', '', '.pagenav', '', '', ajax_replace);
});
//编辑按钮,回复
_win.bd.on('click', '.comment-edit-link,.comment-reply-link', function () {
var _this = $(this),
var _this = jQuery(this),
commentid = _this.attr('data-commentid');
var is_edit = _this.hasClass('comment-edit-link');
return addComment.moveForm(_this, 'div-comment-' + commentid, commentid, 'respond', _this.attr('data-postid'), is_edit), scrollTopTo($('#div-comment-' + commentid), -10), !1;
return addComment.moveForm(_this, 'div-comment-' + commentid, commentid, 'respond', _this.attr('data-postid'), is_edit), scrollTopTo(jQuery('#div-comment-' + commentid), -10), !1;
});
//回车提交
_win.bd.on('keydown', '#comment', function (e) {
var keycode = e.which || e.keyCode;
if ((e.metaKey || e.ctrlKey) && keycode == 13) {
$(this).closest('#commentform').find('#submit').click();
jQuery(this).closest('#commentform').find('#submit').click();
}
});
//删除评论
_win.bd.on('click', '.comment-trash-link', function () {
var _this = $(this);
var _this = jQuery(this);
var commentid = _this.attr('data-commentid');
var trash_data = {
action: 'trash_comment',
@@ -85,10 +85,10 @@ _win.bd.on('click', '.comment-trash-link', function () {
trash_data,
function (n) {
n.error ||
$('#comment-' + commentid)
jQuery('#comment-' + commentid)
.slideUp()
.delay(1000, function () {
$(this).remove();
jQuery(this).remove();
});
},
aksrt__('processing')
@@ -98,14 +98,14 @@ _win.bd.on('click', '.comment-trash-link', function () {
//审核评论
_win.bd.on('click', '.comment-approve-link', function () {
var _this = $(this);
var _this = jQuery(this);
var commentid = _this.attr('data-commentid');
var trash_data = {
action: 'approve_comment',
comment_id: commentid,
_wpnonce: _this.attr('data-nonce'),
};
var reply = $('#div-comment-' + commentid).find('.reply-link');
var reply = jQuery('#div-comment-' + commentid).find('.reply-link');
aksrt_ajax(_this, trash_data, function (n) {
if (!n.error) {
@@ -119,7 +119,7 @@ _win.bd.on('click', '.comment-approve-link', function () {
reply.length || _this.parents('.dropdown').before('<span class="reply-link"><a class="comment-reply-link" data-commentid="' + commentid + '" href="javascript:;">' + aksrt__('comment_reply') + '</a></span>');
}
$('#div-comment-' + commentid)
jQuery('#div-comment-' + commentid)
.find('.badge-approve')
.html(_badg);
_this.removeClass('approve unapprove').addClass(_class).find('text').html(_text);
@@ -157,7 +157,7 @@ function htmlUnescapes(val) {
//提交评论
_win.bd.on('click', '#commentform #submit', function () {
var _this = $(this);
var _this = jQuery(this);
var _form = _this.parents('#commentform');
var inputs = _form.serializeObject();
if ($author.length && $author.attr('require_name_email')) {
@@ -169,7 +169,7 @@ _win.bd.on('click', '#commentform #submit', function () {
}
}
if (inputs.comment.length < 4) {
return notyf(aksrt__('comment_too_short'), 'warning'), $('#comment').focus(), !1;
return notyf(aksrt__('comment_too_short'), 'warning'), jQuery('#comment').focus(), !1;
}
inputs.comment = htmlEscapes(inputs.comment);
@@ -181,12 +181,12 @@ _win.bd.on('click', '#commentform #submit', function () {
if (inputs.edit_comment_ID) {
//编辑评论后提交
$cancel.click();
$('#comment-content-' + inputs.edit_comment_ID).html(data);
jQuery('#comment-content-' + inputs.edit_comment_ID).html(data);
} else {
//新建评论
var data = data.replace(/class="comment/, 'style="display:none;" class="comment ajax-comment');
var respond = $('#respond');
var $com_list = $('#postcomments .commentlist');
var respond = jQuery('#respond');
var $com_list = jQuery('#postcomments .commentlist');
var is_comment_parent = respond.parent().parent('.comment');
if (is_comment_parent.length) {
@@ -200,7 +200,7 @@ _win.bd.on('click', '#commentform #submit', function () {
if (!$com_list.length) {
respond.after('<div id="postcomments"><ol class="commentlist list-unstyled">' + data + '</ol></div>');
} else {
var $order = $('#postcomments .commentlist>.comment-filter');
var $order = jQuery('#postcomments .commentlist>.comment-filter');
if ($order.length) {
$order.after(data);
} else {
@@ -209,9 +209,9 @@ _win.bd.on('click', '#commentform #submit', function () {
}
}
if ($('[reply-show]').length && n.comment) {
if (jQuery('[reply-show]').length && n.comment) {
if (~~n.comment.comment_approved > 0) {
var hash = $($('[reply-show]')[0]).attr('reload-hash'); //跳转
var hash = jQuery(jQuery('[reply-show]')[0]).attr('reload-hash'); //跳转
if (hash) {
window.location.hash = hash;
@@ -225,15 +225,15 @@ _win.bd.on('click', '#commentform #submit', function () {
}
$cancel.click();
$('#postcomments .ajax-comment').slideDown(200).removeClass('ajax-comment');
$('#postcomments .comment-null').slideUp(200);
jQuery('#postcomments .ajax-comment').slideDown(200).removeClass('ajax-comment');
jQuery('#postcomments .comment-null').slideUp(200);
}
auto_fun();
wait_for(n.wait_time);
$('#comment').val('');
$('[name="canvas_yz"]').val('');
$('.imagecaptcha').click();
$('#respond').FixedInput('hide');
jQuery('#comment').val('');
jQuery('[name="canvas_yz"]').val('');
jQuery('.imagecaptcha').click();
jQuery('#respond').FixedInput('hide');
}
});
return false;
@@ -248,16 +248,16 @@ var addComment = {
cancel = t.I('cancel-comment-reply-link'),
parent = t.I('comment_parent'),
post = t.I('comment_post_ID');
var action_text_r = $('#' + respondId + ' .action-text');
$('.comment-footer').show();
var action_text_r = jQuery('#' + respondId + ' .action-text');
jQuery('.comment-footer').show();
if (num) {
var $submit_html = $submit.html();
action_text_r.html(aksrt__('comment_edit_content'));
t.I('comment').value = ''; //清空内容
$('#comment_parent').attr('name', 'edit_comment_ID');
jQuery('#comment_parent').attr('name', 'edit_comment_ID');
$submit.attr('disabled', true).html('<i class="loading mr6"></i><span>' + aksrt__('loading') + '</span>');
$('#comment').attr('disabled', true).val(aksrt__('comment_fetching_content'));
$('#' + commId)
jQuery('#comment').attr('disabled', true).val(aksrt__('comment_fetching_content'));
jQuery('#' + commId)
.find('.comment-footer')
.hide();
var data = {
@@ -270,7 +270,7 @@ var addComment = {
function (n) {
n.error && $cancel.click();
$submit.html($submit_html).attr('disabled', false);
$('#comment').attr('disabled', false).val(htmlUnescapes(n.comment_content)).focus();
jQuery('#comment').attr('disabled', false).val(htmlUnescapes(n.comment_content)).focus();
},
'stop'
);
@@ -297,12 +297,12 @@ var addComment = {
var t = addComment,
temp = t.I('wp-temp-form-div'),
respond = t.I(t.respondId);
$('#comment_parent').attr('name', 'comment_parent');
jQuery('#comment_parent').attr('name', 'comment_parent');
t.I('comment_parent').value = '0';
$('.comment-footer').show();
$('#comment').val('').trigger('input');
jQuery('.comment-footer').show();
jQuery('#comment').val('').trigger('input');
setTimeout(function () {
$('#' + respondId).removeClass('show');
jQuery('#' + respondId).removeClass('show');
}, 10);
action_text_r.html('');
if (temp && respond) {
@@ -315,7 +315,7 @@ var addComment = {
};
try {
setTimeout(function () {
$('#' + respondId).FixedInput('show');
jQuery('#' + respondId).FixedInput('show');
}, 10);
} catch (e) {}
return false;