Revert changes

This commit is contained in:
the1812 2018-07-20 16:23:16 +08:00
parent f952d90a66
commit 93d076e9fb
3 changed files with 42 additions and 62 deletions

View File

@ -2,73 +2,57 @@
{ {
return (settings, resources) => return (settings, resources) =>
{ {
$("#bilibili-new-style").remove();
$("#bilibili-nav-bar-override").remove();
$("#bilibili-banner-override").remove();
waitForQuery()( waitForQuery()(
() => $(".nav-search-keyword"), () => $(".nav-search-keyword"),
it => it.length > 0, it => it.length > 0,
textBox => textBox.attr("placeholder", settings.useNewStyle ? "搜索" : "") textBox => textBox.attr("placeholder", "搜索")
); );
waitForQuery()( waitForQuery()(
() => $(settings.useNewStyle ? ".custom-scrollbar" : ".removed-custom-scrollbar"), () => $(".custom-scrollbar"),
it => it.length > 0, it => it.length > 0,
it => it => it.removeClass("custom-scrollbar")
{
if (settings.useNewStyle)
{
it.removeClass("custom-scrollbar").addClass("removed-custom-scrollbar");
}
else
{
it.removeClass("removed-custom-scrollbar").addClass("custom-scrollbar");
}
}
); );
if (settings.useNewStyle) const navbar = document.getElementsByClassName("bili-wrapper")[0];
let stardustStyles = false;
if (navbar instanceof Element)
{ {
const navbar = document.getElementsByClassName("bili-wrapper")[0]; stardustStyles = parseInt(window.getComputedStyle(navbar).height) === 50;
let stardustStyles = false; }
if (navbar instanceof Element) let styles = "";
{ if (stardustStyles)
stardustStyles = parseInt(window.getComputedStyle(navbar).height) === 50; {
} styles = resources.getStyle("style", "bilibili-new-style");
let styles = ""; }
if (stardustStyles) else
{ {
styles = resources.getStyle("style", "bilibili-new-style"); styles = resources.getStyle("oldStyle", "bilibili-new-style");
} }
else $("#bilibili-new-style").remove();
{ $("body").after(styles);
styles = resources.getStyle("oldStyle", "bilibili-new-style");
}
$("body").after(styles);
if (settings.overrideNavBar) if (settings.overrideNavBar)
{ {
waitForQuery()( waitForQuery()(
() => $(".search"), () => $(".search"),
it => it.length > 0 && $(".nav-con.fr").length > 0, it => it.length > 0 && $(".nav-con.fr").length > 0,
textBox => textBox =>
{
textBox.detach()
.insertAfter(".nav-con.fr");
}
);
waitForQuery()(
() => $("input.search-keyword"),
it => it.length > 0,
textBox => textBox.attr("placeholder", "搜索")
);
const navBarStyles = resources.getStyle("navbarOverrideStyle", "bilibili-nav-bar-override");
$("body").after(navBarStyles);
if (!settings.showBanner)
{ {
const bannerStyles = resources.getStyle("noBannerStyle", "bilibili-banner-override"); textBox.detach()
$("body").after(bannerStyles); .insertAfter(".nav-con.fr");
} }
);
waitForQuery()(
() => $("input.search-keyword"),
it => it.length > 0,
textBox => textBox.attr("placeholder", "搜索")
);
const navBarStyles = resources.getStyle("navbarOverrideStyle", "bilibili-nav-bar-override");
$("body").after(navBarStyles);
if (!settings.showBanner)
{
const bannerStyles = resources.getStyle("noBannerStyle", "bilibili-banner-override");
$("body").after(bannerStyles);
} }
} }
}; };

View File

@ -1 +1 @@
(()=>(e,r)=>{if($("#bilibili-new-style").remove(),$("#bilibili-nav-bar-override").remove(),$("#bilibili-banner-override").remove(),waitForQuery()(()=>$(".nav-search-keyword"),e=>e.length>0,r=>r.attr("placeholder",e.useNewStyle?"搜索":"")),waitForQuery()(()=>$(e.useNewStyle?".custom-scrollbar":".removed-custom-scrollbar"),e=>e.length>0,r=>{e.useNewStyle?r.removeClass("custom-scrollbar").addClass("removed-custom-scrollbar"):r.removeClass("removed-custom-scrollbar").addClass("custom-scrollbar")}),e.useNewStyle){const l=document.getElementsByClassName("bili-wrapper")[0];let t=!1;l instanceof Element&&(t=50===parseInt(window.getComputedStyle(l).height));let i="";if(i=t?r.getStyle("style","bilibili-new-style"):r.getStyle("oldStyle","bilibili-new-style"),$("body").after(i),e.overrideNavBar){waitForQuery()(()=>$(".search"),e=>e.length>0&&$(".nav-con.fr").length>0,e=>{e.detach().insertAfter(".nav-con.fr")}),waitForQuery()(()=>$("input.search-keyword"),e=>e.length>0,e=>e.attr("placeholder","搜索"));const l=r.getStyle("navbarOverrideStyle","bilibili-nav-bar-override");if($("body").after(l),!e.showBanner){const e=r.getStyle("noBannerStyle","bilibili-banner-override");$("body").after(e)}}}})(); (()=>(settings,resources)=>{waitForQuery()(()=>$(".nav-search-keyword"),it=>it.length>0,textBox=>textBox.attr("placeholder","搜索")),waitForQuery()(()=>$(".custom-scrollbar"),it=>it.length>0,it=>it.removeClass("custom-scrollbar"));const navbar=document.getElementsByClassName("bili-wrapper")[0];let stardustStyles=!1;navbar instanceof Element&&(stardustStyles=50===parseInt(window.getComputedStyle(navbar).height));let styles="";if(styles=stardustStyles?resources.getStyle("style","bilibili-new-style"):resources.getStyle("oldStyle","bilibili-new-style"),$("#bilibili-new-style").remove(),$("body").after(styles),settings.overrideNavBar){waitForQuery()(()=>$(".search"),it=>it.length>0&&$(".nav-con.fr").length>0,textBox=>{textBox.detach().insertAfter(".nav-con.fr")}),waitForQuery()(()=>$("input.search-keyword"),it=>it.length>0,textBox=>textBox.attr("placeholder","搜索"));const navBarStyles=resources.getStyle("navbarOverrideStyle","bilibili-nav-bar-override");if($("body").after(navBarStyles),!settings.showBanner){const bannerStyles=resources.getStyle("noBannerStyle","bilibili-banner-override");$("body").after(bannerStyles)}}})();

View File

@ -21,10 +21,6 @@
left: 0; left: 0;
transform: rotate(120deg); transform: rotate(120deg);
} }
.gui-settings svg path
{
fill: #eee4;
}
.gui-settings:hover svg path .gui-settings:hover svg path
{ {
fill: #eee8; fill: #eee8;
@ -165,7 +161,7 @@ button.save
{ {
padding: 0.5rem 2rem; padding: 0.5rem 2rem;
border: none; border: none;
background: $customStyleColor; background: $customStyleColor80;
color: $foreground; color: $foreground;
border-radius: 4px; border-radius: 4px;
font-size: 1rem; font-size: 1rem;