');
let desc_text = $('
');
desc_text_container.addClass('container');
desc_text_container.addClass('column');
desc_text_container.addClass('padding');
desc_text_container.addClass('mid');
desc_text_container.attr('id', 'desc');
video_data.description.split('\n').forEach(function (e) {
let desc_text_clone = desc_text.clone();
desc_text_clone.text(e);
desc_text_container.append(desc_text_clone);
});
desc_card.append(desc_tags);
desc_card.append(desc_text_container);
}
//动作
{
//主页
{
let action_home = action_button.clone();
action_home.children().text('home');
action_home.click(function () {
window.open('https://bilibili.com/av' + video_data.id);
});
action.append(action_home);
}
//手机
{
let action_app = action_button.clone();
action_app.children().text('phone_android');
action_app.click(function () {
window.open('bilibili://video/' + video_data.id);
});
action.append(action_app);
}
//投币
{
let action_coin = action_button.clone();
action_coin.children().text('monetization_on');
action_coin.click(function () {
$.getJSON('/me/coin/action/throw/aid/' + video_data.id, function (data) {
if (data.code === 0) {
addSnackBar('投币成功!');
} else if (data.code === 34005) {
addSnackBar('投币太多啦~');
} else {
addSnackBar('投币失败,' + data.message + '[' + data.code + ']');
}
});
});
action.append(action_coin);
}
//收藏
{
let action_favorite = action_button.clone();
action_favorite.attr('id', 'favorite');
$.getJSON('/me/favourite/action/check/av/' + video_data.id, function (data) {
if (data.code === 0) {
if (data.data.favoured) {
action_favorite.children().text('star');
action_favorite.addClass('active');
} else {
action_favorite.children().text('star_border');
action_favorite.removeClass('active');
}
} else {
addSnackBar('获取收藏状态失败 ' + data.message + '[' + data.code + ']');
action_favorite.children().text('star_border');
}
});
action_favorite.click(function () {
$.getJSON('/me/favourite/action/check/av/' + video_data.id, function (data) {
if (data.code === 0) {
if (data.data.favoured) {
$.getJSON('/me/favourite/action/dislike/av/' + video_data.id, function (data) {
if (data.code === 0) {
addSnackBar('抛弃成功');
action_favorite.removeClass('active');
action_favorite.children().text('star_border');
} else {
addSnackBar('抛弃失败,' + data.message + '[' + data.code + ']');
}
});
} else {
$.getJSON('/me/favourite/action/like/av/' + video_data.id, function (data) {
if (data.code === 0) {
addSnackBar('收藏成功');
action_favorite.addClass('active');
action_favorite.children().text('star');
} else {
addSnackBar('收藏失败,' + data.message + '[' + data.code + ']');
}
})
}
} else {
addSnackBar('获取收藏状态失败 ' + data.message + '[' + data.code + ']');
}
});
});
action.append(action_favorite);
}
//刷新
{
let action_refresh = action_button.clone();
action_refresh.children().text('refresh');
action_refresh.click(function () {
getjson('/api/view?update=1&id=' + video_id, refreshVideo);
});
action.append(action_refresh);
}
content.append(action);
}
content.append(desc_card);
addSnackBar('加载完成');
} else {
addSnackBar(data.message + '[' + data.code + ']');
}
NProgress.done();
};
let video_id = location.href.match(/\d+/) + '';
getjson('/api/view?id=' + video_id, refreshVideo);
}
//其他
else {
content.append($('#content'));
$('#content').removeClass("content");
$('#content').show();
head.append(css);
}
}
}
}
//水波效果
{
window.rippler = $.ripple('.sidebar a:not(.logo), .card .action a, .tab, .pages>.item, .action .btn, a.btn, .season', {
multi: true
});
}
//输入框处理
body.on('focus', 'input, textarea', function () {
$(this).parent('.item.input').addClass('focus');
$(this).parent('.item.input').children('.icon').addClass('focus');
$(this).parent('.textbox').addClass('focus');
$(this).parent('.textbox').children('.icon').addClass('focus');
});
body.on('blur', 'input, textarea', function () {
$(this).parent('.item.input').removeClass('focus');
$(this).parent('.item.input').children('.icon').removeClass('focus');
$(this).parent('.textbox').removeClass('focus');
$(this).parent('.textbox').children('.icon').removeClass('focus');
});
//设置列处理
{
$('.option-list>.option').each(function () {
$(this).css('width', $(this).parent().width() / $('.option-list>.option').length + 'px')
});
let showed;
body.on('click', '.option-list>.option>.item', function () {
$(this).next('ul').addClass('show');
showed = $(this).next('ul');
body.one('click', function (e) {
$('.option-list>.option>ul.show').each(function () {
if ($(this).html() !== showed.html()
|| $(e.target).parents('.option').length === 0) {
$(this).removeClass('show');
}
});
})
});
$.ripple('.option-list>.option>ul>li', {
multi: true
});
body.on('click', '.option-list>.option>ul>li', function (e) {
e.preventDefault();
e.stopPropagation();
switch ($(this).children('a').attr('data-type')) {
case 'source':
search_data.source = $(this).children('a').attr('data-search');
break;
case 'sort':
search_data.sort = $(this).children('a').attr('data-search');
break;
case 'number':
search_data.number = $(this).children('a').attr('data-search');
break;
}
if (search_data.source === source.biliplus) {
$(this).parents('.option-list').children('#number').children('ul').hide();
$(this).parents('.option-list').children('#number').children('.item').children('a').text('20个/页');
} else {
$(this).parents('.option-list').children('#number').children('ul').show();
$(this).parents('.option-list').children('#number').children('.item').children('a').text(search_data.number + '个/页');
}
$(this).parents('.option-list').children('#source').children('.item').children('a').text(search_data.source);
switch (search_data.sort) {
case sort.default:
$(this).parents('.option-list').children('#sort').children('.item').children('a').text(sort_cn.default);
break;
case sort.danmaku:
$(this).parents('.option-list').children('#sort').children('.item').children('a').text(sort_cn.danmaku);
break;
case sort.view:
$(this).parents('.option-list').children('#sort').children('.item').children('a').text(sort_cn.view);
break;
case sort.pubdate:
$(this).parents('.option-list').children('#sort').children('.item').children('a').text(sort_cn.pubdate);
break;
}
});
}
//限制整数
body.on('input', 'input.number', function () {
$(this).val(decodeURIComponent($(this).val()).replace(/[^\d]/g, ''));
});
//选项宽度
$(window).resize(function () {
let resizeOption = function () {
if ($(this).width() !== $(this).parent('.option').width())
$(this).css('width', $(this).parent('.option').width());
};
$('.option-list>.option>ul').each(resizeOption);
setTimeout(function () {
$('.option-list>.option>ul').each(resizeOption);
}, 200);
});
}
//播放器
if (location.href.indexOf('h5play-') !== -1) {
{
addCss(`
.ABP-Unit .BiliPlus-Scale-Menu {
border-radius: 2px;
transition: 150ms cubic-bezier(0.4, 0, 0.2, 1) 0ms;
border: none;
background-color: rgba(255,255,255,0.54);
padding: 0;
bottom: 62px;
}
.ABP-Unit .ABP-Video {
bottom: 56px;
}
.BiliPlus-Scale-Menu .Video-Scale,
.BiliPlus-Scale-Menu .Video-Defination {
align-items: center;
display: flex;
height: 32px;
padding: 2px;
}
.BiliPlus-Scale-Menu .Video-Defination {
border-bottom: 1px solid rgba(0,0,0,0.54);
}
.BiliPlus-Scale-Menu .Video-Defination div,
.BiliPlus-Scale-Menu .Video-Scale div {
color: rgba(0,0,0,0.87);
transition: 150ms cubic-bezier(0.4, 0, 0.2, 1) 0ms;
border-radius: 2px;
margin: 0 2px;
line-height: 12px;
height: 12px;
padding: 8px 0;
}
.BiliPlus-Scale-Menu .Video-Defination div.on,
.BiliPlus-Scale-Menu .Video-Defination div:hover,
.BiliPlus-Scale-Menu .Video-Scale div.on
.BiliPlus-Scale-Menu .Video-Scale div:hover{
background-color: rgba(255,255,255,0.87);
}
.ABP-Unit .BiliPlus-Scale-Menu {
width: auto !important;
height: auto;
}
.ABP-Unit .bar {
background-color: #e5e9ef;
top: 10px;
border-radius: 3px;
}
.ABP-Unit .bar .dark {
background-color: #00a1d6;
border-radius: 3px;
}
.ABP-Unit .bar .load {
background-color: #8adced;
border-radius: 3px;
}
.ABP-Unit .bar .dark::after {
display: none;
}
.volume-bar .bar .load {
background-color: #00a1d6;
}
.ABP-Unit .ABP-Control {
border: none;
box-shadow: 0 1px rgba(0,0,0,0.12);
height: 28px;
bottom: 28px;
}
.ABP-Unit .ABP-Text {
height: 28px;
border: none;
}
.ABP-Unit .ABP-Control .progress-bar {
border: none;
}
.ABP-Unit .ABP-Control .volume-bar {
width: 76px;
right: 124px;
}
.ABP-Unit .ABP-Control .time-label {
font-family: "Microsoft Yahei UI Light";
font-size: 12px;
line-height: 28px;
}
.ABP-Unit .button, .ABP-Unit .button-group {
line-height: 28px;
}
.volume-bar .bar .load:before {
position: absolute;
top: -3px;
right: -6px;
width: 12px;
height: 12px;
background-color: #fff;
border-radius: 12px;
-webkit-box-shadow: 0 0 1px rgba(0,0,0,.5);
box-shadow: 0 0 1px rgba(0,0,0,.5);
content: "";
cursor: pointer;
}
.ABP-Unit .ABP-Text input.ABP-Comment-Input {
height: 20px;
padding: 4px;
width: calc(100% - 146px);
}
.ABP-Unit .ABP-Text .ABP-Comment-Send {
height: 28px;
line-height: 28px;
border: none;
}
.ABP-FullScreen .ABP-Settings, .ABP-Mini .ABP-Settings, .ABP-WideScreen .ABP-Settings {
bottom: 56px;
}
`, 'Player');
}
}
//av号跳转
if (location.href.match(/:\/\/www\.biliplus\.com\/av\d+/))
location.replace(location.href.replace(/:\/\/www\.biliplus\.com\/av/, '://www.biliplus.com/video/av'));
function advanceSearch(data) {
location.href = 'https://www.biliplus.com/api/do.php?act=search&source=' + data.source + '&o=' + data.sort + '&n=' + data.number + '&p=1&word=' + data.word;
}
/**
* 添加style到head
* @param css css内容
* @param name style标识
*/
function addCss(css, name) {
let style = $('