Bilibili搜索页面筛选增强脚本,增加今年、本月、当日发布筛选,可配合B站原有的综合排序、最多点击、最多弹幕、最多收藏使用。
< Rückmeldungen auf Bilibili筛选增强
修改了下样式,更贴合B站风格const button1 = document.createElement("button");//button1.removeAttribute("style");button1.textContent = "今年发布";button1.className = "vui_button vui_button--tab mr_sm";button1.setAttribute("data-v-d394b564", "");//button1.style.fontWeight = "bold";button1.onclick = function() { button1.className = "vui_button vui_button--tab vui_button--active mr_sm"; button1.style.color = "#00aeec"; button2.className = "vui_button vui_button--tab mr_sm"; button2.style.color = "#61666d"; button3.className = "vui_button vui_button--tab mr_sm"; button3.style.color = "#61666d"; button4.className = "vui_button vui_button--tab mr_sm"; button4.style.color = "#61666d"; mFilter(date => reg_PreviousYear.test(date));};const nav = document.getElementsByClassName("search-condition-row")[0];nav.appendChild(button1);const button2 = document.createElement("button");button2.textContent = "本月发布";button2.className = "vui_button vui_button--tab mr_sm";button2.setAttribute("data-v-d394b564", "");//.style.fontWeight = "bold";button2.onclick = function (){ button1.className = "vui_button vui_button--tab mr_sm"; button1.style.color = "#61666d"; button2.className = "vui_button vui_button--tab vui_button--active mr_sm"; button2.style.color = "#00aeec"; button3.className = "vui_button vui_button--tab mr_sm"; button3.style.color = "#61666d"; button4.className = "vui_button vui_button--tab mr_sm"; button4.style.color = "#61666d"; mFilter((date) => !(reg_ThisMonth.test(date) || date.indexOf("昨天") !== -1 || date.indexOf("小时前") !== -1));};nav.appendChild(button2);const button3 = document.createElement("button");button3.textContent = "今日发布";button3.className = "vui_button vui_button--tab mr_sm";button3.setAttribute("data-v-d394b564", "");//button3.style.fontWeight = "bold";button3.onclick = function (){ button1.className = "vui_button vui_button--tab mr_sm"; button1.style.color = "#61666d"; button2.className = "vui_button vui_button--tab mr_sm"; button2.style.color = "#61666d"; button3.className = "vui_button vui_button--tab vui_button--active mr_sm"; button3.style.color = "#00aeec"; button4.className = "vui_button vui_button--tab mr_sm"; button4.style.color = "#61666d"; mFilter((date) => date.indexOf("小时前") === -1);};nav.appendChild(button3);const button4 = document.createElement("button");button4.textContent = "取消筛选";button4.className = "vui_button vui_button--tab mr_sm";button4.setAttribute("data-v-d394b564", "");//button4.style.fontWeight = "bold";button4.onclick = function (){ for(const video of videoList){ button1.className = "vui_button vui_button--tab mr_sm"; button1.style.color = "#61666d"; button2.className = "vui_button vui_button--tab mr_sm"; button2.style.color = "#61666d"; button3.className = "vui_button vui_button--tab mr_sm"; button3.style.color = "#61666d"; button4.className = "vui_button vui_button--tab vui_button--active mr_sm"; button4.style.color = "#00aeec"; video.style.display = "block"; }};nav.appendChild(button4);})();
好多了,不知道为什么原作者搞了个这么难看的样式
Anmelden um eine Antwort zu senden.
修改了下样式,更贴合B站风格
const button1 = document.createElement("button");
//button1.removeAttribute("style");
button1.textContent = "今年发布";
button1.className = "vui_button vui_button--tab mr_sm";
button1.setAttribute("data-v-d394b564", "");
//button1.style.fontWeight = "bold";
button1.onclick = function() {
button1.className = "vui_button vui_button--tab vui_button--active mr_sm";
button1.style.color = "#00aeec";
button2.className = "vui_button vui_button--tab mr_sm";
button2.style.color = "#61666d";
button3.className = "vui_button vui_button--tab mr_sm";
button3.style.color = "#61666d";
button4.className = "vui_button vui_button--tab mr_sm";
button4.style.color = "#61666d";
mFilter(date => reg_PreviousYear.test(date));
};
const nav = document.getElementsByClassName("search-condition-row")[0];
nav.appendChild(button1);
const button2 = document.createElement("button");
button2.textContent = "本月发布";
button2.className = "vui_button vui_button--tab mr_sm";
button2.setAttribute("data-v-d394b564", "");
//.style.fontWeight = "bold";
button2.onclick = function (){
button1.className = "vui_button vui_button--tab mr_sm";
button1.style.color = "#61666d";
button2.className = "vui_button vui_button--tab vui_button--active mr_sm";
button2.style.color = "#00aeec";
button3.className = "vui_button vui_button--tab mr_sm";
button3.style.color = "#61666d";
button4.className = "vui_button vui_button--tab mr_sm";
button4.style.color = "#61666d";
mFilter((date) => !(reg_ThisMonth.test(date) || date.indexOf("昨天") !== -1 || date.indexOf("小时前") !== -1));
};
nav.appendChild(button2);
const button3 = document.createElement("button");
button3.textContent = "今日发布";
button3.className = "vui_button vui_button--tab mr_sm";
button3.setAttribute("data-v-d394b564", "");
//button3.style.fontWeight = "bold";
button3.onclick = function (){
button1.className = "vui_button vui_button--tab mr_sm";
button1.style.color = "#61666d";
button2.className = "vui_button vui_button--tab mr_sm";
button2.style.color = "#61666d";
button3.className = "vui_button vui_button--tab vui_button--active mr_sm";
button3.style.color = "#00aeec";
button4.className = "vui_button vui_button--tab mr_sm";
button4.style.color = "#61666d";
mFilter((date) => date.indexOf("小时前") === -1);
};
nav.appendChild(button3);
const button4 = document.createElement("button");
button4.textContent = "取消筛选";
button4.className = "vui_button vui_button--tab mr_sm";
button4.setAttribute("data-v-d394b564", "");
//button4.style.fontWeight = "bold";
button4.onclick = function (){
for(const video of videoList){
button1.className = "vui_button vui_button--tab mr_sm";
button1.style.color = "#61666d";
button2.className = "vui_button vui_button--tab mr_sm";
button2.style.color = "#61666d";
button3.className = "vui_button vui_button--tab mr_sm";
button3.style.color = "#61666d";
button4.className = "vui_button vui_button--tab vui_button--active mr_sm";
button4.style.color = "#00aeec";
video.style.display = "block";
}
};
nav.appendChild(button4);
})();