mirror of
https://github.com/the1812/Bilibili-Evolved.git
synced 2025-11-04 21:22:45 +08:00
70 lines
2.0 KiB
JavaScript
70 lines
2.0 KiB
JavaScript
(() =>
|
|
{
|
|
return (settings, resources) =>
|
|
{
|
|
if (document.URL === `https://h.bilibili.com/`)
|
|
{
|
|
return {
|
|
ajaxReload: false
|
|
};
|
|
}
|
|
resources.applyStyle("scrollbarStyle", "bilibili-scrollbar-style");
|
|
SpinQuery.any(
|
|
() => $(".custom-scrollbar"),
|
|
it => it.removeClass("custom-scrollbar")
|
|
);
|
|
const newStyles = {
|
|
selectors: [
|
|
"div.nav-con.fl",
|
|
"#link-navbar-vm",
|
|
".link-navbar",
|
|
".nav-header-wrapper",
|
|
".z_top .z_header"
|
|
],
|
|
get allSelectors()
|
|
{
|
|
return this.selectors.reduce((acc, s) => acc + "," + s);
|
|
},
|
|
get navbar()
|
|
{
|
|
let result = null;
|
|
for (const selector of this.selectors)
|
|
{
|
|
result = result || document.querySelector(selector);
|
|
}
|
|
return result;
|
|
},
|
|
supports(navbar)
|
|
{
|
|
if (navbar instanceof Element)
|
|
{
|
|
const height = parseInt(window.getComputedStyle(navbar).height);
|
|
const supportHeights = [
|
|
60, /* show */
|
|
50, /* stardust player */
|
|
0, /* live room */
|
|
56 /* photos */
|
|
];
|
|
return supportHeights.indexOf(height) !== -1;
|
|
}
|
|
return false;
|
|
}
|
|
};
|
|
SpinQuery.any(() => $(newStyles.allSelectors), () =>
|
|
{
|
|
const navbar = newStyles.navbar;
|
|
if (newStyles.supports(navbar))
|
|
{
|
|
resources.applyStyle("style", "bilibili-new-style");
|
|
}
|
|
else
|
|
{
|
|
resources.applyStyle("oldStyle", "bilibili-new-style");
|
|
}
|
|
});
|
|
return {
|
|
ajaxReload: false
|
|
};
|
|
};
|
|
})();
|