').appendTo($('.first-line-right').parent()).append($('.first-line-right'));
$('.first-line-right').clone().appendTo($('.first-line-right').parent())
.attr('id', 'hhh_expand_list')
.css({'margin-top': '5px'})
.find('.txt').text('展开列表');
var old_height = $('.video-sections-content-list').css('height');
var old_max_height = $('.video-sections-content-list').css('max-height');
}
//点击列表展开
let $vcard = $('.video-episode-card:last');
let vcard_height = $vcard.outerHeight() + parseInt($vcard.css('margin-top')) + parseInt($vcard.css('margin-bottom'));
let $switch_button = $('#hhh_expand_list .switch-button');
if($switch_button.hasClass('on') === true) $switch_button.toggleClass('on'); //初始不展开状况
$('#hhh_expand_list .next-button').off('click.hhh_expand_list');
$('#hhh_expand_list .next-button').on('click.hhh_expand_list', function(){
$switch_button.toggleClass('on');
if($switch_button.hasClass('on') === true){
let expand_height = 0; $('.video-sections-item').each(function(){ expand_height += $(this).height() }); //当前展开高度
let limit_height = vcard_height * columns; //限高
expand_height = expand_height > limit_height ? limit_height : 'auto';
$('.video-sections-content-list').css({'height': expand_height, 'max-height': 'none'}); //展开columns个的高度
} else {
$('.video-sections-content-list').css({'height': old_height, 'max-height': old_max_height});
}
});
$('#hhh_expand_list .next-button').click(); //默认展开
}
//添加到收藏夹关键字过滤
function collection_filter(){
let collection_div = `
`;
if($('#hhh_collection_input').length === 0){
$(collection_div).prependTo($('.collection-m .title').css('padding-left', '150px'));
$('#hhh_collection_input').on('input',function(){
let val = $(this).val();
$('.content li').each(function(i){
if(!val) {
$(this).css('display','block');
return;
}
if($(this).find('.fav-title').text().toUpperCase().indexOf(val.toUpperCase()) !== -1) {
$(this).css('display','block')
}else{
$(this).css('display','none')
}
})
})
}
//
}
//未使用
function run_history(){
$.get("https://api.bilibili.com/x/web-goblin/history/search", { pn:"1", keyword: "12", business: "all" },
function(json){
console.log(json)
});
}
//https://api.bilibili.com/x/web-interface/archive/relation?aid=896486345&bvid=BV1CA4y1S7fS //得到投币数量
//初始化
function init() {
// var box = document.getElementById("hhh");
// //配置选项
// var config = { childList: true, subtree: true };
// var observer = new MutationObserver(function (mutationsList, observer) {
// for (var mutation of mutationsList) {
// const target = mutation.target;
// //typeof target.className === 'string' && target.className !== '' && log(target.className);
// if (mutation.type == 'childList') {
// //console.log('子元素被修改');
// }
// else if (mutation.type == 'attributes') {
// //console.log(mutation.attributeName + '属性被修改');
// }
// }
// });
// //开始观测
// observer.observe(document.body, config);
//console.clear();
let is_card_load = true;
let is_content_load = null;
let is_homepage_load = true;
let is_history_break = null;
let is_run_3X_break = true;
let run_load = null;
new MutationObserver((mutations, observer) => {
mutations.forEach(mutation => {
function get_ver_3x_(){
let ver = null;
let a = 0;
setTimeout(()=>a=1, 1000);
let r = waitForTrue(()=> $('.bpx-player-loading-panel-text').length>0 && a===1, ()=>{
ver = $('.bpx-player-loading-panel-text').text().match(/(\d+).(\d+).(\d+)-(\w+)/);
return true;
});
//log(r);
return ver;
}
function get_ver_3x(){
let ver_reg = $('.bpx-player-loading-panel-text').length > 0? $('.bpx-player-loading-panel-text').text().match(/(\d+).(\d+).(\d+)-(\w+)/): null;
let ver;
if(ver_reg === null) ver = null;
else if(ver_reg[1] === '3' && ver_reg[2] === '13') ver = BILI_3_X_13;
else ver = BILI_3_X;
return ver_reg;
}
function get_ver_(){
let ver_reg = $('.bpx-player-loading-panel-text').length > 0? $('.bpx-player-loading-panel-text').text().match(/(\d+).(\d+).(\d+)-(\w+)/): null;
let ver;
if(ver_reg === null) ver = null;
else if(ver_reg[1] === '3' && ver_reg[2] === '13') ver = BILI_3_X_13;
else ver = BILI_3_X;
return ver;
}
const target = mutation.target;
//typeof target.className === 'string' && target.className !== '' && log(target.className);
//typeof target.className === 'string' && target.className.match(/switch/) && log(target.className);
const stage = mutation.previousSibling && target.getAttribute('stage');
if(stage === '1' && $('.bilibili-player-video-wrap').length === 1){ //2.X
if($('#app').hasClass('app-v1')){
log("2.X“V3版”加载完毕");
bb_config.set_bb(BILI_2_X_V3);
run();
}else{
log("2.X“V2版”加载完毕");
bb_config.set_bb(BILI_2_X_V2);
run();
}
} else if(1&&typeof target.className === 'string' && target.className === 'bpx-player-control-top') {
log("订阅合集列表加载");
expand_list(15);
} else if(1&&typeof target.className === 'string' && target.className === 'v-wrap') {
log("添加到收藏夹关键字过滤");
collection_filter();
//} else if(!bb_type && typeof target.className === 'string' && target.className === 'bpx-player-loading-panel-text') { //3.X pbp-tip bpx-player-loading-panel-text
} else if(!0 && typeof target.className === 'string' && target.className === 'bpx-player-loading-panel-text') { //3.X pbp-tip bpx-player-loading-panel-text
function get_ver(){
let ver_reg = $('.bpx-player-loading-panel-text').length > 0? $('.bpx-player-loading-panel-text').text().match(/(\d+).(\d+).(\d+)-(\w+)/): null;
let ver;
if(ver_reg === null) { ver = null; ver_reg = []}
else if(ver_reg[1] === '3' && ver_reg[2][0] === '1' && ver_reg[2][1] >= '5') ver = BILI_3_X_13;
else ver = BILI_3_X;
return [ver, ver_reg[0]];
}
clearTimeout(run_load);
run_load = setTimeout(function() {
[ver, ver_string] = get_ver();
log(`[${ver_string}][${ver}]加载完毕`);
if(ver === null) return null;
bb_config.set_bb(ver);
//isrun_3_x_13();
if(ver === BILI_3_X_13) waitForTrue(isrun_3_x_13, ()=>run());
else waitForTrue(isrun_3_x, ()=>run());
}, 200);
function show_bb_config(sign,length=0){
//for (let [k, v] of Object.entries(bb)) { !!v && v[0] === '.' && $(v).length !== length && log(v+' - '+$(v).length); }
let arr=[];
for (let [k, v] of Object.entries(bb)) { !!v && v[0] === '.' && $(v).length !== -1 && arr.push(v+' - '+$(v).length) && 0 && log(v+' - '+$(v).length); }
for(let i=0; i<=10; i++){
if(i<10){
log(`--------------[${i}]----------------`);
arr.forEach(function(v){
+v.slice(-1) === i && v.slice(-2,-1) === ' ' && log(v);
})
} else if(i===10){
log(`--------------[${i}+]----------------`);
arr.forEach(function(v){
$.isNumeric(parseInt(v.slice(-2,-1))) && log(v);
})
}
}
log('--------------End----------------')
//log(arr)
}
function isrun_3_x() {
let exclude_k = ['danmukuTop', 'danmukuTopClose',];
let exclude_v = ['.like-info.active', '.coin-info.active', '.coin-dialog-mask .coin-btn', '.bpx-player-volume-hint', '.bili-dialog-m',
'.bpx-player-volume-hint-text', '.bpx-player-volume-hint-icon', '.bpx-player-hotkey-panel', '.coin-dialog-mask',
'.bpx-player-hotkey-panel-close', '.bpx-player-info-close', '.bpx-player-info-container', '.info-line','.bpx-player-top-mask'];
for(let [k, v] of Object.entries(bb)){
//if(!!k && exclude_k.indexOf(k) !== -1) log(exclude_k.indexOf(k) +' - '+k+' - '+v);
if(!!k && exclude_k.indexOf(k) !== -1) continue;
//if(!!v && exclude_v.indexOf(v) === -1 && $(v).length === 0) log(exclude_v.indexOf(v) +' - '+$(v).length+' - '+v);
if(!!v && exclude_v.indexOf(v) === -1 && $(v).length === 0) return false;
}
return true;
}
function isrun_3_x_13() {
let exclude_k = ['danmukuTop', 'danmukuTopClose', 'danmukuBottom', 'danmukuBottomClose'];
let exclude_v = ['.ops .like.on', '.ops .coin.on', '.coin-dialog-mask .coin-btn', '.bpx-player-volume-hint', '.bpx-player-electric-jump',
'.bpx-player-volume-hint-text', '.bpx-player-volume-hint-icon', '.bpx-player-hotkey-panel', '.bili-dialog-m', '.coin-dialog-mask',
'.bpx-player-hotkey-panel-close', '.bpx-player-info-close', '.bpx-player-info-container', '.info-line','.bpx-player-top-mask',
'.bili-dialog-m .bi-btn'];
for(let [k, v] of Object.entries(bb)){
//if(!!k && exclude_k.indexOf(k) !== -1) log(exclude_k.indexOf(k) +' - '+k+' - '+v);
if(!!k && exclude_k.indexOf(k) !== -1) continue;
//if(!!v && exclude_v.indexOf(v) === -1 && $(v).length === 0) log(exclude_v.indexOf(v) +' - '+$(v).length+' - '+v);
if(!!v && exclude_v.indexOf(v) === -1 && $(v).length === 0) return false;
}
return true;
}
//let a=$('.bpx-player-loading-panel-text').text().match(/(\d+).(\d+).\d+-\w+/);
//log(a[0]);
//let ver = get_ver_3x();
// let ver_3x = BILI_3_X;
//log(ver[2]);
//if(ver[2] === '13') ver_3x = BILI_3_X_13;
// bb_config.set_bb(BILI_3_X);
// log($('.bpx-player-loading-panel-text-row').text())
// show_bb_config();
// return;
//} else if(!bb_type && typeof target.className === 'string' && target.className === 'bpx-player-video-info-online' && $('.squirtle-setting-loop').length === 1) { //3.X pbp-tip
//} else if(is_run_3X_break === true && typeof target.className === 'string' && target.className === 'bpx-player-video-info-online' && $('.bpx-player-contextmenu.bpx-player-black').length === 1 && $('.bpx-player-dm-switch').length === 1 && $('.bpx-player-dm-root').length === 1) { //3.X bpx-player-dm-root
//} else if(!bb_type && typeof target.className === 'string' && $('.squirtle-setting-loop').length === 1) { //3.X bpx-player-dm-root
//clearTimeout(is_run_3X_break);
//is_run_3X_break = setTimeout(function() {
// .squirtle-video-fullscreen.squirtle-video-item full
// .squirtle-video-pagefullscreen.squirtle-video-item web
// .squirtle-video-widescreen.squirtle-video-item wide
// .like-info
// .coin-info
// .squirtle-volume-bar-wrap //.bpx-player-ctrl-volume-box
// .squirtle-volume-num //.bpx-player-ctrl-volume-number
// .squirtle-speed-select-list .squirtle-select-item.active playbackrate // .bpx-player-ctrl-playbackrate-menu-item.bpx-state-active
// .squirtle-speed-select-list .squirtle-select-item
// .squirtle-select-result.squirtle-speed-select-result // .bpx-player-ctrl-playbackrate-result
// .squirtle-setting-autoplay // .bpx-player-ctrl-setting-autoplay
// .squirtle-setting-loop // .bpx-player-ctrl-setting-loop
//// .squirtle-single-setting-other-choice.squirtle-lightoff // bpx-player-ctrl-setting-checkbox.bpx-player-ctrl-setting-lightoff
// .bpx-player-ctrl-btn .bpx-player-ctrl-quality
// eplist 选集
// playbackrate
// volume
// setting
// pip 画中画
// wide
// web
// full
// log("3.X加载完毕");
// ver = get_ver();
// bb_config.set_bb(ver);
// log(bb_type)
// if(ver === BILI_3_X_13) waitForTrue(isrun_3_x_13, ()=>run());
// else waitForTrue(isrun_3_x, ()=>run());
// function show_bb_config(sign,length=0){
// //for (let [k, v] of Object.entries(bb)) { !!v && v[0] === '.' && $(v).length !== length && log(v+' - '+$(v).length); }
// let arr=[];
// for (let [k, v] of Object.entries(bb)) { !!v && v[0] === '.' && $(v).length !== -1 && arr.push(v+' - '+$(v).length) && 0 && log(v+' - '+$(v).length); }
// for(let i=0; i<=10; i++){
// if(i<10){
// log(`--------------[${i}]----------------`);
// arr.forEach(function(v){
// +v.slice(-1) === i && v.slice(-2,-1) === ' ' && log(v);
// })
// } else if(i===10){
// log(`--------------[${i}+]----------------`);
// arr.forEach(function(v){
// $.isNumeric(parseInt(v.slice(-2,-1))) && log(v);
// })
// }
// }
// log('--------------End----------------')
// //log(arr)
// }
// function isrun_3_x() {
// let exclude_v = ['.like-info.active', '.coin-info.active', '.coin-dialog-mask .coin-btn', '.bpx-player-volume-hint',
// '.bpx-player-volume-hint-text', '.bpx-player-volume-hint-icon', '.bpx-player-hotkey-panel',
// '.bpx-player-hotkey-panel-close', '.bpx-player-info-close', '.bpx-player-info-container', '.info-line'];
// for(let [k, v] of Object.entries(bb)){
// if(!!v && exclude_v.indexOf(v) === -1 && $(v).length === 0) log(exclude_v.indexOf(v) +' - '+$(v).length+' - '+v);
// if(!!v && exclude_v.indexOf(v) === -1 && $(v).length === 0) return false;
// }
// return true;
// }
// function isrun_3_x_13() {
// let exclude_v = ['.ops .like.on', '.ops .coin.on', '.coin-dialog-mask .coin-btn', '.bpx-player-volume-hint',
// '.bpx-player-volume-hint-text', '.bpx-player-volume-hint-icon', '.bpx-player-hotkey-panel',
// '.bpx-player-hotkey-panel-close', '.bpx-player-info-close', '.bpx-player-info-container', '.info-line'];
// for(let [k, v] of Object.entries(bb)){
// if(!!v && exclude_v.indexOf(v) === -1 && $(v).length === 0) log(exclude_v.indexOf(v) +' - '+$(v).length+' - '+v);
// if(!!v && exclude_v.indexOf(v) === -1 && $(v).length === 0) return false;
// }
// return true;
// }
// function isrun_3_x_() {
// let exclude_v = ['.like-info.active', '.coin-info.active', '.coin-dialog-mask .coin-btn', '.bpx-player-volume-hint',
// '.bpx-player-volume-hint-text', '.bpx-player-volume-hint-icon', '.bpx-player-hotkey-panel',
// '.bpx-player-hotkey-panel-close', '.bpx-player-info-close', '.bpx-player-info-container', '.info-line'];
// for(let [k, v] of Object.entries(bb)){
// //if(!!v && exclude_v.indexOf(v) === -1 && $(v).length === 0) log(exclude_v.indexOf(v) +' - '+$(v).length+' - '+v);
// if(!!v && exclude_v.indexOf(v) === -1 && $(v).length === 0) return false;
// }
// return true;
// }
// function isrun_3_x_13_() {
// let exclude_v = ['.ops .like.on', '.ops .coin.on', '.coin-dialog-mask .coin-btn', '.bpx-player-volume-hint',
// '.bpx-player-volume-hint-text', '.bpx-player-volume-hint-icon', '.bpx-player-hotkey-panel',
// '.bpx-player-hotkey-panel-close', '.bpx-player-info-close', '.bpx-player-info-container', '.info-line'];
// for(let [k, v] of Object.entries(bb)){
// //if(!!v && exclude_v.indexOf(v) === -1 && $(v).length === 0) log(exclude_v.indexOf(v) +' - '+$(v).length+' - '+v);
// if(!!v && exclude_v.indexOf(v) === -1 && $(v).length === 0) return false;
// }
// return true;
// }
//isrun();
//setTimeout(()=>isrun_3_x_13(),1000);
//setTimeout(()=>isrun_3_x(),1000);
//setTimeout(()=>show_bb_config(),2000);
//show_bb_config();
//waitForTrue(isrun_3_x_13, ()=>isrun_3_x());
//}, 300);
//setTimeout(function(){isrun_3_x()},1000)
} else if(typeof target.className === 'string' && target.className==='bili-dyn-list__items'){
clearTimeout(is_content_load)
is_content_load = setTimeout(function() { log("2.X动态首页加载完毕"); run_content(); }, 200);
} else if(typeof target.className === 'string' && target.className === 'avatar' && target.baseURI.indexOf('www.bilibili.com/video/online.html') !== -1){
//log($('#hhh_online_list_style').length);
log("当前在线加载完毕");
run_preview();
// } else if(typeof target.className === 'string' && target.className==='history-list'){
// clearTimeout(is_history_break);
// is_history_break = setTimeout(function() { log("历史记录加载完毕"); run_history()}, 200);
} else if(typeof target.className === 'string' && window.location.href.match(/https?:\/\/www.bilibili.com\/?$/) && is_homepage_load){
log("推荐列表加载完毕");
is_homepage_load = false;
run_save_recommend_list();
run_add_online();
//clearTimeout(is_rcmd_box_break);
//is_rcmd_box_break = setTimeout(function() { log("推荐列表加载完毕"); run_recommend_box()}, 50);
// } else if(is_card_load === false && typeof target.className === 'string' && target.className === 'card' && $(target).find('.video-container .content').length){
// is_card_load = true;
// log("2.X动态首页加载完毕");
// run_card(); //搞笑,刚写完,2.70.7就有了
// removeMostViewedListener(config.getCheckboxSettingStatus('removeMostViewedListener'));
}
});
}).observe(document.body, {
childList: true,
subtree: true,
//attributes: true,
});
}
init();
}
}
hhh_lightoff_main.init();