Add narrow danmaku and player shadow

This commit is contained in:
the1812 2019-04-30 12:07:29 +08:00
parent e60bc68bc7
commit 8414f125db
13 changed files with 76 additions and 18 deletions

View File

@ -225,6 +225,8 @@ declare global
customNavbar: boolean,
customNavbarFill: boolean,
customNavbarShadow: boolean,
playerShadow: boolean,
narrowDanmaku: boolean,
favoritesRedirect: boolean,
outerWatchlater: boolean,
cache: {} | { version: string } | undefined,

View File

@ -6,7 +6,9 @@ export function loadResources()
Resource.reloadables = {
useDarkStyle: "useDarkStyle",
hideBanner: "hideBanner",
customNavbar: "customNavbar"
customNavbar: "customNavbar",
playerShadow: "playerShadow",
narrowDanmaku: "narrowDanmaku",
};
for (const [key, data] of Object.entries(Resource.manifest))
{

View File

@ -450,17 +450,14 @@ Resource.manifest = {
},
useCommentStyle: {
path: "comment.min.js",
style: {
important: true,
condition: () => true,
},
styles: [
{
key: "commentDarkStyle",
important: true,
condition: () => settings.useDarkStyle,
},
],
style: "important",
// styles: [
// {
// key: "commentDarkStyle",
// important: true,
// condition: () => settings.useDarkStyle,
// },
// ],
displayNames: {
useCommentStyle: "简化评论区",
},
@ -564,5 +561,17 @@ Resource.manifest = {
outerWatchlater: "外置稍后再看",
},
},
playerShadow: {
path: "player-shadow.min.js",
displayNames: {
playerShadow: "播放器投影",
},
},
narrowDanmaku: {
path: "narrow-danmaku.min.js",
displayNames: {
narrowDanmaku: "强制保留弹幕栏",
},
},
};
export const resourceManifest = Resource.manifest;

View File

