Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feat#1291 && Fix#1768 #1767

Merged
merged 3 commits into from
Apr 24, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# EditorConfig is awesome: https://EditorConfig.org

# top-most EditorConfig file
root = true

# Tab indentation
[*]
indent_style = space
indent_size = 2
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
quote_type = single
7 changes: 7 additions & 0 deletions .vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"recommendations": [
"ms-dotnettools.csharp",
"octref.vetur",
"editorconfig.editorconfig"
]
}
3 changes: 3 additions & 0 deletions src/style/custom-navbar/custom-navbar.scss
Original file line number Diff line number Diff line change
Expand Up @@ -971,6 +971,7 @@ li.nav-item[report-id="playpage_dynamic"] .i-frame,
}
#custom-navbar-home-popup .category-item .popup a,
#upload-actions a,
#ranking-list a,
#message-list a {
position: relative;
padding: 8px;
Expand All @@ -997,6 +998,7 @@ li.nav-item[report-id="playpage_dynamic"] .i-frame,
}
#custom-navbar-home-popup .category-item .popup,
#upload-actions,
#ranking-list,
#message-list {
a:hover::before {
transform: scaleX(1);
Expand All @@ -1011,6 +1013,7 @@ li.nav-item[report-id="playpage_dynamic"] .i-frame,
font-weight: bold;
}
#upload-actions,
#ranking-list,
#message-list {
width: max-content;
}
Expand Down
3 changes: 2 additions & 1 deletion src/style/custom-navbar/custom-navbar.ts
Original file line number Diff line number Diff line change
Expand Up @@ -108,11 +108,12 @@ export default (() => {
const { UserInfo } = await import('./simple/custom-navbar-user-info')
const { SearchBox } = await import('./simple/custom-navbar-search-box')
const { Iframe } = await import('./simple/custom-navbar-iframe')
const { Rank } = await import('./simple/custom-navbar-rank')
const components = [
new Blank(1),
new Logo(),
new Category(),
new SimpleLink('排行', 'https://www.bilibili.com/v/popular/rank/all', 'ranking'),
new Rank(),
new SimpleLink('相簿', 'https://h.bilibili.com', 'drawing'),
new SimpleLink('音频', 'https://www.bilibili.com/audio/home/', 'music'),
new Iframe('游戏中心', 'https://game.bilibili.com/', {
Expand Down
25 changes: 25 additions & 0 deletions src/style/custom-navbar/simple/custom-navbar-rank.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import { NavbarComponent } from '../custom-navbar-component';

export class Rank extends NavbarComponent {
constructor() {
super();
this.href = 'https://www.bilibili.com/v/popular/rank/all';
this.html = '排行';
this.popupHtml = /*html*/ `
<ul id="ranking-list">
<li><a target="_blank" href="https://www.bilibili.com/v/popular/all">综合热门</a></li>
<li><a target="_blank" href="https://www.bilibili.com/v/popular/weekly">每周必看</a></li>
<li><a target="_blank" href="https://www.bilibili.com/v/popular/history">入站必刷</a></li>
<li><a target="_blank" href="https://www.bilibili.com/v/popular/rank/all">排行榜</a></li>
</ul>
`;
}
get name(): keyof CustomNavbarOrders {
return 'rankingLink';
}
}
export default {
export: {
Rank,
},
};
6 changes: 5 additions & 1 deletion src/style/dark/dark-color-scheme.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,12 @@ const check = (isSystemDark: boolean) => {
if (isSystemDark !== settings.useDarkStyle) {
settings.useDarkStyle = isSystemDark
}
return isSystemDark
}
check(matchList.matches)
(async()=>{
const { load:loadDarkMod, unload:unloadDarkMod } = await import('./dark-styles')
check(matchList.matches) ? loadDarkMod() : unloadDarkMod()
})()
matchList.addEventListener('change', e => {
check(e.matches)
})
8 changes: 6 additions & 2 deletions src/style/dark/dark-styles.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
const removeBadScrollbar = () => {
SpinQuery.select('.custom-scrollbar').then(it => it && it.classList.remove('custom-scrollbar'))
}
const unload = () => {
export const unload = () => {
document.body.classList.remove('dark')
resources.removeStyle('darkStyleNavBar')
resources.removeStyle('darkStyle')
Expand All @@ -22,7 +22,7 @@ const notSupported: (string | RegExp)[] = [
// 创作中心-收益管理-悬赏计划
"//cm.bilibili.com/quests/#/task",
]
const load = () => {
export const load = () => {
if (settings.noDarkOnMember && notSupported.some(it => {
if (typeof it === 'string') {
return document.URL.replace(location.search, '').includes(it)
Expand Down Expand Up @@ -50,4 +50,8 @@ addSettingsListener('useDarkStyleAsUserStyle', () => {
export default {
reload: load,
unload: unload,
export: {
load,
unload
}
}