Independent override nav bar and add dark nav bar style

This commit is contained in:
the1812 2018-09-23 12:08:11 +08:00
parent 0955494573
commit 79c0b606d4
14 changed files with 111 additions and 70 deletions

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -1,6 +1,6 @@
// ==UserScript==
// @name Bilibili Evolved (Preview)
// @version 1.3.15
// @version 1.4.0
// @description 增强哔哩哔哩Web端体验. (预览版分支)
// @author Grant Howard
// @match *://*.bilibili.com/*
@ -49,7 +49,7 @@
notifyNewVersion: true,
fixFullscreen: false,
latestVersionLink: "https://github.com/the1812/Bilibili-Evolved/raw/preview/bilibili-evolved.preview.user.js",
currentVersion: "1.3.15"
currentVersion: "1.4.0"
};
function loadSettings()
{
@ -94,6 +94,7 @@
scrollbarStyle: new Resource("style/style-scrollbar.min.css", 1),
darkStyle: new Resource("style/style-dark.min.scss", 2),
darkStyleImportant: new Resource("style/style-dark-important.min.scss"),
darkStyleNavBar: new Resource("style/style-dark-navbar.min.scss"),
touchPlayerStyle: new Resource("style/style-touch-player.min.scss", 3),
navbarOverrideStyle: new Resource("style/style-navbar-override.min.css", 4),
noBannerStyle: new Resource("style/style-no-banner.min.css", 5),
@ -111,6 +112,7 @@
guiSettings: new Resource("utils/gui-settings.min.js"),
useDarkStyle: new Resource("style/dark-styles.min.js"),
useNewStyle: new Resource("style/new-styles.min.js"),
overrideNavBar: new Resource("style/override-nav-bar.min.js"),
touchNavBar: new Resource("touch/touch-navbar.min.js"),
touchVideoPlayer: new Resource("touch/touch-player.min.js"),
expandDanmakuList: new Resource("video/expand-danmaku.min.js"),
@ -134,15 +136,18 @@
];
this.useDarkStyle.dependencies = [
this.darkStyle,
this.darkStyleImportant
this.darkStyleImportant,
this.darkStyleNavBar
];
this.useNewStyle.dependencies = [
this.style,
this.oldStyle,
this.navbarOverrideStyle,
this.noBannerStyle,
this.scrollbarStyle
];
this.overrideNavBar.dependencies = [
this.navbarOverrideStyle,
this.noBannerStyle
];
this.touchVideoPlayer.dependencies = [
this.touchPlayerStyle
];
@ -171,6 +176,7 @@
this.guiSettings.displayName = "设置";
this.useDarkStyle.displayName = "夜间模式";
this.useNewStyle.displayName = "新样式";
this.overrideNavBar.displayName = "搜索栏位置调整";
this.touchNavBar.displayName = "顶栏触摸优化";
this.touchVideoPlayer.displayName = "播放器触摸支持";
this.expandDanmakuList.displayName = "自动展开弹幕列表";

View File

