Add custom navbar

This commit is contained in:
the1812 2019-04-05 12:16:34 +08:00
parent 4084de8cad
commit edbedeb9b3
11 changed files with 172 additions and 10 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

@ -98,6 +98,10 @@ const settings = {
skin: false,
},
customNavbar: false,
customNavbarSettings: {
fill: true,
shadow: true,
},
cache: {},
};
const fixedSettings = {

View File

@ -98,6 +98,10 @@ const settings = {
skin: false,
},
customNavbar: false,
customNavbarSettings: {
fill: true,
shadow: true,
},
cache: {},
};
const fixedSettings = {

View File

@ -73,6 +73,10 @@ export const settings = {
skin: false,
},
customNavbar: false,
customNavbarSettings: {
fill: true,
shadow: true,
},
cache: {},
};
const fixedSettings = {

View File

@ -1 +1 @@
WARNING: Invalid character(s) '' at 1:0. Ignoring.
@font-face{font-family:custom-navbar-font;src:url(//s1.hdslb.com/bfs/seed/jinkela/header/asserts/iconfont.ttf) format('truetype')}.custom-navbar-iconfont{font-family:custom-navbar-font!important;font-size:16px}.custom-navbar-icon-music::before{content:"\E601"}.custom-navbar-icon-game::before{content:"\E603"}.custom-navbar-icon-dance::before{content:"\E605"}.custom-navbar-icon-zhibo::before{content:"\E606"}.custom-navbar-icon-ent::before{content:"\E607"}.custom-navbar-icon-life::before{content:"\E608"}.custom-navbar-icon-kichiku::before{content:"\E609"}.custom-navbar-icon-guochuang::before{content:"\E60A"}.custom-navbar-icon-fashion::before{content:"\E60B"}.custom-navbar-icon-ad::before{content:"\E60C"}.custom-navbar-icon-anime::before{content:"\E60D"}.custom-navbar-icon-guochandonghuatuijian::before{content:"\E612"}.custom-navbar-icon-technology::before{content:"\E6AD"}.custom-navbar-icon-general_pullup_s::before{content:"\E6EC"}.custom-navbar-icon-Navbar_mobile::before{content:"\E724"}.custom-navbar-icon-Navbar_logo::before{content:"\E725"}.custom-navbar-icon-bilibili-tv::before{content:"\E668"}.custom-navbar-icon-general_upload::before{content:"\E634"}.custom-navbar-icon-general_search::before{content:"\E635"}.custom-navbar-icon-activit::before{content:"\E63B"}.custom-navbar-icon-blackroom::before{content:"\E63F"}.custom-navbar-icon-read::before{content:"\E640"}.custom-navbar-icon-ic_partition_broadca::before{content:"\E641"}.custom-navbar-icon-cinephile::before{content:"\E642"}.custom-navbar-icon-cinema::before{content:"\E643"}.custom-navbar-icon-topic::before{content:"\E644"}.custom-navbar-icon-douga::before{content:"\E645"}.custom-navbar-icon-digital::before{content:"\E64E"}.custom-navbar{--navbar-height:50px;position:fixed;top:0;left:0;height:var(--navbar-height);width:100vw;color:#000;z-index:10001}.custom-navbar.fill{background-color:var(--theme-color);color:#fffd}.custom-navbar.fill.shadow{box-shadow:var(--theme-color-30) 0 2px 10px 1px}

View File

@ -0,0 +1 @@
<div class=custom-navbar></div>

View File

@ -1 +1 @@
(()=>{return(r,e)=>{}})();
(()=>{return(t,e)=>{if(isIframe()){return}const n=["/www.bilibili.com"];if(!n.some(t=>document.URL.includes(t))){return}(async()=>{const n=await e.importAsync("customNavbarHtml");document.body.insertAdjacentHTML("beforeend",n);const c=document.querySelector(".custom-navbar");for(const[e,n]of Object.entries(t.customNavbarSettings)){if(n===true){c.classList.add(e)}}})()}})();

View File

@ -0,0 +1,114 @@
@font-face
{
font-family: "custom-navbar-font";
src: url('//s1.hdslb.com/bfs/seed/jinkela/header/asserts/iconfont.ttf') format('truetype');
}
.custom-navbar-iconfont {
font-family: "custom-navbar-font" !important;
font-size: 16px;
}
.custom-navbar-icon-music::before {
content: "\E601";
}
.custom-navbar-icon-game::before {
content: "\E603";
}
.custom-navbar-icon-dance::before {
content: "\E605";
}
.custom-navbar-icon-zhibo::before {
content: "\E606";
}
.custom-navbar-icon-ent::before {
content: "\E607";
}
.custom-navbar-icon-life::before {
content: "\E608";
}
.custom-navbar-icon-kichiku::before {
content: "\E609";
}
.custom-navbar-icon-guochuang::before {
content: "\E60A";
}
.custom-navbar-icon-fashion::before {
content: "\E60B";
}
.custom-navbar-icon-ad::before {
content: "\E60C";
}
.custom-navbar-icon-anime::before {
content: "\E60D";
}
.custom-navbar-icon-guochandonghuatuijian::before {
content: "\E612";
}
.custom-navbar-icon-technology::before {
content: "\E6AD";
}
.custom-navbar-icon-general_pullup_s::before {
content: "\E6EC";
}
.custom-navbar-icon-Navbar_mobile::before {
content: "\E724";
}
.custom-navbar-icon-Navbar_logo::before {
content: "\E725";
}
.custom-navbar-icon-bilibili-tv::before {
content: "\E668";
}
.custom-navbar-icon-general_upload::before {
content: "\E634";
}
.custom-navbar-icon-general_search::before {
content: "\E635";
}
.custom-navbar-icon-activit::before {
content: "\E63B";
}
.custom-navbar-icon-blackroom::before {
content: "\E63F";
}
.custom-navbar-icon-read::before {
content: "\E640";
}
.custom-navbar-icon-ic_partition_broadca::before {
content: "\E641";
}
.custom-navbar-icon-cinephile::before {
content: "\E642";
}
.custom-navbar-icon-cinema::before {
content: "\E643";
}
.custom-navbar-icon-topic::before {
content: "\E644";
}
.custom-navbar-icon-douga::before {
content: "\E645";
}
.custom-navbar-icon-digital::before {
content: "\E64E";
}
.custom-navbar
{
--navbar-height: 50px;
position: fixed;
top: 0;
left: 0;
height: var(--navbar-height);
width: 100vw;
color: black;
z-index: 10001;
}
.custom-navbar.fill
{
background-color: var(--theme-color);
color: #fffd;
}
.custom-navbar.fill.shadow
{
box-shadow: var(--theme-color-30) 0px 2px 10px 1px;
}

View File

@ -0,0 +1,3 @@
<div class="custom-navbar">
</div>

View File

@ -0,0 +1,24 @@
if (isIframe())
{
return;
}
const supportedUrls = [
"/www.bilibili.com",
];
if (!supportedUrls.some(it => document.URL.includes(it)))
{
return;
}
(async () =>
{
const html = await import("customNavbarHtml");
document.body.insertAdjacentHTML("beforeend", html);
const navbar = document.querySelector(".custom-navbar");
for (const [className, enabled] of Object.entries(settings.customNavbarSettings))
{
if (enabled === true)
{
navbar.classList.add(className);
}
}
})();