// ==UserScript== // @name BiliBili Tags Blocker BiliBili标签屏蔽助手 // @namespace https://greasyfork.org/zh-CN/users/924205-xiao-xi // @version 0.8.2 // @description 眼不见为净,耳不听为清,心不想则静 // @author xiaoxi // @license MIT // @include *://www.bilibili.com/* // @include *://t.bilibili.com/* // @include *://search.bilibili.com/* // @icon https://www.google.com/s2/favicons?sz=64&domain=bilibili.com // @require https://cdn.bootcdn.net/ajax/libs/jquery/2.2.4/jquery.min.js // @require https://unpkg.com/ajax-hook@2.1.3/dist/ajaxhook.min.js // @require https://cdn.jsdelivr.net/npm/arrive@2.4.1/minified/arrive.min.js // @require https://greasyfork.org/scripts/407543-block-obj/code/Block_Obj.js?version=963893 // @grant GM_xmlhttpRequest // @grant unsafeWindow // @grant GM_getValue // @grant GM.getValue // @grant GM_setValue // @grant GM.setValue // @grant GM_setClipboard // @grant GM.setClipboard // @grant GM_registerMenuCommand // @grant GM_addValueChangeListener // @run-at document-start // @downloadURL none // ==/UserScript== // https://greasyfork.org/zh-CN/scripts/417760-checkjquery var BiliBiliTagsBlocker = { functionEnable: true, matchTitle: true, onlyChangeColorEnable: false, removeAllAD: false, removeSpecialEnable: false, removeNextVideo: false, homeCover: false, removeSearchTrend: false, removeSearchHistory: false, matchTopic: false, removeRightBanner: false, removeLive: false, removeBottomActivity: false, removeVideoPopupBox: false, removeEndVideo: false, blurMode: false, hiddenMode: false, fuzzyMatch: false, tagsArray: [], titlesArray: [], }; const BASIC_STYLE = ` .block_obj_checkbox_label { padding-left: 13px; } `; let blockObj = new Block_Obj('BiliBili_Tags_Blocker'); document.arrive("body", { fireOnAttributesModification: true, onceOnly: true, existing: true }, function() { initSettingUI() }); function initSettingUI(){ blockObj.init({ id: 'BiliBiliTagsBlocker', menu: 'Tags屏蔽设置', style: BASIC_STYLE, field: [ { id: 'version', label: 'v0.8.2', type: 's', }, { id: 'functionEnable', label: '启用屏蔽功能', title: '总开关', type: 'c', default: true, }, { id: 'onlyChangeColorEnable', label: '看看屏蔽了什么', title: '更改屏蔽视频的背景色', type: 'c', default: false, }, { label: '屏蔽模式', type: 's', }, { id: 'blurMode', label: '模糊模式', type: 'c', default: false, }, { id: 'hiddenMode', label: '隐藏模式', type: 'c', default: false, }, { id: 'fuzzyMatch', label: '模糊匹配', title: '例如视频标签‘原神2.8’会匹配到添加的标签的‘原神’', type: 'c', default: false, }, { id: 'matchTitle', label: '匹配视频标题', title: '。。。', type: 'c', default: true, }, { label: '首页设置', type: 's', }, { id: 'homeCover', label: '首页遮罩(暂时移除)', title: '加载图', type: 'c', default: false, }, { label: '搜索页设置', type: 's', }, { id: 'removeSearchTrend', label: '移除热搜栏', title: '推荐的什么jb', type: 'c', default: false, }, { id: 'removeSearchHistory', label: '匹配并移除历史词条', title: '。。。', type: 'c', default: false, }, { label: '动态页设置', type: 's', }, { id: 'matchTopic', label: '话题栏匹配标题关键字', title: '都是些什么jb', type: 'c', default: false, }, { label: '视频页设置', type: 's', }, { id: 'removeNextVideo', label: '移除接下来播放', title: '推荐的什么jb', type: 'c', default: false, }, { id: 'removeEndVideo', label: '移除结束后视频', title: '推荐的什么jb', type: 'c', default: false, }, { id: 'removeAllAD', label: '移除所有推广', title: '。。。', type: 'c', default: false, }, { id: 'removeVideoPopupBox', label: '移除视频内所有消息框', title: '例如关注,三连,投票,投票跳转其他视频', type: 'c', default: false, }, { label: 'Tag设置', type: 's', }, { id: 'tagInput', label: '', placeholder: ' 同时输入多个时以英文逗号分隔 ', type: 'i', list_id: 'tagsArray', }, { id: 'tagsArray', type: 'l', default: [], }, { label: '标题关键字 (例如‘原 神’标题,请输入‘原神’)', type: 's', }, { id: 'titleInput', label: '', placeholder: ' 同时输入多个时以英文逗号分隔 ', type: 'i', list_id: 'titlesArray', }, { id: 'titlesArray', type: 'l', default: [], }, ], events: { save: config => { BiliBiliTagsBlocker = config; }, change: config => { BiliBiliTagsBlocker = config; }, }, }) } //视频信息 var videoInfo = []; let href = location.href; let matchSearch = href.match(/search.bilibili/); let matchPopular = href.match(/popular/); let matchRank = href.match(/\/popular\/rank/); let matchPost = href.match(/t.bilibili/); let matchVideo = href.match(/video/); let matchHome = href.match(/bilibili.com/); //==============视频页================ function initVideoListener(){ var targetNode = $('.rec-list')[0]; var options = {childList: true}; function callback(mutationsList, observer) { if(mutationsList.length >= 1 && mutationsList[0].addedNodes.length!=0){ $.each(mutationsList, function(i, m){ initvideoInfo(m.addedNodes[0]) }); } } let mutationObserver = new MutationObserver(callback); let checkTarget = setInterval(function () { targetNode = $('.rec-list')[0]; if(targetNode != undefined && targetNode != null){ mutationObserver.observe(targetNode, options); clearInterval(checkTarget); if(BiliBiliTagsBlocker.removeAllAD){ if(BiliBiliTagsBlocker.onlyChangeColorEnable){ $($(targetNode).children("div")[0]).css({"background":"blue"}); } else { if(BiliBiliTagsBlocker.blurMode){ $($(targetNode).children("div")[0]).css({"filter":"blur(1rem)"}); } if(BiliBiliTagsBlocker.hiddenMode){ $($(targetNode).children("div")[0]).css({"display":"none"}); } } } $.each($(targetNode).children(".video-page-card"), function(i, m){ initvideoInfo(m) }); } }, 50); } function initvideoInfo(card){ let info = $(card).children(".card-box").children(".info").children("a") let href = $(info).attr("href"); let title = $(info).children('span').attr("title"); let videoCard = $(card); let bv = getBvcountber(href) $.ajax("https://api.bilibili.com/x/web-interface/view/detail/tag?bvid="+bv, { method: 'GET', headers: { "content-type": "application/json" }, async: true, success: function (tags) { let successed = false; if(!BiliBiliTagsBlocker.fuzzyMatch){ $.each(tags.data,function(i,t){ $.each(t,function(i,tag){ if(BiliBiliTagsBlocker.tagsArray.includes(t.tag_name) && !successed) {//includes 检测数组是否有某个值 if(BiliBiliTagsBlocker.onlyChangeColorEnable){ videoCard.css({"background":"blue"}) }else{ if(BiliBiliTagsBlocker.blurMode){ videoCard.css({"filter":"blur(1rem)"}); } if(BiliBiliTagsBlocker.hiddenMode){ videoCard.css({"display":"none"}); } } successed = true } }) }) } else{ $.each(tags.data, function(i1, tag){ $.each(BiliBiliTagsBlocker.tagsArray,function(i,t){ if(tag.tag_name.indexOf(t) != -1 && !successed){ if(BiliBiliTagsBlocker.onlyChangeColorEnable){ videoCard.css({"background":"blue"}) }else{ if(BiliBiliTagsBlocker.blurMode){ videoCard.css({"filter":"blur(1rem)"}); } if(BiliBiliTagsBlocker.hiddenMode){ videoCard.css({"display":"none"}); } } successed = true } }) }); } if(BiliBiliTagsBlocker.matchTitle && !successed){ $.each(BiliBiliTagsBlocker.titlesArray,function(i,t){ title = replaceAllSymbol(title) if(title.indexOf(t) != -1){ if(BiliBiliTagsBlocker.onlyChangeColorEnable){ videoCard.css({"background":"blue"}) }else{ if(BiliBiliTagsBlocker.blurMode){ videoCard.css({"filter":"blur(1rem)"}); } if(BiliBiliTagsBlocker.hiddenMode){ videoCard.css({"display":"none"}); } } successed = true } }) } }, }); } //接下来播放 function initNextVideoListener(){ $(document).arrive('#reco_list', {fireOnAttributesModification: true, onceOnly: true, existing: true},function(){ let next = $(this).children('.next-play') if (BiliBiliTagsBlocker.onlyChangeColorEnable) { next.css({"background":"blue"}) } else { next.css({"display":"none"}) } }) } //结束视频 function removeEndVideo(){ $(document).arrive('.bpx-player-ending-related', {fireOnAttributesModification: true, onceOnly: true, existing: true},function(){ $(this).remove(); $('.bpx-player-ending-functions').animate({ marginTop: 145, opacity: 'show' }, "slow"); }) } //右下角推广 function removeRightBanner(){ $(document).arrive('#right-bottom-banner', {fireOnAttributesModification: true, onceOnly: true, existing: true},function(){ $(this).css({"display":"none"}) }) } //右下角直播 function removeLive(){ $(document).arrive('#live_recommand_report', {fireOnAttributesModification: true, onceOnly: true, existing: true},function(){ $(this).css({"display":"none"}) }) } //视频下方活动 function removeBottomActivity(){ $(document).arrive('#activity_vote', {fireOnAttributesModification: true, onceOnly: true, existing: true},function(){ $(this).css({"display":"none"}) }) } //推广视频 function removeAdVideo(){ $(document).arrive('.video-ad-creative-card', {fireOnAttributesModification: true, onceOnly: true, existing: true},function(){ $(this).css({"display":"none"}) }) } //视频内消息框 function removeVideoPopupBox(){ $(document).arrive('.bpx-player-popup', {fireOnAttributesModification: true, onceOnly: false, existing: true},function(){ $(this).remove(); }) $(document).arrive('.bpx-player-follow', {fireOnAttributesModification: true, onceOnly: false, existing: true},function(){ $(this).remove(); }) //三连 $(document).arrive('.bpx-player-popup-guide-all', {fireOnAttributesModification: true, onceOnly: false, existing: true},function(){ $(this).remove(); }) //投票 $(document).arrive('.bpx-player-popup-vote', {fireOnAttributesModification: true, onceOnly: false, existing: true},function(){ $(this).remove(); }) //跳转其他视频 $(document).arrive('.bpx-player-link', {fireOnAttributesModification: true, onceOnly: false, existing: true},function(){ $(this).remove(); }) } //活动通知 $(document).arrive('.reply-notice', {fireOnAttributesModification: true, onceOnly: false, existing: true},function(){ $(this).css({"display":"none"}) }) //=======================热门页面========================= function initPopularVideoInfo(url){ videoInfo = [] let l1 = url.indexOf('pn='); let num = url.substring(l1+3,url.length) let checkTarget = setInterval(function () { let videoCardList = $(".video-card__content"); if(videoCardList != null && videoCardList != undefined){ if(num != 1){ if(BiliBiliTagsBlocker.blurMode){ videoCardList = videoCardList.slice((num-1)*20,videoCardList.length) } } videoCardList.each(function(i){ let href = $(this).children("a").attr("href"); let videoCard = $(this).parent(".video-card"); let title = $($(videoCard).children(".video-card__info")).children("p").attr("title"); title = replaceAllSymbol(title) let bvInfo = { bv : "BV"+getBvcountber(href), card : videoCard, title : title, } videoInfo.push(bvInfo); if(videoInfo.length > 0){ clearInterval(checkTarget); } }); } }, 50); let checkTarget1 = setInterval(function () { if(videoInfo.length > 0 && BiliBiliTagsBlocker.tagsArray != null && BiliBiliTagsBlocker.tagsArray != undefined && BiliBiliTagsBlocker.tagsArray.length >= 1){ $.each(videoInfo, function(i, v){ $.ajax("https://api.bilibili.com/x/web-interface/view/detail/tag?bvid="+v.bv, { method: 'GET', headers: { "content-type": "application/json" }, async: true, success: function (tags) { let successed = false; if(!BiliBiliTagsBlocker.fuzzyMatch){ $.each(tags.data,function(i,t){ $.each(t,function(i,tag){ if(BiliBiliTagsBlocker.tagsArray.includes(t.tag_name) && !successed) {//includes 检测数组是否有某个值 if(BiliBiliTagsBlocker.onlyChangeColorEnable){ v.card.css({"background":"blue"}) }else{ if(BiliBiliTagsBlocker.blurMode){ v.card.css({"filter":"blur(1rem)"}); } if(BiliBiliTagsBlocker.hiddenMode){ v.card.remove(); } } successed = true } }) }) } else{ $.each(tags.data, function(i1, tag){ $.each(BiliBiliTagsBlocker.tagsArray,function(i,t){ if(tag.tag_name.indexOf(t) != -1 && !successed){ if(BiliBiliTagsBlocker.onlyChangeColorEnable){ v.card.css({"background":"blue"}) }else{ if(BiliBiliTagsBlocker.blurMode){ v.card.css({"filter":"blur(1rem)"}); } if(BiliBiliTagsBlocker.hiddenMode){ v.card.remove(); } } successed = true } }) }); } if(BiliBiliTagsBlocker.matchTitle && !successed){ $.each(BiliBiliTagsBlocker.titlesArray,function(i,t){ if( v.title.indexOf(t) != -1){ if(BiliBiliTagsBlocker.onlyChangeColorEnable){ v.card.css({"background":"blue"}) }else{ if(BiliBiliTagsBlocker.blurMode){ v.card.css({"filter":"blur(1rem)"}); } if(BiliBiliTagsBlocker.hiddenMode){ v.card.remove(); } } successed = true } }) } }, }); }); clearInterval(checkTarget1); } }, 50); } //=======================排行榜========================= function initRankVideoInfo(){ let videoInfo = []; if(!location.href.match(/\/rank\/bangumi/) || !location.href.match(/\/rank\/guochan/) || !location.href.match(/\/rank\/documentary/) || !location.href.match(/\/rank\/movie/) || !location.href.match(/\/rank\/tv/) || !location.href.match(/\/rank\/variety/)){ let checkTarget = setInterval(function () { let videoCardList = $(".rank-item"); if(videoCardList != null && videoCardList != undefined){ videoCardList.each(function(i){ let info = $(this).children(".content").children(".info").children("a"); let href = $(info).attr("href"); let title = $(info).text(); title = replaceAllSymbol(title) let videoCard = $(this); let bvInfo = { bv : "BV"+getBvcountber(href), card : videoCard, title : title } videoInfo.push(bvInfo); if(videoInfo.length > 99){ clearInterval(checkTarget); } }); } }, 50); let checkTarget1 = setInterval(function () { if(videoInfo.length > 99 && BiliBiliTagsBlocker.tagsArray != null && BiliBiliTagsBlocker.tagsArray != undefined && BiliBiliTagsBlocker.tagsArray.length >= 1){ $.each(videoInfo, function(i, v){ $.ajax("https://api.bilibili.com/x/web-interface/view/detail/tag?bvid="+v.bv, { method: 'GET', headers: { "content-type": "application/json" }, async: true, success: function (tags) { let successed = false; if(!BiliBiliTagsBlocker.fuzzyMatch){ $.each(tags.data,function(i,t){ $.each(t,function(i,tag){ if(BiliBiliTagsBlocker.tagsArray.includes(t.tag_name) && !successed) {//includes 检测数组是否有某个值 if(BiliBiliTagsBlocker.onlyChangeColorEnable){ v.card.css({"background":"blue"}) }else{ if(BiliBiliTagsBlocker.blurMode){ v.card.css({"filter":"blur(1rem)"}); } if(BiliBiliTagsBlocker.hiddenMode){ v.card.remove(); } } successed = true } }) }) } else{ $.each(tags.data, function(i1, tag){ $.each(BiliBiliTagsBlocker.tagsArray,function(i,t){ if(tag.tag_name.indexOf(t) != -1 && !successed){ if(BiliBiliTagsBlocker.onlyChangeColorEnable){ v.card.css({"background":"blue"}) }else{ if(BiliBiliTagsBlocker.blurMode){ v.card.css({"filter":"blur(1rem)"}); } if(BiliBiliTagsBlocker.hiddenMode){ v.card.remove(); } } successed = true } }) }); } if(BiliBiliTagsBlocker.matchTitle && !successed){ $.each(BiliBiliTagsBlocker.titlesArray,function(i,t){ if(v.title.indexOf(t) != -1){ if(BiliBiliTagsBlocker.onlyChangeColorEnable){ v.card.css({"background":"blue"}) }else{ if(BiliBiliTagsBlocker.blurMode){ v.card.css({"filter":"blur(1rem)"}); } if(BiliBiliTagsBlocker.hiddenMode){ v.card.remove(); } } successed = true } }) } }, }); }); clearInterval(checkTarget1); } }, 50); } } //==================搜索页面======================= var videoInfo2 = [] //热搜栏 function removeTrend(){ $(document).arrive('.trending', {fireOnAttributesModification: true, onceOnly: false, existing: true},function(){ $(this).remove() }) } setTimeout(function(){ //搜索页游戏标签 $(document).arrive('.game-item', {fireOnAttributesModification: true, onceOnly: true, existing: true},function(){ $(this).remove() }) //搜索页活动标签 $(document).arrive('.activity-item', {fireOnAttributesModification: true, onceOnly: true, existing: true},function(){ $(this).remove() }) },800); //手动请求ajax function clickSearchAgain(){ //$('.page-item.active').children('button').click() //console.log($('.page-item.active').children('button')) $('div.search-button').click() } function initSearchVideoInfo(){ let checkTarget = setInterval(function () { if(responses.length >= 1){ let r = [] let checkTarget1 = setInterval(function () { if(r.length > 1 ){ setVideoInfo(r[0]) clearInterval(checkTarget1); } else { $.each(responses,function(i,t){ if(t.result_type == 'video'){ r.push(t) } }) } }, 50); clearInterval(checkTarget); } }, 50); } function setVideoInfo(tagList){ let checkTarget = function(){ return new Promise(function(resolve){ let videoList = $('.video-list.clearfix').children('.video-item.matrix') videoList.each(function(i,v){ let tags = tagList.data[i].tag.split(','); let typeName = tagList.data[i].typename; let title = $($($(v).children('.info')).children('.headline')).children('a').attr('title') title = replaceAllSymbol(title) let card = { tags: tags, typeName: typeName, card: $(v), title: title, }; videoInfo2.push(card) if(videoInfo2.length == videoList.length){ resolve(true); } }) }); }; checkTarget().then(function(resolve){ removeSearchVideo() }) } function removeSearchVideo(){ $.each(videoInfo2, function(i, v){ let successed = false; if(!BiliBiliTagsBlocker.fuzzyMatch){ $.each(v.tags, function(i1, tag){ if((BiliBiliTagsBlocker.tagsArray.includes(tag) || BiliBiliTagsBlocker.tagsArray.includes(v.typeName)) && !successed) {//includes 检测数组是否有某个值 if(BiliBiliTagsBlocker.onlyChangeColorEnable){ v.card.css({"background":"blue"}) }else{ if(BiliBiliTagsBlocker.blurMode){ v.card.css({"filter":"blur(1rem)"}); } if(BiliBiliTagsBlocker.hiddenMode){ v.card.css({"display":"none"}); } } successed = true } }); } else{ $.each(v.tags, function(i1, tag){ $.each(BiliBiliTagsBlocker.tagsArray,function(i,t){ if((tag.indexOf(t) != -1 || v.typeName.indexOf(t) != -1) && !successed){ if(BiliBiliTagsBlocker.onlyChangeColorEnable){ v.card.css({"background":"blue"}) }else{ if(BiliBiliTagsBlocker.blurMode){ v.card.css({"filter":"blur(1rem)"}); } if(BiliBiliTagsBlocker.hiddenMode){ v.card.remove(); } } successed = true } }) }); } if(BiliBiliTagsBlocker.matchTitle && !successed){ $.each(BiliBiliTagsBlocker.titlesArray,function(i,t){ if(v.title.indexOf(t) != -1){ if(BiliBiliTagsBlocker.onlyChangeColorEnable){ v.card.css({"background":"blue"}) }else{ if(BiliBiliTagsBlocker.blurMode){ v.card.css({"filter":"blur(1rem)"}); } if(BiliBiliTagsBlocker.hiddenMode){ v.card.remove(); } } successed = true } }) } }); videoInfo2 = [] } function removeUserVideo(){ let userVideoInfo = [] let videoListCard = $('.u-videos').children('.video-item') videoListCard.each(function(i,v){ let href = $(v).children('a').attr('href') let title = $($(v).children('.video-info')).children('a').text(); title = replaceAllSymbol(title) let videoCard = $(this); let bvInfo = { bv : 'BV'+getBvcountber(href), card : videoCard, title : title, } userVideoInfo.push(bvInfo) }) let checkTarget = setInterval(function () { if(userVideoInfo.length > 0 && BiliBiliTagsBlocker.tagsArray != null && BiliBiliTagsBlocker.tagsArray != undefined && BiliBiliTagsBlocker.tagsArray.length >= 1){ $.each(userVideoInfo, function(i, v){ $.ajax("https://api.bilibili.com/x/web-interface/view/detail/tag?bvid="+v.bv, { method: 'GET', headers: { "content-type": "application/json" }, async: true, success: function (tags) { let successed = false; $.each(tags.data,function(i,t){ $.each(t,function(i,tag){ if(BiliBiliTagsBlocker.tagsArray.includes(t.tag_name) && !successed) {//includes 检测数组是否有某个值 if(BiliBiliTagsBlocker.onlyChangeColorEnable){ v.card.css({"background":"blue"}) }else{ if(BiliBiliTagsBlocker.blurMode){ v.card.css({"filter":"blur(1rem)"}); } if(BiliBiliTagsBlocker.hiddenMode){ v.card.css({"display":"none"}); } } successed = true } }) }) if(BiliBiliTagsBlocker.matchTitle && !successed){ $.each(BiliBiliTagsBlocker.titlesArray,function(i,t){ if(v.title.indexOf(t) != -1){ if(BiliBiliTagsBlocker.onlyChangeColorEnable){ v.card.css({"background":"blue"}) }else{ if(BiliBiliTagsBlocker.blurMode){ v.card.css({"filter":"blur(1rem)"}); } if(BiliBiliTagsBlocker.hiddenMode){ v.card.remove(); } } successed = true } }) } }, }); }); clearInterval(checkTarget); } }, 50); } //==================搜索历史======================= function removeSearchHistory(){ $(document).arrive('.history-text', {fireOnAttributesModification: true, onceOnly: false, existing: true},function(){ let text = $(this).text(); if(BiliBiliTagsBlocker.tagsArray.includes(text)) {//includes 检测数组是否有某个值 if(BiliBiliTagsBlocker.onlyChangeColorEnable){ $(this).parents('.history-item').css({"background":"blue"}) }else{ if(BiliBiliTagsBlocker.blurMode){ $(this).parents('.history-item').css({"filter":"blur(1rem)"}); } if(BiliBiliTagsBlocker.hiddenMode){ $(this).parents('.history-item').remove(); } } } }) } //==================动态======================= function initPostVideoInfo(){ videoInfo = [] let postCardList = $(".bili-dyn-list__items").children(".bili-dyn-list__item"); $(postCardList).each(function(i){ let info = $(this).children(".bili-dyn-item").children(".bili-dyn-item__main").children(".bili-dyn-item__body").children(".bili-dyn-content").children(".bili-dyn-content__orig").children(".bili-dyn-content__orig__major").children("a"); let bv = getBvcountber($(info).attr("href")); let title = $(info).children('.bili-dyn-card-video__body'); if (title.length == 1){ title = title.children('.bili-dyn-card-video__title').text(); title = replaceAllSymbol(title) } else{ title = null; } let videoCard = $(this).children(".bili-dyn-item").children(".bili-dyn-item__main"); if(bv != undefined){ let bvInfo = { bv : "BV"+bv, card : $(this), color : videoCard, title : title, } videoInfo.push(bvInfo); } }); let checkTarget = setInterval(function () { if(videoInfo.length > 0 && BiliBiliTagsBlocker.tagsArray != null && BiliBiliTagsBlocker.tagsArray != undefined && BiliBiliTagsBlocker.tagsArray.length >= 1){ $.each(videoInfo, function(i, v){ $.ajax("https://api.bilibili.com/x/web-interface/view/detail/tag?bvid="+v.bv, { method: 'GET', headers: { "content-type": "application/json" }, async: true, success: function (tags) { let successed = false; if(!BiliBiliTagsBlocker.fuzzyMatch){ $.each(tags.data,function(i,t){ $.each(t,function(i,tag){ if(BiliBiliTagsBlocker.tagsArray.includes(t.tag_name) && !successed) {//includes 检测数组是否有某个值 if(BiliBiliTagsBlocker.onlyChangeColorEnable){ v.color.css({"background":"blue"}) }else{ if(BiliBiliTagsBlocker.blurMode){ v.color.css({"filter":"blur(1rem)"}); } if(BiliBiliTagsBlocker.hiddenMode){ v.color.css({"display":"none"}); } } successed = true } }) }) } else{ $.each(tags.data, function(i1, tag){ $.each(BiliBiliTagsBlocker.tagsArray,function(i,t){ if(tag.tag_name.indexOf(t) != -1 && !successed){ if(BiliBiliTagsBlocker.onlyChangeColorEnable){ v.color.css({"background":"blue"}) }else{ if(BiliBiliTagsBlocker.blurMode){ v.color.css({"filter":"blur(1rem)"}); } if(BiliBiliTagsBlocker.hiddenMode){ v.color.css({"display":"none"}); } } successed = true } }) }); } if(BiliBiliTagsBlocker.matchTitle && !successed){ $.each(BiliBiliTagsBlocker.titlesArray,function(i,t){ if(v.title.indexOf(t) != -1){ if(BiliBiliTagsBlocker.onlyChangeColorEnable){ v.color.css({"background":"blue"}) }else{ if(BiliBiliTagsBlocker.blurMode){ v.color.css({"filter":"blur(1rem)"}); } if(BiliBiliTagsBlocker.hiddenMode){ v.color.css({"display":"none"}); } } successed = true } }) } }, }); }); clearInterval(checkTarget); } }, 50); } function matchTopic(){ $(document).arrive('.relevant-topic__title', {fireOnAttributesModification: true, onceOnly: true, existing: true},function(){ let parent = $($(this).parents('.relevant-topic')); let title = $(this).text(); let successed = false; $.each(BiliBiliTagsBlocker.titlesArray,function(i,t){ if(title.indexOf(t) != -1 && !successed){ if(BiliBiliTagsBlocker.onlyChangeColorEnable){ parent.css({"background":"blue"}) }else{ if(BiliBiliTagsBlocker.blurMode){ parent.css({"filter":"blur(1rem)"}); } if(BiliBiliTagsBlocker.hiddenMode){ parent.css({"display":"none"}); } } successed = true; } }) }) } //==================首页======================= function clickChangeAgain(){ //$('.page-item.active').children('button').click() //console.log($('.page-item.active').children('button')) //$('div.change-btn').click() $(document).arrive('div.change-btn', {fireOnAttributesModification: true, onceOnly: true, existing: true},function(){ setTimeout(function(){ $('div.change-btn').click() },120); }) } function initHomeVideoInfo(videoList){ videoInfo = [] let insertList1 = [] if(!BiliBiliTagsBlocker.onlyChangeColorEnable){ setTimeout(function(){ $($('.rcmd-box')[0]).css({"justify-content":"flex-start"}) },100); } let videoCardList = $('.rcmd-box').children(); videoCardList.each(function(i){ if(i <= 9){ let href = $(this).children(".info-box").children("a").attr("href"); let videoCard = $(this); let videoCardTitle = $(this).children(".info-box").children("a").children("img").attr("alt") videoCardTitle = replaceAllSymbol(videoCardTitle) let bvInfo = { bv : 'BV'+getBvcountber(href), card : videoCard, title : videoCardTitle } videoInfo.push(bvInfo); } }); let checkTarget = setInterval(function () { if(videoInfo.length > 0 && BiliBiliTagsBlocker.tagsArray != null && BiliBiliTagsBlocker.tagsArray != undefined && BiliBiliTagsBlocker.tagsArray.length >= 1){ $.each(videoInfo, function(i, v){ $.ajax("https://api.bilibili.com/x/web-interface/view/detail/tag?bvid="+v.bv, { method: 'GET', headers: { "content-type": "application/json" }, async: true, success: function (tags) { let successed = false; if(!BiliBiliTagsBlocker.fuzzyMatch){ $.each(tags.data,function(i,t){ if(BiliBiliTagsBlocker.tagsArray.includes(t.tag_name) && !successed) {//includes 检测数组是否有某个值 if(BiliBiliTagsBlocker.onlyChangeColorEnable){ v.card.css({"background":"blue"}) }else{ if(BiliBiliTagsBlocker.blurMode){ v.card.css({"filter":"blur(1rem)"}); } if(BiliBiliTagsBlocker.hiddenMode){ v.card.css({"display":"none"}); } } successed = true } }) } else{ $.each(tags.data, function(i1, tag){ $.each(BiliBiliTagsBlocker.tagsArray,function(i,t){ if(tag.tag_name.indexOf(t) != -1 && !successed){ if(BiliBiliTagsBlocker.onlyChangeColorEnable){ v.card.css({"background":"blue"}) }else{ if(BiliBiliTagsBlocker.blurMode){ v.card.css({"filter":"blur(1rem)"}); } if(BiliBiliTagsBlocker.hiddenMode){ v.card.css({"display":"none"}); } } successed = true } }) }); } if(BiliBiliTagsBlocker.matchTitle && !successed){ $.each(BiliBiliTagsBlocker.titlesArray,function(i,t){ if(v.title.indexOf(t) != -1){ if(BiliBiliTagsBlocker.onlyChangeColorEnable){ v.color.css({"background":"blue"}) }else{ if(BiliBiliTagsBlocker.blurMode){ v.color.css({"filter":"blur(1rem)"}); } if(BiliBiliTagsBlocker.hiddenMode){ v.color.css({"display":"none"}); } } successed = true } }) } if(!successed && !BiliBiliTagsBlocker.onlyChangeColorEnable){ insertList1.push(v) $($('.rcmd-box')[0]).prepend(v.card) } }, }); }); clearInterval(checkTarget); } }, 50); if(!BiliBiliTagsBlocker.onlyChangeColorEnable){ let zoom = detectZoom() let insertList2 = [] let reverse = function(){ return new Promise(function(resolve){ let checkTarget1 = setInterval(function () { if(insertList1.length > 0){ $.each(insertList1, function(i, v){ insertList2.push(insertList1[insertList1.length-1-i]) }) clearInterval(checkTarget1); resolve(true); } }, 350); }); } reverse().then(function(data){ $.each(insertList2, function(i, v){ if(zoom < 100){ if(0 != i && 5 != i){ v.card.css({"margin-left":"10px"}) } } if(zoom >= 100 && zoom <= 135){ if(0 != i && 5 != i){ v.card.css({"margin-left":"10px"}) } } if(zoom >= 140 && zoom <= 150){ if(0 != i && 4 != i){ v.card.css({"margin-left":"10px"}) } } if(zoom > 150){ if(0 != i && 3 != i){ v.card.css({"margin-left":"10px"}) } } }) }) } } //==================动态导航栏==================== function initNavbarListener(){ var targetNode = $('.video-list')[0]; var options = {childList: true,attributes :true}; function callback(mutationsList, observer) { if(mutationsList.length >= 1 && mutationsList[0].addedNodes.length!=0){ $.each(mutationsList, function(i, m){ initNavbarVideoInfo(m.addedNodes[0]) }); } } let mutationObserver = new MutationObserver(callback); let checkTarget = setInterval(function () { if(targetNode != undefined && targetNode != null){ mutationObserver.observe(targetNode, options); clearInterval(checkTarget); $.each($(targetNode).children(".list-item"), function(i, m){ initNavbarVideoInfo(m) //console.log(m) }); } }, 50); } function initNavbarVideoInfo(card){ let href = $(card).children(".main-container").children("a").attr("href"); let title = $(card).children(".main-container").children(".center-box").children("a").attr('title') title = replaceAllSymbol(title) let videoCard = $(card); let bv = getBvcountber(href) $.ajax("https://api.bilibili.com/x/web-interface/view/detail/tag?bvid="+bv, { method: 'GET', headers: { "content-type": "application/json" }, async: true, success: function (tags) { let successed = false; if(!BiliBiliTagsBlocker.fuzzyMatch){ $.each(tags.data,function(i,t){ if(BiliBiliTagsBlocker.tagsArray.includes(t.tag_name) && !successed) {//includes 检测数组是否有某个值 if(BiliBiliTagsBlocker.onlyChangeColorEnable){ videoCard.css({"background":"blue"}) }else{ if(BiliBiliTagsBlocker.blurMode){ videoCard.css({"filter":"blur(1rem)"}); } if(BiliBiliTagsBlocker.hiddenMode){ videoCard.remove(); } } successed = true } }) } else{ $.each(tags.data, function(i1, tag){ $.each(BiliBiliTagsBlocker.tagsArray,function(i,t){ if(tag.tag_name.indexOf(t) != -1 && !successed){ if(BiliBiliTagsBlocker.onlyChangeColorEnable){ videoCard.css({"background":"blue"}) }else{ if(BiliBiliTagsBlocker.blurMode){ videoCard.css({"filter":"blur(1rem)"}); } if(BiliBiliTagsBlocker.hiddenMode){ videoCard.remove(); } } successed = true } }) }); } if(BiliBiliTagsBlocker.matchTitle && !successed){ $.each(BiliBiliTagsBlocker.titlesArray,function(i,t){ if(title.indexOf(t) != -1){ if(BiliBiliTagsBlocker.onlyChangeColorEnable){ videoCard.css({"background":"blue"}) }else{ if(BiliBiliTagsBlocker.blurMode){ videoCard.css({"filter":"blur(1rem)"}); } if(BiliBiliTagsBlocker.hiddenMode){ videoCard.remove(); } } successed = true } }) } }, }); } //==================搜索栏排序================== //当前页 + 额外的页数,例如当前页为1,额外页数为4,筛选范围则为1~5页,之后则在第6页筛选 //额外的页数 var pageCount = 4; function addSearchOption(){ $(document).arrive('.filter-type.clearfix.order', {fireOnAttributesModification: true, onceOnly: false, existing: true},function(){ let op1 = '
  • 一周之内
  • ' let op2 = '
  • 一月之内
  • ' let op3 = '
  • 一年之内
  • ' $(this).append(op1); $(this).append(op2); $(this).append(op3); let week = $('#filter-item-week'); let month = $('#filter-item-month'); let year = $('#filter-item-year'); week.click(function(){ week.addClass('active') month.removeClass('active') year.removeClass('active') getOtherPageData(604800) }); month.click(function(){ month.addClass('active') week.removeClass('active') year.removeClass('active') getOtherPageData(2678400) }); year.click(function(){ year.addClass('active') week.removeClass('active') month.removeClass('active') getOtherPageData(31536000) }); }) } function getOtherPageData(date){ let prefix = url.indexOf('&page='); let suffix = url.indexOf('&order'); let current = url.substring(prefix+6,suffix) prefix = url.indexOf('/search'); let newUrl = url.substring(prefix+7,url.length) let currentPageData = responses; let otherPageData = []; newUrl = url.replace('&page='+current,'&page='+(Number(current)+1)) let getData = function(){ let count = 0; return new Promise(function(resolve){ for (var i=0;i rangeDate && !bvidList.includes(v.bvid)){ list.push(v) bvidList.push(v.bvid) } }); $.each(otherPageData, function(i, v){ if(v.senddate > rangeDate && !bvidList.includes(v.bvid)){ list.push(v) bvidList.push(v.bvid) } if(i == otherPageData.length-1){ resolve(true); } }); }); }; sortByRange().then(function(data){ for (var i=0;i
    "+v.duration+"
    "+v.typename+""+v.title+"
    "+v.description+"
    "+v.play+" "+v.danmaku+" "+v.senddate2+" "+v.author+"
  • " cardList.append(template); if(i == list.length-1){ let data1 = { data: list, result_type: 'video' }; setVideoInfo(data1) } }); }) } function formatData(data){ //01:22:33 let minIndex = data.duration.lastIndexOf(':') //在一小时内 if(minIndex < 3){ // 在十分钟内 if(minIndex == 1){ // 小于10秒 if(data.duration.length < 4){ let min = "0"+data.duration.substring(0,minIndex+1) let second = "0"+data.duration.substring(minIndex+1,data.duration.length) data.duration = min+second } else{ let min = "0"+data.duration.substring(0,minIndex+1) let second = data.duration.substring(minIndex+1,data.duration.length) data.duration = min+second } } // 在大于十分钟 if(minIndex == 2){ // 小于10秒 if(data.duration.length < 5){ let min = data.duration.substring(0,minIndex+1); let second = "0"+data.duration.substring(minIndex+1,data.duration.length); data.duration = min+second } } } if(data.play>=10000){ data.play = formatDecimal(Number(data.play)/10000, 1)+'万' } data.senddate2 = date('Y-m-d',data.senddate); return data } function formatDecimal(num, decimal) { num = num.toString() let index = num.indexOf('.') if (index !== -1) { num = num.substring(0, decimal + index + 1) } else { num = num.substring(0) } return parseFloat(num).toFixed(decimal) } /** * 和PHP一样的时间戳格式化函数 * @param {string} format 格式 * @param {int} timestamp 要格式化的时间 默认为当前时间 * @return {string} 格式化的时间字符串 */ function date(format, timestamp){ var a, jsdate=((timestamp) ? new Date(timestamp*1000) : new Date()); var pad = function(n, c){ if((n = n + "").length < c){ return new Array(++c - n.length).join("0") + n; } else { return n; } }; var txt_weekdays = ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"]; var txt_ordin = {1:"st", 2:"nd", 3:"rd", 21:"st", 22:"nd", 23:"rd", 31:"st"}; var txt_months = ["", "January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"]; var f = { // Day d: function(){return pad(f.j(), 2)}, D: function(){return f.l().substr(0,3)}, j: function(){return jsdate.getDate()}, l: function(){return txt_weekdays[f.w()]}, N: function(){return f.w() + 1}, S: function(){return txt_ordin[f.j()] ? txt_ordin[f.j()] : 'th'}, w: function(){return jsdate.getDay()}, z: function(){return (jsdate - new Date(jsdate.getFullYear() + "/1/1")) / 864e5 >> 0}, // Week W: function(){ var a = f.z(), b = 364 + f.L() - a; var nd2, nd = (new Date(jsdate.getFullYear() + "/1/1").getDay() || 7) - 1; if(b <= 2 && ((jsdate.getDay() || 7) - 1) <= 2 - b){ return 1; } else{ if(a <= 2 && nd >= 4 && a >= (6 - nd)){ nd2 = new Date(jsdate.getFullYear() - 1 + "/12/31"); return date("W", Math.round(nd2.getTime()/1000)); } else{ return (1 + (nd <= 3 ? ((a + nd) / 7) : (a - (7 - nd)) / 7) >> 0); } } }, // Month F: function(){return txt_months[f.n()]}, m: function(){return pad(f.n(), 2)}, M: function(){return f.F().substr(0,3)}, n: function(){return jsdate.getMonth() + 1}, t: function(){ var n; if( (n = jsdate.getMonth() + 1) == 2 ){ return 28 + f.L(); } else{ if( n & 1 && n < 8 || !(n & 1) && n > 7 ){ return 31; } else{ return 30; } } }, // Year L: function(){var y = f.Y();return (!(y & 3) && (y % 1e2 || !(y % 4e2))) ? 1 : 0}, //o not supported yet Y: function(){return jsdate.getFullYear()}, y: function(){return (jsdate.getFullYear() + "").slice(2)}, // Time a: function(){return jsdate.getHours() > 11 ? "pm" : "am"}, A: function(){return f.a().toUpperCase()}, B: function(){ // peter paul koch: var off = (jsdate.getTimezoneOffset() + 60)*60; var theSeconds = (jsdate.getHours() * 3600) + (jsdate.getMinutes() * 60) + jsdate.getSeconds() + off; var beat = Math.floor(theSeconds/86.4); if (beat > 1000) beat -= 1000; if (beat < 0) beat += 1000; if ((String(beat)).length == 1) beat = "00"+beat; if ((String(beat)).length == 2) beat = "0"+beat; return beat; }, g: function(){return jsdate.getHours() % 12 || 12}, G: function(){return jsdate.getHours()}, h: function(){return pad(f.g(), 2)}, H: function(){return pad(jsdate.getHours(), 2)}, i: function(){return pad(jsdate.getMinutes(), 2)}, s: function(){return pad(jsdate.getSeconds(), 2)}, //u not supported yet // Timezone //e not supported yet //I not supported yet O: function(){ var t = pad(Math.abs(jsdate.getTimezoneOffset()/60*100), 4); if (jsdate.getTimezoneOffset() > 0) t = "-" + t; else t = "+" + t; return t; }, P: function(){var O = f.O();return (O.substr(0, 3) + ":" + O.substr(3, 2))}, //T not supported yet //Z not supported yet // Full Date/Time c: function(){return f.Y() + "-" + f.m() + "-" + f.d() + "T" + f.h() + ":" + f.i() + ":" + f.s() + f.P()}, //r not supported yet U: function(){return Math.round(jsdate.getTime()/1000)} }; var exp = /[\\]?([a-zA-Z])/g; return format.replace(exp, function(t, s){ let ret = null; if( t!=s ){ // escaped ret = s; } else if( f[s] ){ // a date function exists ret = f[s](); } else{ // nothing special ret = s; } return ret; }); } //==================other==================== //重设界面 //0,收起 1,展开 var buttonState = 0 var buttonState2 = 0 var url = null; var responses = [] function reSetUI(){ //$('.block_obj_wrap_div').css({"width":"auto"}) //$('#blockObj_BiliBiliTagsBlocker_mainFieldset').css({"background-color":""}) $($('#blockObj_BiliBiliTagsBlocker_ulNode')[0]).append('取消'); let parent = $($('#blockObj_BiliBiliTagsBlocker_version')[0]).parent() parent.css("display","flex") let countKeys = BiliBiliTagsBlocker.tagsArray.length+BiliBiliTagsBlocker.titlesArray.length parent.append('当前共屏蔽'+ countKeys +'个标签') let ver = $($('#blockObj_BiliBiliTagsBlocker_version')[0]) ver.css("width","73%") let expand = $($(".block_obj_input_btn")[4]) let targetNode = $($('.block_obj_list_textarea_div')[0]); let checkTarget = setInterval(function () { expand = $($(".block_obj_input_btn")[4]) if(targetNode != undefined && targetNode != null){ targetNode.css('max-height','69') if(expand.attr("title") == '展开列表'){ expand.click(function(){ if(buttonState == 0){ targetNode.animate({ maxHeight: 300, opacity: 'show' }, "slow"); buttonState = 1 } else if(buttonState == 1){ targetNode.animate({ maxHeight: 69, opacity: 'show' }, "slow"); buttonState = 0 } }); } clearInterval(checkTarget); } }, 50); let expand2 = $($(".block_obj_input_btn")[9]) let targetNode2 = $($('.block_obj_list_textarea_div')[1]); let checkTarget2 = setInterval(function () { expand2 = $($(".block_obj_input_btn")[9]) if(targetNode2 != undefined && targetNode2 != null){ targetNode2.css('max-height','69') if(expand2.attr("title") == '展开列表'){ expand2.click(function(){ if(buttonState2 == 0){ targetNode2.animate({ maxHeight: 300, opacity: 'show' }, "slow"); buttonState2 = 1 } else if(buttonState2 == 1){ targetNode2.animate({ maxHeight: 69, opacity: 'show' }, "slow"); buttonState2 = 0 } }); } clearInterval(checkTarget2); } }, 50); let cancel2 = $($("#cancel2")[0]) $($('.block_obj_button')[2]).remove() cancel2.click(function(){ let main = $($("#blockObj_BiliBiliTagsBlocker_wrapDiv")[0]) main.removeClass('block_obj_wrap_div block_obj_show_wrap') main.addClass('block_obj_wrap_div block_obj_hidden_wrap') }); if (window.parent == window) { // 当前页面不在iframe中 } else { // 当前页面在iframe或者frameset中 $("#blockObj_BiliBiliTagsBlocker_expandSpan").animate({ opacity: 'hide' }, 200); } } if (window.parent == window) { // 当前页面不在iframe中 ajaxHook(); } else { // 当前页面在iframe或者frameset中 } function ajaxHook() { ah.proxy( { onResponse: (response, handler) => { //搜索页 例/all?keyword=原神 if (!response.config.url.includes('/web-interface/search/default') && !response.config.url.includes('/web-interface/search/square') && response.config.url.includes('/web-interface/search')){ responses = [] let week = $('#filter-item-week'); let month = $('#filter-item-month'); let year = $('#filter-item-year'); let data = JSON.parse(response.response).data if(data.result.length == 11){ responses.push(data.result[data.result.length-1]) url = response.config.url } if(data.result.length == 20){ let data1 = { data: data.result, result_type: 'video' } responses.push(data1) url = response.config.url } if (week.hasClass("active") ){ getOtherPageData(604800) } else if (month.hasClass("active") ){ getOtherPageData(2678400) } else if (year.hasClass("active") ){ getOtherPageData(31536000) } else { initSearchVideoInfo() } setTimeout(function(){ removeUserVideo() },100); } //热门页面 if (response.config.url.includes('/web-interface/popular')){ initPopularVideoInfo(response.config.url) } //排行榜 if (response.config.url.includes('rank')){ let data = JSON.parse(response.response); initRankVideoInfo() } //首页 if (response.config.url.includes('web-interface/index/top/rcmd')){ let data = JSON.parse(response.response).data; setTimeout(function(){ initHomeVideoInfo(data.item) },50); } //动态 if (response.config.url.includes('web-dynamic/v1/feed/all')){ setTimeout(function(){ initPostVideoInfo() },50); } handler.next(response); }, }, unsafeWindow ); } //移除所有符号 var symbols = [' ','♂','【','】'] function replaceAllSymbol(title) { $.each(symbols,function(i,k){ if(title.indexOf(k) != -1){ title = title.replaceAll(k,'') } }) return title; } //通过url获得BV号 function getBvcountber(video_link) { let bvcount = ''; try { bvcount = /\/video\/(?:av|bv)(\w+)/i.exec(video_link)[1]; } catch (e) { bvcount = null; } return bvcount; } //获取当前缩放比例 function detectZoom() { var ratio = 0, screen = window.screen, ua = navigator.userAgent.toLowerCase(); if (window.devicePixelRatio !== undefined) { ratio = window.devicePixelRatio; } else if (~ua.indexOf('msie')) { if (screen.deviceXDPI && screen.logicalXDPI) { ratio = screen.deviceXDPI / screen.logicalXDPI; } } else if (window.outerWidth !== undefined && window.innerWidth !== undefined) { ratio = window.outerWidth / window.innerWidth; } if (ratio) { ratio = Math.round(ratio * 100); } return ratio; } //检查jQuery var checkJQuery = function () { let jqueryCdns = [ 'http://code.jquery.com/jquery-2.1.4.min.js', 'https://ajax.aspnetcdn.com/ajax/jquery/jquery-2.1.4.min.js', 'https://ajax.googleapis.com/ajax/libs/jquery/2.1.4/jquery.min.js', 'https://cdn.staticfile.org/jquery/2.1.4/jquery.min.js', 'https://apps.bdimg.com/libs/jquery/2.1.4/jquery.min.js', ]; function isJQueryValid() { try { let wd = unsafeWindow; if (wd.jQuery && !wd.$) { wd.$ = wd.jQuery; } $(); return true; } catch (exception) { return false; } } function insertJQuery(url) { setTimeout(function(){ let checkJQuery = setInterval(function () { if(document == undefined && document != null && document.createElement('script') == undefined && document.createElement('script') != null){ let script = document.createElement('script'); script.src = url; document.head.appendChild(script); return script; clearInterval(checkJQuery); } }, 100); },500); } function converProtocolIfNeeded(url) { let isHttps = location.href.indexOf('https://') != -1; let urlIsHttps = url.indexOf('https://') != -1; return script; if (isHttps && !urlIsHttps) { return url.replace('http://', 'https://'); } else if (!isHttps && urlIsHttps) { return url.replace('https://', 'http://'); } return url; } function waitAndCheckJQuery(cdnIndex, resolve) { if (cdnIndex >= jqueryCdns.length) { iLog.e('无法加载 JQuery,正在退出。'); resolve(false); return; } let url = converProtocolIfNeeded(jqueryCdns[cdnIndex]); iLog.i('尝试第 ' + (cdnIndex + 1) + ' 个 JQuery CDN:' + url + '。'); let script = insertJQuery(url); setTimeout(function () { if (isJQueryValid()) { iLog.i('已加载 JQuery。'); resolve(true); } else { iLog.w('无法访问。'); script.remove(); waitAndCheckJQuery(cdnIndex + 1, resolve); } }, 100); } return new Promise(function (resolve) { if (isJQueryValid()) { iLog.i('已加载 jQuery。'); resolve(true); } else { iLog.i('未发现 JQuery,尝试加载。'); waitAndCheckJQuery(0, resolve); } }); } let checkSetting = setInterval(function () { BiliBiliTagsBlocker = blockObj.getConfig(); if(BiliBiliTagsBlocker.tagsArray != null){ clearInterval(checkSetting); } }, 500); function ILog() { this.prefix = ''; this.v = function (value) { if (level <= this.LogLevel.Verbose) { console.log(this.prefix + value); } } this.i = function (info) { if (level <= this.LogLevel.Info) { console.info(this.prefix + info); } } this.w = function (warning) { if (level <= this.LogLevel.Warning) { console.warn(this.prefix + warning); } } this.e = function (error) { if (level <= this.LogLevel.Error) { console.error(this.prefix + error); } } this.d = function (element) { if (level <= this.LogLevel.Verbose) { console.log(element); } } this.setLogLevel = function (logLevel) { level = logLevel; } this.LogLevel = { Verbose: 0, Info: 1, Warning: 2, Error: 3, }; let level = this.LogLevel.Verbose; } let inChecking = false; let matchSuccess = false; let jqItv = setInterval(function () { if (inChecking) { return; } inChecking = true; checkJQuery().then(function (isLoad) { if (isLoad) { if(BiliBiliTagsBlocker.functionEnable){ console.log("已启用Tags屏蔽"); initNavbarListener(); if(BiliBiliTagsBlocker.removeSearchTrend){ removeTrend(); } }else{ console.log("已关闭Tags屏蔽"); } if (matchSearch && BiliBiliTagsBlocker.functionEnable && !matchSuccess) { matchSuccess = true; addSearchOption() if(BiliBiliTagsBlocker.removeSearchHistory){ removeSearchHistory(); } clickSearchAgain(); } if (matchVideo && BiliBiliTagsBlocker.functionEnable && !matchSuccess) { matchSuccess = true; initVideoListener() if(BiliBiliTagsBlocker.removeNextVideo){ initNextVideoListener() } if(BiliBiliTagsBlocker.removeEndVideo){ removeEndVideo() } if(BiliBiliTagsBlocker.removeAllAD){ removeRightBanner() removeLive() removeBottomActivity() } if(BiliBiliTagsBlocker.removeVideoPopupBox){ removeVideoPopupBox() } removeAdVideo() } if (matchRank && BiliBiliTagsBlocker.functionEnable && !matchSuccess) { matchSuccess = true; initRankVideoInfo() } if (matchPost && BiliBiliTagsBlocker.functionEnable && !matchSuccess) { matchSuccess = true; if(BiliBiliTagsBlocker.matchTopic){ matchTopic() } } if (matchHome && BiliBiliTagsBlocker.functionEnable && !matchSuccess) { matchSuccess = true; clickChangeAgain() } if(BiliBiliTagsBlocker.functionEnable != undefined){ reSetUI() clearInterval(jqItv); } } inChecking = false; }); }, 500); var iLog = new ILog();