Bilibili-Evolved/style/new-styles.js
2018-08-04 14:50:56 +08:00

54 lines
1.6 KiB
JavaScript

(() =>
{
return (settings, resources) =>
{
new SpinQuery(
() => $(".nav-search-keyword"),
it => it.length > 0 && it.attr("placeholder").length > 0,
textBox => textBox.attr("placeholder", "搜索")
).start();
SpinQuery.any(
() => $(".custom-scrollbar"),
it => it.removeClass("custom-scrollbar")
);
const navbar = document.getElementsByClassName("bili-wrapper")[0];
let stardustStyles = false;
if (navbar instanceof Element)
{
stardustStyles = parseInt(window.getComputedStyle(navbar).height) === 50;
}
if (stardustStyles)
{
resources.applyStyle("style", "bilibili-new-style");
}
else
{
resources.applyStyle("oldStyle", "bilibili-new-style");
}
if (settings.overrideNavBar)
{
new SpinQuery(
() => $(".search").not(".filter-item"),
it => it.length > 0 && $(".nav-con.fr").length > 0,
textBox =>
{
textBox.detach()
.insertAfter(".nav-con.fr");
}
).start();
SpinQuery.any(
() => $("input.search-keyword"),
textBox => textBox.attr("placeholder", "搜索")
);
resources.applyStyle("navbarOverrideStyle", "bilibili-nav-bar-override");
if (!settings.showBanner)
{
resources.applyStyle("noBannerStyle", "bilibili-banner-override");
}
}
};
})();