@ -1,10 +1,8 @@
export const settings = {
useDarkStyle: false,
useNewStyle: true,
compactLayout: false,
// showBanner: true,
hideBanner: false,
overrideNavBar: true,
expandDanmakuList: true,
expandDescription: true,
watchLaterRedirect: true,
@ -78,6 +76,8 @@ export const settings = {
customNavbar: false,
customNavbarFill: true,
customNavbarShadow: true,
playerShadow: false,
narrowDanmaku: true,
favoritesRedirect: true,
outerWatchlater: true,
cache: {},
@ -94,6 +94,8 @@ const fixedSettings = {
medalHelper: true,
about: false,
forceWide: false,
useNewStyle: false,
overrideNavBar: false,
latestVersionLink: "https://github.com/the1812/Bilibili-Evolved/raw/preview/bilibili-evolved.preview.user.js",
currentVersion: GM_info.script.version,
};

File diff suppressed because one or more lines are too long

1
min/narrow-danmaku.min.js vendored Normal file
View File

@ -0,0 +1 @@
(()=>{return(e,l)=>{const i=`<style id="narrow-danmaku-style">\n@media screen and (max-width: 1200px)\n{\n .bilibili-player.mode-webfullscreen .bilibili-player-video-control-wrap .bilibili-player-video-control-bottom-center .bilibili-player-video-sendbar .bilibili-player-video-inputbar\n {\n display: flex !important;\n }\n}\n</style>`;l.applyStyleFromText(i);return{reload:()=>l.applyStyleFromText(i),unload:()=>document.getElementById("narrow-danmaku-style").remove()}}})();

1
min/player-shadow.min.js vendored Normal file
View File

@ -0,0 +1 @@
(()=>{return(e,l)=>{const o=`<style id="player-shadow-style">\n #bilibiliPlayer\n {\n box-shadow: 0px 2px 8px 0px var(--theme-color-30) !important;\n }\n body.dark #bilibiliPlayer\n {\n box-shadow: 0px 2px 8px 0px var(--theme-color-20) !important;\n }\n</style>`;l.applyStyleFromText(o);return{reload:()=>l.applyStyleFromText(o),unload:()=>document.getElementById("player-shadow-style").remove()}}})();

File diff suppressed because one or more lines are too long

14
style/narrow-danmaku.js Normal file
View File

@ -0,0 +1,14 @@
const style = `<style id="narrow-danmaku-style">
@media screen and (max-width: 1200px)
{
.bilibili-player.mode-webfullscreen .bilibili-player-video-control-wrap .bilibili-player-video-control-bottom-center .bilibili-player-video-sendbar .bilibili-player-video-inputbar
{
display: flex !important;
}
}
</style>`;
resources.applyStyleFromText(style);
export default {
reload: () => resources.applyStyleFromText(style),
unload: () => document.getElementById("narrow-danmaku-style").remove(),
};

15
style/player-shadow.js Normal file
View File

@ -0,0 +1,15 @@
const style = `<style id="player-shadow-style">
#bilibiliPlayer
{
box-shadow: 0px 2px 8px 0px var(--theme-color-30) !important;
}
body.dark #bilibiliPlayer
{
box-shadow: 0px 2px 8px 0px var(--theme-color-20) !important;
}
</style>`;
resources.applyStyleFromText(style);
export default {
reload: () => resources.applyStyleFromText(style),
unload: () => document.getElementById("player-shadow-style").remove(),
};

View File

@ -65,6 +65,8 @@
<checkbox indent="0" key="useCommentStyle" dependencies=""></checkbox>
<checkbox indent="0" key="simplifyLiveroom" dependencies=""></checkbox>
<checkbox indent="0" key="hideBanner" dependencies=""></checkbox>
<checkbox indent="0" key="playerShadow" dependencies=""></checkbox>
<checkbox indent="0" key="narrowDanmaku" dependencies=""></checkbox>
<!-- <checkbox indent="0" key="overrideNavBar" dependencies=""></checkbox> -->
<!-- <checkbox indent="0" key="showBanner" dependencies=""></checkbox> -->
<!-- <checkbox indent="1" key="preserveRank" dependencies="overrideNavBar"></checkbox> -->

View File

@ -88,7 +88,12 @@ export const toolTips = new Map([
["useCache", `使用缓存以提高脚本的加载速度.`],
["outerWatchlater", `将视频页面菜单里的<span>稍后再看</span>移到外面.`],
["i18n", `为界面中一些常用文本提供翻译.`],
["i18nLanguage", `翻译的目标语言`],
["i18nLanguage", `翻译的目标语言.`],
["customNavbar", `启用自定义顶栏, 替代原版的顶栏, 仅对主站生效, 不影响直播/相簿/会员购等.`],
["customNavbarFill", `是否使用主题色填充顶栏.`],
["customNavbarShadow", `是否为顶栏添加一层阴影效果.`],
["playerShadow", `为播放器添加主题色投影.`],
["narrowDanmaku", `在网页全屏时, 即使宽度过小也强制保留弹幕发送栏, 注意这可能导致右侧的功能按钮挤出边界.`],
]);
export default {
export: { toolTips },

View File

@ -88,7 +88,12 @@ export const toolTips = new Map<keyof BilibiliEvolvedSettings, string>([
["useCache", `使用缓存以提高脚本的加载速度.`],
["outerWatchlater", `将视频页面菜单里的<span>稍后再看</span>移到外面.`],
["i18n", `为界面中一些常用文本提供翻译.`],
["i18nLanguage", `翻译的目标语言`],
["i18nLanguage", `翻译的目标语言.`],
["customNavbar", `启用自定义顶栏, 替代原版的顶栏, 仅对主站生效, 不影响直播/相簿/会员购等.`],
["customNavbarFill", `是否使用主题色填充顶栏.`],
["customNavbarShadow", `是否为顶栏添加一层阴影效果.`],
["playerShadow", `为播放器添加主题色投影.`],
["narrowDanmaku", `在网页全屏时, 即使宽度过小也强制保留弹幕发送栏, 注意这可能导致右侧的功能按钮挤出边界.`],
]);
export default {
export: { toolTips },