-
Notifications
You must be signed in to change notification settings - Fork 455
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* 深色新增搜索页,所有框线改为亮色,修复大量问题 * 文案更新 * 修复关闭版聊时不会重新显示弹幕区的错误 * 修复主页分区屏蔽在特定情况下失效的BUG (#785) * 添加名为home的kind,作用于B站主页 * Feature:添加主页分区屏蔽功能 * fix: 修复Feature在other下时,subPage找不到map的bug * Dev (#780) * 深色新增搜索页,所有框线改为亮色,修复大量问题 * 文案更新 * 修复关闭版聊时不会重新显示弹幕区的错误 * 版聊模式隐藏右侧边栏逻辑恢复 * 删除去污粉用户等级选项 & 增加eslint规则 * 调整版聊模式逻辑 * Feature: 添加屏蔽主页分区的功能 (#778) * 添加名为home的kind,作用于B站主页 * Feature:添加主页分区屏蔽功能 * fix: 修复Feature在other下时,subPage找不到map的bug * clean up code * 移除pages/config/_locales中home相关部分 * 添加美食区屏蔽开关 * 添加美食区屏蔽开关 (#781) * 移除pages/config/_locales中home相关部分 * 添加美食区屏蔽开关 * fix:浏览器兼容性修复 在edge中bilibili实际使用语言与插件识别语言不同的临时解决方案; 修复在部分浏览器下,由于该模块与b站主页分区异步加载导致插件实际失效的bug * 增加语言主动选择 & 增加uid统计选项 * 去掉了对language模块的依赖 & 调整i18n工具函数默认逻辑 * 替换屏蔽分区模块中错误的key * 修复首页屏蔽bug * 具有人文关怀的视频页独立深色 * 视频深色按钮还原到锚点加载 * 修复部分深色模式的问题 * 修复去污粉无法屏蔽舰长消息的bug * 调整深色模式 播放页 接下来播放 .next-play 的颜色 (#793) 并不是添加新的样式,而是仅使用 .card-box 选择了所有的视频卡片,将 .next-play 下的 .card-box 也包含在内。 * 修复pip,弹幕特殊字符问题,视频下载问题 * 修复部分用户无法下载视频的问题
- Loading branch information
Showing
29 changed files
with
221 additions
and
143 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,98 @@ | ||
import React from 'react'; | ||
import store from 'store'; | ||
import styled from 'styled-components'; | ||
import {Button} from 'Components/common/Button'; | ||
import {VideoPlayDarkMode} from 'Modules/darkMode/UI/DarkMode'; | ||
|
||
/** | ||
* Author: DrowsyFlesh | ||
* Create: 2019-05-14 | ||
* Description: | ||
*/ | ||
|
||
export default () => { | ||
const VideoDarkModeButton = styled(Button).attrs({ | ||
className: `bilibili-helper-video-dark-mode-btn`, | ||
})` | ||
position: absolute; | ||
right: 66px; | ||
top: 14px; | ||
border-radius: 4px; | ||
button { | ||
padding: 0 4px; | ||
min-width: unset; | ||
font-size: 12px; | ||
border: 1px solid #fb7299; | ||
border-radius: 4px; | ||
color: ${({on}) => on ? '#fff' : '#fb7299'}; | ||
background-color: ${({on}) => on ? '#fb7299' : '#fff'}; | ||
cursor: pointer; | ||
} | ||
`; | ||
|
||
return class VideoBtn extends React.Component { | ||
constructor(props) { | ||
super(props); | ||
this.darkStore = store.get('videoDark'); | ||
this.darkTwoFactor = store.get('videoDarkTwoFactor'); | ||
this.state = { | ||
showDark: this.darkStore, | ||
}; | ||
this.isOldPageOrWatchLater = !!document.querySelector('#__bofqi,.view-later-module, #bangumi_detail'); | ||
} | ||
|
||
componentDidMount() { | ||
chrome.runtime.sendMessage({ | ||
command: 'getSetting', | ||
feature: 'darkMode', | ||
}, (settings) => { | ||
this.darkGlobal = settings.on; | ||
if (settings.on && !this.darkTwoFactor) { | ||
const darkFollowSys = settings.options.filter((item) => item.key === 'darkFollowSys')[0]; | ||
if (darkFollowSys.on) { | ||
const sysDark = matchMedia("(prefers-color-scheme: dark)"); | ||
this.setState({showDark: sysDark.matches}); | ||
sysDark.onchange = () => { | ||
this.setState({showDark: sysDark.matches}); | ||
}; | ||
} else { | ||
this.setState({showDark: true}); | ||
} | ||
if (this.darkStore === false) { | ||
let time = store.get('videoDarkTime'); | ||
time = time !== undefined ? ++time : 1; | ||
if (time > 3) { | ||
store.remove('videoDark'); | ||
store.remove('videoDarkTime'); | ||
} else { | ||
store.set('videoDarkTime', time); | ||
} | ||
} | ||
} | ||
}); | ||
} | ||
|
||
handleOnClick = () => { | ||
const on = !this.state.showDark; | ||
this.setState({showDark: on}); | ||
store.set('videoDark', on); | ||
if (!on && this.darkStore === false && this.darkGlobal && !this.darkTwoFactor) { | ||
store.set('videoDarkTwoFactor', true); | ||
} | ||
if (on && !this.darkGlobal && this.darkTwoFactor) { | ||
store.set('videoDarkTwoFactor', false); | ||
} | ||
}; | ||
|
||
render() { | ||
const on = this.state.showDark; | ||
return ( | ||
<React.Fragment> | ||
<VideoDarkModeButton onClick={this.handleOnClick} | ||
on={on && !this.isOldPageOrWatchLater}>深色模式</VideoDarkModeButton> | ||
{on && !this.isOldPageOrWatchLater && <VideoPlayDarkMode/>} | ||
</React.Fragment> | ||
); | ||
} | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.