refactor(assets): vendor 资产迁入标准目录并全仓去除 zibll 标识
- assets/vendor 全量迁移: fontawesome5→assets/fontawesome5, css→assets/css, js→assets/js/runtime(避开 14 个同名自有文件), img 合并去重→assets/img, fonts→assets/fonts; 删除 assets/vendor - libs 五个与 widgets/third-party 字节相同的库不重复入库, loader paths 改指向 - 运行时切换: _win.uri=assets 根, loader baseUrl=/js/runtime, enlighter 注入 路径同步; PHP 7 个引用文件切换并改名 $zibll_*→$runtime_* - 去品牌: Qinver 头注释/品牌 console.log/演示链接清除, 默认文案中性化 - 功能标识符改名: zib__→aksrt__, zib_ajax→aksrt_ajax, window.zib→ window.aksrtLegacy, zibllblock/*→aksrtblock/*, .zib-widget→.aksrt-panel, .zib-slider→.aksrt-slider, zib_menu_options meta 键等 - 自有 CSS 改名: legacy-utilities/compat-vars/footer shell - admin SPA 重建; 契约测试同步(路径/断言/文件更名) - 例外保留: tests/visual 对照环境与 fixtures 前缀(外部 Zibll 产品引用) 验证: php -l 133 个改动文件通过; runtime 86 个 JS node --check 通过; 契约测试 68/70(2 个失败经 stash 对照确认为存量问题)
This commit is contained in:
1 parent
4f2391fb64
commit
9375b1c30c
591 files changed
+1690
-11041
No files matched your search
@@ -0,0 +1,345 @@
|
||||
$.fn.FixedInput = function (action) {
|
||||
var _this = $(this);
|
||||
if (!_this.attr('on-start')) {
|
||||
_this
|
||||
.on('click', '.fixed-body', function () {
|
||||
_this.FixedInput('hide');
|
||||
})
|
||||
.attr('on-start', true);
|
||||
}
|
||||
|
||||
switch (action) {
|
||||
case 'show':
|
||||
_this.addClass('show');
|
||||
return setTimeout(() => {
|
||||
$(_this.find('textarea,input')[0]).focus();
|
||||
}, 100);
|
||||
case 'hide':
|
||||
_this.find('#cancel-comment-reply-link').click();
|
||||
_this.find('input,textarea').blur();
|
||||
_this.find('.dropup').removeClass('open');
|
||||
return _this.removeClass('show');
|
||||
default:
|
||||
}
|
||||
};
|
||||
|
||||
//移动端浮动的input|暂时仅用在评论
|
||||
_win.bd.on('click', '[fixed-input]', function () {
|
||||
var _this = $(this);
|
||||
// var _input = $(_this.attr('data-input'));
|
||||
var _fixed = $(_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 $com_ajax_url = _win.ajax_url;
|
||||
var $com_list = $('#postcomments .commentlist');
|
||||
|
||||
//评论ajax翻页
|
||||
_win.bd.on('click', '.commentlist .pagenav a,.comment-orderby', function () {
|
||||
var _this = $(this);
|
||||
$('#cancel-comment-reply-link').click();
|
||||
|
||||
if (_this.hasClass('pag-jump')) {
|
||||
_this.addClass('ajax-next');
|
||||
return;
|
||||
}
|
||||
|
||||
var ajax_replace = !_this.attr('no-replace');
|
||||
return post_ajax($(this), '.commentlist', '.commentlist', '.comment', '', '.pagenav', '', '', ajax_replace);
|
||||
});
|
||||
|
||||
//编辑按钮,回复
|
||||
_win.bd.on('click', '.comment-edit-link,.comment-reply-link', function () {
|
||||
var _this = $(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;
|
||||
});
|
||||
|
||||
//回车提交
|
||||
_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();
|
||||
}
|
||||
});
|
||||
|
||||
//删除评论
|
||||
_win.bd.on('click', '.comment-trash-link', function () {
|
||||
var _this = $(this);
|
||||
var commentid = _this.attr('data-commentid');
|
||||
var trash_data = {
|
||||
action: 'trash_comment',
|
||||
comment_id: commentid,
|
||||
_wpnonce: _this.attr('data-nonce'),
|
||||
};
|
||||
if (confirm(aksrt__('comment_confirm_delete')) == 1) {
|
||||
aksrt_ajax(
|
||||
_this,
|
||||
trash_data,
|
||||
function (n) {
|
||||
n.error ||
|
||||
$('#comment-' + commentid)
|
||||
.slideUp()
|
||||
.delay(1000, function () {
|
||||
$(this).remove();
|
||||
});
|
||||
},
|
||||
aksrt__('processing')
|
||||
);
|
||||
}
|
||||
});
|
||||
|
||||
//审核评论
|
||||
_win.bd.on('click', '.comment-approve-link', function () {
|
||||
var _this = $(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');
|
||||
|
||||
aksrt_ajax(_this, trash_data, function (n) {
|
||||
if (!n.error) {
|
||||
var _text = n.status == 'hold' ? aksrt__('comment_approve') : aksrt__('comment_reject');
|
||||
var _class = n.status == 'hold' ? 'approve' : 'unapprove';
|
||||
var _badg = n.status == 'hold' ? '<span class="badg c-red badg-sm">' + aksrt__('comment_pending_review') + '</span>' : '';
|
||||
|
||||
if (n.status == 'hold') {
|
||||
reply.remove();
|
||||
} else {
|
||||
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)
|
||||
.find('.badge-approve')
|
||||
.html(_badg);
|
||||
_this.removeClass('approve unapprove').addClass(_class).find('text').html(_text);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
function htmlEscapes(val) {
|
||||
var htmlEscapes = {
|
||||
'&': '&',
|
||||
'<': '<',
|
||||
'>': '>',
|
||||
'"': '"',
|
||||
"'": ''',
|
||||
};
|
||||
var a = val.replace(/[&<>"']/g, function (match) {
|
||||
return htmlEscapes[match];
|
||||
});
|
||||
return a;
|
||||
}
|
||||
|
||||
function htmlUnescapes(val) {
|
||||
var htmlUnescapes = {
|
||||
'&': '&',
|
||||
'<': '<',
|
||||
'>': '>',
|
||||
'"': '"',
|
||||
''': "'",
|
||||
};
|
||||
var a = val.replace(/&(amp|lt|gt|quot|#039);/g, function (match) {
|
||||
return htmlUnescapes[match];
|
||||
});
|
||||
return a;
|
||||
}
|
||||
|
||||
//提交评论
|
||||
_win.bd.on('click', '#commentform #submit', function () {
|
||||
var _this = $(this);
|
||||
var _form = _this.parents('#commentform');
|
||||
var inputs = _form.serializeObject();
|
||||
if ($author.length && $author.attr('require_name_email')) {
|
||||
if (inputs.author.length < 2 || inputs.email.length < 4) {
|
||||
return notyf(aksrt__('comment_enter_name_email'), 'warning'), $author.addClass('open').find('[name="author"]').focus(), !1;
|
||||
}
|
||||
if (!is_mail(inputs.email)) {
|
||||
return notyf(aksrt__('comment_email_invalid'), 'warning'), $author.addClass('open').find('[name="email"]').focus(), !1;
|
||||
}
|
||||
}
|
||||
if (inputs.comment.length < 4) {
|
||||
return notyf(aksrt__('comment_too_short'), 'warning'), $('#comment').focus(), !1;
|
||||
}
|
||||
|
||||
inputs.comment = htmlEscapes(inputs.comment);
|
||||
|
||||
inputs.action = 'submit_comment';
|
||||
aksrt_ajax(_this, inputs, function (n) {
|
||||
var data = n.html;
|
||||
if (!n.error && data) {
|
||||
if (inputs.edit_comment_ID) {
|
||||
//编辑评论后提交
|
||||
$cancel.click();
|
||||
$('#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 is_comment_parent = respond.parent().parent('.comment');
|
||||
|
||||
if (is_comment_parent.length) {
|
||||
var _children = is_comment_parent.find('>.children');
|
||||
if (_children.length) {
|
||||
_children.prepend(data);
|
||||
} else {
|
||||
is_comment_parent.append('<ul class="children">' + data + '</ul>');
|
||||
}
|
||||
} else {
|
||||
if (!$com_list.length) {
|
||||
respond.after('<div id="postcomments"><ol class="commentlist list-unstyled">' + data + '</ol></div>');
|
||||
} else {
|
||||
var $order = $('#postcomments .commentlist>.comment-filter');
|
||||
if ($order.length) {
|
||||
$order.after(data);
|
||||
} else {
|
||||
$com_list.prepend(data);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ($('[reply-show]').length && n.comment) {
|
||||
if (~~n.comment.comment_approved > 0) {
|
||||
var hash = $($('[reply-show]')[0]).attr('reload-hash'); //跳转
|
||||
|
||||
if (hash) {
|
||||
window.location.hash = hash;
|
||||
}
|
||||
window.location.reload();
|
||||
} else {
|
||||
setTimeout(function () {
|
||||
notyf(aksrt__('comment_hidden_after_review'), 'warning');
|
||||
}, 200);
|
||||
}
|
||||
}
|
||||
|
||||
$cancel.click();
|
||||
$('#postcomments .ajax-comment').slideDown(200).removeClass('ajax-comment');
|
||||
$('#postcomments .comment-null').slideUp(200);
|
||||
}
|
||||
auto_fun();
|
||||
wait_for(n.wait_time);
|
||||
$('#comment').val('');
|
||||
$('[name="canvas_yz"]').val('');
|
||||
$('.imagecaptcha').click();
|
||||
$('#respond').FixedInput('hide');
|
||||
}
|
||||
});
|
||||
return false;
|
||||
});
|
||||
|
||||
var addComment = {
|
||||
moveForm: function (_this, commId, parentId, respondId, postId, num) {
|
||||
var t = this,
|
||||
div,
|
||||
comm = t.I(commId),
|
||||
respond = t.I(respondId),
|
||||
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();
|
||||
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');
|
||||
$submit.attr('disabled', true).html('<i class="loading mr6"></i><span>' + aksrt__('loading') + '</span>');
|
||||
$('#comment').attr('disabled', true).val(aksrt__('comment_fetching_content'));
|
||||
$('#' + commId)
|
||||
.find('.comment-footer')
|
||||
.hide();
|
||||
var data = {
|
||||
action: 'get_comment',
|
||||
comment_id: parentId,
|
||||
};
|
||||
aksrt_ajax(
|
||||
_this,
|
||||
data,
|
||||
function (n) {
|
||||
n.error && $cancel.click();
|
||||
$submit.html($submit_html).attr('disabled', false);
|
||||
$('#comment').attr('disabled', false).val(htmlUnescapes(n.comment_content)).focus();
|
||||
},
|
||||
'stop'
|
||||
);
|
||||
}
|
||||
|
||||
action_text_r.html(_this.attr('data-replyto'));
|
||||
|
||||
t.respondId = respondId;
|
||||
postId = postId || false;
|
||||
|
||||
if (!t.I('wp-temp-form-div')) {
|
||||
div = document.createElement('div');
|
||||
div.id = 'wp-temp-form-div';
|
||||
div.style.display = 'none';
|
||||
respond.parentNode.insertBefore(div, respond);
|
||||
}
|
||||
!comm ? ((temp = t.I('wp-temp-form-div')), (t.I('comment_parent').value = '0'), temp.parentNode.insertBefore(respond, temp), temp.parentNode.removeChild(temp)) : comm.parentNode.insertBefore(respond, comm.nextSibling);
|
||||
|
||||
// pcsheight()
|
||||
if (post && postId) post.value = postId;
|
||||
parent.value = parentId;
|
||||
cancel.style.display = '';
|
||||
cancel.onclick = function () {
|
||||
var t = addComment,
|
||||
temp = t.I('wp-temp-form-div'),
|
||||
respond = t.I(t.respondId);
|
||||
$('#comment_parent').attr('name', 'comment_parent');
|
||||
t.I('comment_parent').value = '0';
|
||||
$('.comment-footer').show();
|
||||
$('#comment').val('').trigger('input');
|
||||
setTimeout(function () {
|
||||
$('#' + respondId).removeClass('show');
|
||||
}, 10);
|
||||
action_text_r.html('');
|
||||
if (temp && respond) {
|
||||
temp.parentNode.insertBefore(respond, temp);
|
||||
temp.parentNode.removeChild(temp);
|
||||
}
|
||||
this.style.display = 'none';
|
||||
this.onclick = null;
|
||||
return false;
|
||||
};
|
||||
try {
|
||||
setTimeout(function () {
|
||||
$('#' + respondId).FixedInput('show');
|
||||
}, 10);
|
||||
} catch (e) {}
|
||||
return false;
|
||||
},
|
||||
I: function (e) {
|
||||
return document.getElementById(e);
|
||||
},
|
||||
};
|
||||
|
||||
//等待
|
||||
function wait_for($time) {
|
||||
var wait = $time || 15;
|
||||
var $submit_html = $submit.html();
|
||||
|
||||
function wait_ing() {
|
||||
if (wait > 0) {
|
||||
$submit.html('<div style="width:55px;"><i class="loading mr10"></i>' + wait + '</div>').attr('disabled', true);
|
||||
wait--;
|
||||
setTimeout(wait_ing, 1000);
|
||||
} else {
|
||||
$submit.html($submit_html).attr('disabled', false);
|
||||
wait = 15;
|
||||
}
|
||||
}
|
||||
|
||||
wait_ing();
|
||||
}
|
||||
Reference in new issue
Block a user