@ -1,6 +1,6 @@
// ==UserScript==
// @name Bilibili Evolved
// @version 1.3.15
// @version 1.4.0
// @description 增强哔哩哔哩Web端体验.
// @author Grant Howard
// @match *://*.bilibili.com/*
@ -49,7 +49,7 @@
notifyNewVersion: true,
fixFullscreen: false,
latestVersionLink: "https://github.com/the1812/Bilibili-Evolved/raw/master/bilibili-evolved.user.js",
currentVersion: "1.3.15"
currentVersion: "1.4.0"
};
function loadSettings()
{
@ -94,6 +94,7 @@
scrollbarStyle: new Resource("style/style-scrollbar.min.css", 1),
darkStyle: new Resource("style/style-dark.min.scss", 2),
darkStyleImportant: new Resource("style/style-dark-important.min.scss"),
darkStyleNavBar: new Resource("style/style-dark-navbar.min.scss"),
touchPlayerStyle: new Resource("style/style-touch-player.min.scss", 3),
navbarOverrideStyle: new Resource("style/style-navbar-override.min.css", 4),
noBannerStyle: new Resource("style/style-no-banner.min.css", 5),
@ -111,6 +112,7 @@
guiSettings: new Resource("utils/gui-settings.min.js"),
useDarkStyle: new Resource("style/dark-styles.min.js"),
useNewStyle: new Resource("style/new-styles.min.js"),
overrideNavBar: new Resource("style/override-nav-bar.min.js"),
touchNavBar: new Resource("touch/touch-navbar.min.js"),
touchVideoPlayer: new Resource("touch/touch-player.min.js"),
expandDanmakuList: new Resource("video/expand-danmaku.min.js"),
@ -134,15 +136,18 @@
];
this.useDarkStyle.dependencies = [
this.darkStyle,
this.darkStyleImportant
this.darkStyleImportant,
this.darkStyleNavBar
];
this.useNewStyle.dependencies = [
this.style,
this.oldStyle,
this.navbarOverrideStyle,
this.noBannerStyle,
this.scrollbarStyle
];
this.overrideNavBar.dependencies = [
this.navbarOverrideStyle,
this.noBannerStyle
];
this.touchVideoPlayer.dependencies = [
this.touchPlayerStyle
];
@ -171,6 +176,7 @@
this.guiSettings.displayName = "设置";
this.useDarkStyle.displayName = "夜间模式";
this.useNewStyle.displayName = "新样式";
this.overrideNavBar.displayName = "搜索栏位置调整";
this.touchNavBar.displayName = "顶栏触摸优化";
this.touchVideoPlayer.displayName = "播放器触摸支持";
this.expandDanmakuList.displayName = "自动展开弹幕列表";

View File

