Source code of filesite.io. https://filesite.io
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

44 lines
1.3 KiB

/* for theme TaJian */
(function() {
$('#btn_addfav').click(function(e) {
var share_content = $('input[name=share_content]').val(),
select_tag = $('select[name=tag]').val();
if (!share_content) {
alert('请填写分享内容或网址!');
return false;
}else if (/https:\/\/[\w\.]+\/[\w]+/ig.test(share_content) == false) {
alert('目前只支持抖音、快手、西瓜视频和Bilibili的分享网址哦!');
return false;
}
var btn = this;
$(btn).prop('disabled', true);
var postData = {content: share_content};
if (select_tag) {
postData.tag = select_tag;
}
$.ajax({
url: '/api/addfav',
method: 'POST',
dataType: 'JSON',
data: postData
}).done(function(data, textStatus, jqXHR) {
$(btn).prop('disabled', false);
if (data.code == 1) {
$('input[name=share_content]').val('');
alert(data.msg || data.err);
}else {
alert('保存失败,请稍后重试!');
}
}).fail(function(jqXHR, textStatus, errorThrown) {
$(btn).props('disabled', false);
alert('服务器异常了:' + errorThrown);
});
});
1 year ago
})();