Skip to content

Commit

Permalink
Unload dark style on member.bilibili.com
Browse files Browse the repository at this point in the history
  • Loading branch information
the1812 committed Feb 1, 2020
1 parent 1d42df8 commit b8747f5
Show file tree
Hide file tree
Showing 12 changed files with 35 additions and 28 deletions.
1 change: 1 addition & 0 deletions @types/global/index.d.ts
Expand Up @@ -426,6 +426,7 @@ declare global {
downloadVideoQuality: number,
downloadSubtitle: boolean,
removeGameMatchModule: boolean,
noDarkOnMember: boolean,
latestVersionLink: string,
currentVersion: string,
}
Expand Down
8 changes: 4 additions & 4 deletions bilibili-evolved.offline.user.js

Large diffs are not rendered by default.

8 changes: 4 additions & 4 deletions bilibili-evolved.preview-offline.user.js

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions bilibili-evolved.preview.user.js

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions bilibili-evolved.user.js

Large diffs are not rendered by default.

5 changes: 2 additions & 3 deletions min/bundle.json
Expand Up @@ -32,7 +32,7 @@
"custom-control-background.min.js": "2A439B045A51D24F5115DD25995ED37E3D0371A074199FE6C727F2235F39C4D9",
"custom-navbar.min.css": "248C2D63B76E9ECFF2A979D5F649F259A2930FF0FF6B856FC837FC9DA3DFB563",
"custom-navbar.min.html": "17FD1B1727E8D62E7997F10002FE7BF23472F390042D44DE3376A7A5A5FF2FDF",
"custom-navbar.min.js": "3CBF688BE1F0FD3AEFFB6268328FEEC5B1BB189EC0F53C6B86E4D9353AE67DE7",
"custom-navbar.min.js": "865EA8DEFA9636ED1FC41A3FBCFFC79B1B0B57AABD59A142A48D55CA2D40284C",
"custom-navbar-activities.min.js": "7CCA4AF4555CF9E9D338FE7285879C9F1396112F1FCD7293AD92EEE965E656C3",
"custom-navbar-blank.min.js": "DC2B75D5760EECD3A257785FDFBB7E5DEBF61CD9083C68DD5BCE468B093F54F3",
"custom-navbar-category.min.js": "4CF38ACE1D0501217266D1E35DFCBF9D5C1D9A3838C54D53C614878BB8CF55E2",
Expand All @@ -54,8 +54,7 @@
"dark-important.min.css": "8453644F7FC8BB0E9DA401DC161815E2AC198E9B4D7A5A19C29934B672F277B1",
"dark-navbar.min.css": "A2D91F11127D165571ACCC53004EDDB118CEE110F9B020D7E0541E1C8FAEA478",
"dark-schedule.min.js": "853C446547603F4F0425F19F09F73335C9EC451A790C1C07E5E5B88A09E9B453",
"dark-slice-9.min.css": "CD4FCA9822F269BA4E09EE07AB2B691762BF9DF9949FCF1EEEDF6BF78633530A",
"dark-styles.min.js": "C62AFBB47DDC1E2F3F45D688B0F98394E471A423BE26BF47504D5C7D069ADBA1",
"dark-styles.min.js": "71AF9CBD74BD3F570515C46801AE66A52665DCEDE2F4941AA90D12A4F1381A6E",
"debounce.min.js": "54D33E1273C1F3FE19550BF1844339C3D54D6B01DF8A39C3162D95B93B079CFA",
"default-danmaku-settings.min.css": "D9942B184FEDA7B08CFA0C34920E97D7A83B81762DCBF757642EBB60F95FF25D",
"default-danmaku-settings.min.js": "9DBC9AC9B5A3B59EBCC6F04D36527B523D66203AC5FE7C2AD5DB46FFB84F9382",
Expand Down
Binary file modified min/bundle.zip
Binary file not shown.
2 changes: 1 addition & 1 deletion min/custom-navbar.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion min/dark-styles.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions src/client/settings.js
Expand Up @@ -204,6 +204,7 @@ export const settings = {
urlParamsClean: true,
collapseLiveSideBar: true,
removeGameMatchModule: false,
noDarkOnMember: true,
downloadVideoQuality: 120,
cache: {},
}
Expand Down
5 changes: 3 additions & 2 deletions src/style/custom-navbar/custom-navbar.ts
Expand Up @@ -12,15 +12,16 @@ const supportedUrls = [
'//app.bilibili.com',
'//passport.bilibili.com',
'//game.bilibili.com',
'//live.bilibili.com/blackboard/'
'//live.bilibili.com/blackboard/',
]
const unsupportedUrls = [
'//t.bilibili.com/vote/h5/index/#/result',
'//t.bilibili.com/lottery/h5/index/#/result',
'//member.bilibili.com/video/upload',
'//space.bilibili.com/ajax/',
'//www.bilibili.com/h5/comment/',
'//www.bilibili.com/blackboard/'
'//www.bilibili.com/blackboard/',
'//member.bilibili.com/v2',
]
const loadSettings = () => {
document.body.style.setProperty('--navbar-bounds-padding', `0 ${settings.customNavbarBoundsPadding}%`)
Expand Down
19 changes: 12 additions & 7 deletions src/style/dark/dark-styles.js
@@ -1,7 +1,18 @@
const removeBadScrollbar = () => {
SpinQuery.select('.custom-scrollbar').then(it => it && it.classList.remove('custom-scrollbar'))
}
const unload = () => {
document.body.classList.remove('dark')
resources.removeStyle('scrollbarStyle')
resources.removeStyle('darkStyleNavBar')
resources.removeStyle('darkStyle')
resources.removeStyle('darkStyleImportant')
}
const load = () => {
if (settings.noDarkOnMember && document.URL.startsWith('https://member.bilibili.com/v2')) {
unload()
return
}
document.body.classList.add('dark')
removeBadScrollbar()
resources.applyStyle('scrollbarStyle')
Expand All @@ -12,11 +23,5 @@ const load = () => {
load()
export default {
reload: load,
unload: () => {
document.body.classList.remove('dark')
resources.removeStyle('scrollbarStyle')
resources.removeStyle('darkStyleNavBar')
resources.removeStyle('darkStyle')
resources.removeStyle('darkStyleImportant')
}
unload: unload,
}

0 comments on commit b8747f5

Please sign in to comment.