@ -1,7 +1,11 @@
(() =>
{
return (_, resources) =>
return (settings, resources) =>
{
if (settings.overrideNavBar && !settings.showBanner)
{
resources.applyImportantStyle("darkStyleNavBar", "bilibili-new-style-dark-nav-bar");
}
resources.applyStyle("darkStyle", "bilibili-new-style-dark");
resources.applyImportantStyle("darkStyleImportant", "bilibili-new-style-dark-important");
return {

View File

@ -1 +1 @@
(()=>{return(l,t)=>{t.applyStyle("darkStyle","bilibili-new-style-dark");t.applyImportantStyle("darkStyleImportant","bilibili-new-style-dark-important");return{ajaxReload:false}}})();
(()=>{return(a,l)=>{if(!a.showBanner){l.applyImportantStyle("darkStyleNavBar","bilibili-new-style-dark-nav-bar")}l.applyStyle("darkStyle","bilibili-new-style-dark");l.applyImportantStyle("darkStyleImportant","bilibili-new-style-dark-important");return{ajaxReload:false}}})();

View File

@ -31,25 +31,6 @@
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();
resources.applyStyle("navbarOverrideStyle", "bilibili-nav-bar-override");
if (!settings.showBanner)
{
resources.applyStyle("noBannerStyle", "bilibili-banner-override");
}
}
return {
ajaxReload: false
};

View File

@ -1 +1 @@
(()=>{return(e,l)=>{l.applyStyle("scrollbarStyle","bilibili-scrollbar-style");SpinQuery.any(()=>$(".custom-scrollbar"),e=>e.removeClass("custom-scrollbar"));SpinQuery.any(()=>$(".bili-wrapper,#link-navbar-vm,.link-navbar"),()=>{const e=document.getElementsByClassName("bili-wrapper")[0]||document.getElementById("link-navbar-vm")||document.getElementsByClassName("link-navbar")[0];let n=false;if(e instanceof Element){const l=parseInt(window.getComputedStyle(e).height);n=l===50||l===56}if(n){l.applyStyle("style","bilibili-new-style")}else{l.applyStyle("oldStyle","bilibili-new-style")}});if(e.overrideNavBar){new SpinQuery(()=>$(".search").not(".filter-item"),e=>e.length>0&&$(".nav-con.fr").length>0,e=>{e.detach().insertAfter(".nav-con.fr")}).start();l.applyStyle("navbarOverrideStyle","bilibili-nav-bar-override");if(!e.showBanner){l.applyStyle("noBannerStyle","bilibili-banner-override")}}return{ajaxReload:false}}})();
(()=>{return(e,l)=>{l.applyStyle("scrollbarStyle","bilibili-scrollbar-style");SpinQuery.any(()=>$(".custom-scrollbar"),e=>e.removeClass("custom-scrollbar"));SpinQuery.any(()=>$(".bili-wrapper,#link-navbar-vm,.link-navbar"),()=>{const e=document.getElementsByClassName("bili-wrapper")[0]||document.getElementById("link-navbar-vm")||document.getElementsByClassName("link-navbar")[0];let t=false;if(e instanceof Element){const l=parseInt(window.getComputedStyle(e).height);t=l===50||l===56}if(t){l.applyStyle("style","bilibili-new-style")}else{l.applyStyle("oldStyle","bilibili-new-style")}});return{ajaxReload:false}}})();

24
style/override-nav-bar.js Normal file
View File

@ -0,0 +1,24 @@
(() =>
{
return (settings, resources) =>
{
new SpinQuery(
() => $(".search").not(".filter-item"),
it => it.length > 0 && $(".nav-con.fr").length > 0,
textBox =>
{
textBox.detach()
.insertAfter(".nav-con.fr");
}
).start();
resources.applyStyle("navbarOverrideStyle", "bilibili-nav-bar-override");
if (!settings.showBanner)
{
resources.applyStyle("noBannerStyle", "bilibili-banner-override");
}
return {
ajaxReload: false
};
};
})();

1
style/override-nav-bar.min.js vendored Normal file
View File

@ -0,0 +1 @@
(()=>{return(e,r)=>{new SpinQuery(()=>$(".search").not(".filter-item"),e=>e.length>0&&$(".nav-con.fr").length>0,e=>{e.detach().insertAfter(".nav-con.fr")}).start();r.applyStyle("navbarOverrideStyle","bilibili-nav-bar-override");if(!e.showBanner){r.applyStyle("noBannerStyle","bilibili-banner-override")}return{ajaxReload:false}}})();

View File

@ -0,0 +1 @@
.bili-header-m .nav-menu .nav-mask{background-color:#444;}.bili-header-m .nav-menu .nav-con .nav-item .t{color:#eee;}

View File

@ -0,0 +1,8 @@
.bili-header-m .nav-menu .nav-mask
{
background-color: #444;
}
.bili-header-m .nav-menu .nav-con .nav-item .t
{
color: #eee;
}

View File

@ -9,8 +9,7 @@
<div class="gui-settings-content">
<ul>
<category>样式</category>
<checkbox indent="0" key="useNewStyle" dependencies=""></checkbox>
<li class="indent-1">
<li class="indent-0">
<label class="gui-settings-textbox-container">
<span>自定义颜色</span>
<div class="custom-color-preview">
@ -18,22 +17,21 @@
<div class="predefined-colors-grid"></div>
</div>
</div>
<input key="customStyleColor" dependencies="useNewStyle" spellcheck="false" type="text" />
<input key="customStyleColor" dependencies="" spellcheck="false" type="text" />
</label>
</li>
<checkbox indent="0" key="useNewStyle" dependencies=""></checkbox>
<li class="indent-1">
<label class="gui-settings-textbox-container">
<span>顶栏(对横幅)不透明度</span>
<input key="blurBackgroundOpacity" dependencies="useNewStyle" spellcheck="false" type="text" />
</label>
</li>
<checkbox indent="0" key="overrideNavBar" dependencies="">
搜索栏位置调整
</checkbox>
<checkbox indent="0" key="useDarkStyle" dependencies=""></checkbox>
<checkbox indent="0" key="overrideNavBar" dependencies=""></checkbox>
<checkbox indent="1" key="showBanner" dependencies="overrideNavBar">
显示顶部横幅
</checkbox>
<checkbox indent="0" key="useDarkStyle" dependencies=""></checkbox>
<category>工具</category>
<checkbox indent="0" key="removeAds" dependencies=""></checkbox>
<checkbox indent="0" key="watchLaterRedirect" dependencies=""></checkbox>

View File

@ -1 +1 @@
1.3.15
1.4.0