fix(runtime): remove legacy action endpoint
This commit is contained in:
@@ -2855,68 +2855,6 @@ _win.bd.on('click', '.toggle-theme', function (event) {
|
||||
}
|
||||
});
|
||||
|
||||
/*==============点赞===收藏===关注===========*/
|
||||
_win.bd.on('click', '[data-action]', function () {
|
||||
var _this = jQuery(this);
|
||||
var s = _this.attr('data-pid');
|
||||
var key = _this.attr('data-action');
|
||||
var type = key;
|
||||
var _type = 'aksrt' + type;
|
||||
var data = {
|
||||
type: type,
|
||||
key: key,
|
||||
pid: s,
|
||||
};
|
||||
if (!_win.is_signin) {
|
||||
var t = lcs.get(_type) || '';
|
||||
if (-1 !== t.indexOf(',' + s + ',')) return notyf(aksrt__(type == 'like' ? 'like_already_post' : 'like_already_comment'), 'warning');
|
||||
t ? (t.length >= 160 ? ((t = t.substring(0, t.length - 1)), (t = t.substr(1).split(',')), t.splice(0, 1), t.push(s), (t = t.join(',')), lcs.set(_type, ',' + t + ',')) : lcs.set(_type, t + s + ',')) : lcs.set(_type, ',' + s + ',');
|
||||
}
|
||||
|
||||
action_ajax(_this, data, s, type, aksrt__('like_thanks'));
|
||||
});
|
||||
|
||||
function action_ajax(_this, data, pid, type, text) {
|
||||
if (_this.attr('disabled')) {
|
||||
return !1;
|
||||
}
|
||||
|
||||
data._wpnonce = _win.post_action_nonce;
|
||||
var c = text || aksrt__('done');
|
||||
jQuery.ajax({
|
||||
type: 'POST',
|
||||
url: _win.uri + '/action/action.php',
|
||||
dataType: 'json',
|
||||
data: data,
|
||||
beforeSend: function () {
|
||||
_this.attr('disabled', true).find('count').html('<i class="loading zts"></i>');
|
||||
},
|
||||
success: function (n) {
|
||||
// console.log(n);
|
||||
var ys = n.error ? 'danger' : '';
|
||||
if (n.action && n.action == 'remove') {
|
||||
_this.removeClass('actived action-animation');
|
||||
ys = 'warning';
|
||||
}
|
||||
|
||||
if (n.action && n.action == 'add') {
|
||||
_this.addClass('actived action-animation');
|
||||
}
|
||||
|
||||
notyf(n.msg || c, ys);
|
||||
_this
|
||||
.attr('disabled', false)
|
||||
.find('count')
|
||||
.html(n.cuont || '0');
|
||||
if (type == 'follow_user') {
|
||||
jQuery('[data-action="follow_user"][data-pid="' + pid + '"]').each(function () {
|
||||
jQuery(this).find('count').html(n.cuont);
|
||||
});
|
||||
}
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
_win.bd.on('click', '[ajax-action]', function () {
|
||||
var _this = jQuery(this);
|
||||
if (_this.attr('disabled')) return false;
|
||||
|
||||
Reference in New Issue
Block a user