Refactor reloadables manifest

This commit is contained in:
the1812 2019-09-25 14:55:32 +08:00
parent d944269777
commit 1f8569b89c
6 changed files with 225 additions and 105 deletions

View File

@ -573,31 +573,35 @@ function loadResources () {
Resource.root = 'https://raw.githubusercontent.com/the1812/Bilibili-Evolved/master/' Resource.root = 'https://raw.githubusercontent.com/the1812/Bilibili-Evolved/master/'
Resource.all = {} Resource.all = {}
Resource.displayNames = {} Resource.displayNames = {}
Resource.reloadables = [ // Resource.reloadables = [
'useDarkStyle', // 'useDarkStyle',
'hideBanner', // 'hideBanner',
'customNavbar', // 'customNavbar',
'playerShadow', // 'playerShadow',
'narrowDanmaku', // 'narrowDanmaku',
'compactLayout', // 'compactLayout',
'useCommentStyle', // 'useCommentStyle',
'removeVideoTopMask', // 'removeVideoTopMask',
'hideOldEntry', // 'hideOldEntry',
'hideBangumiReviews', // 'hideBangumiReviews',
'videoScreenshot', // 'videoScreenshot',
'blurVideoControl', // 'blurVideoControl',
'customControlBackground', // 'customControlBackground',
'harunaScale', // 'harunaScale',
'removeLiveWatermark', // 'removeLiveWatermark',
'framePlayback', // 'framePlayback',
'hideCategory', // 'hideCategory',
'fullTweetsTitle', // 'fullTweetsTitle',
'fullActivityContent', // 'fullActivityContent',
] // ]
Resource.reloadables = []
for (const [key, data] of Object.entries(Resource.manifest)) { for (const [key, data] of Object.entries(Resource.manifest)) {
const resource = new Resource(data.path, { styles: data.styles, alwaysPreview: data.alwaysPreview }) const resource = new Resource(data.path, { styles: data.styles, alwaysPreview: data.alwaysPreview })
resource.key = key resource.key = key
resource.dropdown = data.dropdown resource.dropdown = data.dropdown
if (data.reloadable) {
Resource.reloadables.push(key)
}
if (data.displayNames) { if (data.displayNames) {
resource.displayName = data.displayNames[key] resource.displayName = data.displayNames[key]
Object.assign(Resource.displayNames, data.displayNames) Object.assign(Resource.displayNames, data.displayNames)
@ -1399,6 +1403,7 @@ Resource.manifest = {
}, },
useDarkStyle: { useDarkStyle: {
path: 'dark-styles.min.js', path: 'dark-styles.min.js',
reloadable: true,
alwaysPreview: true, alwaysPreview: true,
styles: [ styles: [
'darkStyle', 'darkStyle',
@ -1446,6 +1451,7 @@ Resource.manifest = {
}, },
hideBanner: { hideBanner: {
path: 'hide-banner.min.js', path: 'hide-banner.min.js',
reloadable: true,
style: 'instant', style: 'instant',
displayNames: { displayNames: {
hideBanner: '隐藏顶部横幅' hideBanner: '隐藏顶部横幅'
@ -1496,18 +1502,21 @@ Resource.manifest = {
}, },
harunaScale: { harunaScale: {
path: 'haruna-scale.min.js', path: 'haruna-scale.min.js',
reloadable: true,
displayNames: { displayNames: {
harunaScale: '缩放直播看板娘' harunaScale: '缩放直播看板娘'
} }
}, },
removeLiveWatermark: { removeLiveWatermark: {
path: 'remove-watermark.min.js', path: 'remove-watermark.min.js',
reloadable: true,
displayNames: { displayNames: {
removeLiveWatermark: '删除直播水印' removeLiveWatermark: '删除直播水印'
} }
}, },
fullTweetsTitle: { fullTweetsTitle: {
path: 'full-tweets-title.min.js', path: 'full-tweets-title.min.js',
reloadable: true,
style: 'instant', style: 'instant',
displayNames: { displayNames: {
fullTweetsTitle: '展开动态标题' fullTweetsTitle: '展开动态标题'
@ -1550,12 +1559,14 @@ Resource.manifest = {
}, },
removeVideoTopMask: { removeVideoTopMask: {
path: 'remove-top-mask.min.js', path: 'remove-top-mask.min.js',
reloadable: true,
displayNames: { displayNames: {
removeVideoTopMask: '删除视频标题层' removeVideoTopMask: '删除视频标题层'
} }
}, },
blurVideoControl: { blurVideoControl: {
path: 'blur-video-control.min.js', path: 'blur-video-control.min.js',
reloadable: true,
style: 'instant', style: 'instant',
displayNames: { displayNames: {
blurVideoControl: '模糊视频控制栏背景' blurVideoControl: '模糊视频控制栏背景'
@ -1617,6 +1628,7 @@ Resource.manifest = {
}, },
customControlBackground: { customControlBackground: {
path: 'custom-control-background.min.js', path: 'custom-control-background.min.js',
reloadable: true,
style: { style: {
key: 'customControlBackgroundStyle', key: 'customControlBackgroundStyle',
condition: () => settings.customControlBackgroundOpacity > 0 condition: () => settings.customControlBackgroundOpacity > 0
@ -1714,6 +1726,7 @@ Resource.manifest = {
}, },
compactLayout: { compactLayout: {
path: 'compact-layout.min.js', path: 'compact-layout.min.js',
reloadable: true,
style: true, style: true,
displayNames: { displayNames: {
compactLayout: '首页使用紧凑布局' compactLayout: '首页使用紧凑布局'
@ -1747,6 +1760,7 @@ Resource.manifest = {
}, },
useCommentStyle: { useCommentStyle: {
path: 'comment.min.js', path: 'comment.min.js',
reloadable: true,
style: 'important', style: 'important',
displayNames: { displayNames: {
useCommentStyle: '简化评论区' useCommentStyle: '简化评论区'
@ -1772,6 +1786,7 @@ Resource.manifest = {
}, },
framePlayback: { framePlayback: {
path: 'frame-playback.min.js', path: 'frame-playback.min.js',
reloadable: true,
style: 'instant', style: 'instant',
html: true, html: true,
displayNames: { displayNames: {
@ -1836,6 +1851,7 @@ Resource.manifest = {
}, },
customNavbar: { customNavbar: {
path: 'custom-navbar.min.js', path: 'custom-navbar.min.js',
reloadable: true,
style: 'instant', style: 'instant',
html: true, html: true,
displayNames: { displayNames: {
@ -1864,24 +1880,28 @@ Resource.manifest = {
}, },
playerShadow: { playerShadow: {
path: 'player-shadow.min.js', path: 'player-shadow.min.js',
reloadable: true,
displayNames: { displayNames: {
playerShadow: '播放器投影' playerShadow: '播放器投影'
} }
}, },
narrowDanmaku: { narrowDanmaku: {
path: 'narrow-danmaku.min.js', path: 'narrow-danmaku.min.js',
reloadable: true,
displayNames: { displayNames: {
narrowDanmaku: '强制保留弹幕栏' narrowDanmaku: '强制保留弹幕栏'
} }
}, },
hideOldEntry: { hideOldEntry: {
path: 'hide-old-entry.min.js', path: 'hide-old-entry.min.js',
reloadable: true,
displayNames: { displayNames: {
hideOldEntry: '隐藏返回旧版' hideOldEntry: '隐藏返回旧版'
} }
}, },
videoScreenshot: { videoScreenshot: {
path: 'screenshot.min.js', path: 'screenshot.min.js',
reloadable: true,
style: true, style: true,
displayNames: { displayNames: {
videoScreenshot: '启用视频截图' videoScreenshot: '启用视频截图'
@ -1892,6 +1912,7 @@ Resource.manifest = {
}, },
hideBangumiReviews: { hideBangumiReviews: {
path: 'hide-bangumi-reviews.min.js', path: 'hide-bangumi-reviews.min.js',
reloadable: true,
displayNames: { displayNames: {
hideBangumiReviews: '隐藏番剧点评' hideBangumiReviews: '隐藏番剧点评'
} }
@ -1911,6 +1932,7 @@ Resource.manifest = {
}, },
hideCategory: { hideCategory: {
path: 'hide-category.min.js', path: 'hide-category.min.js',
reloadable: true,
style: 'instant', style: 'instant',
displayNames: { displayNames: {
hideCategory: '隐藏分区栏', hideCategory: '隐藏分区栏',
@ -1974,6 +1996,7 @@ Resource.manifest = {
}, },
fullActivityContent: { fullActivityContent: {
path: 'full-activity-content.min.js', path: 'full-activity-content.min.js',
reloadable: true,
displayNames: { displayNames: {
fullActivityContent: '展开动态内容', fullActivityContent: '展开动态内容',
}, },
@ -1986,6 +2009,7 @@ Resource.manifest = {
}, },
selectableColumnText: { selectableColumnText: {
path: 'selectable-column-text.min.js', path: 'selectable-column-text.min.js',
reloadable: true,
displayNames: { displayNames: {
selectableColumnText: '专栏文字选择', selectableColumnText: '专栏文字选择',
}, },

View File

@ -573,31 +573,35 @@ function loadResources () {
Resource.root = 'https://raw.githubusercontent.com/the1812/Bilibili-Evolved/master/' Resource.root = 'https://raw.githubusercontent.com/the1812/Bilibili-Evolved/master/'
Resource.all = {} Resource.all = {}
Resource.displayNames = {} Resource.displayNames = {}
Resource.reloadables = [ // Resource.reloadables = [
'useDarkStyle', // 'useDarkStyle',
'hideBanner', // 'hideBanner',
'customNavbar', // 'customNavbar',
'playerShadow', // 'playerShadow',
'narrowDanmaku', // 'narrowDanmaku',
'compactLayout', // 'compactLayout',
'useCommentStyle', // 'useCommentStyle',
'removeVideoTopMask', // 'removeVideoTopMask',
'hideOldEntry', // 'hideOldEntry',
'hideBangumiReviews', // 'hideBangumiReviews',
'videoScreenshot', // 'videoScreenshot',
'blurVideoControl', // 'blurVideoControl',
'customControlBackground', // 'customControlBackground',
'harunaScale', // 'harunaScale',
'removeLiveWatermark', // 'removeLiveWatermark',
'framePlayback', // 'framePlayback',
'hideCategory', // 'hideCategory',
'fullTweetsTitle', // 'fullTweetsTitle',
'fullActivityContent', // 'fullActivityContent',
] // ]
Resource.reloadables = []
for (const [key, data] of Object.entries(Resource.manifest)) { for (const [key, data] of Object.entries(Resource.manifest)) {
const resource = new Resource(data.path, { styles: data.styles, alwaysPreview: data.alwaysPreview }) const resource = new Resource(data.path, { styles: data.styles, alwaysPreview: data.alwaysPreview })
resource.key = key resource.key = key
resource.dropdown = data.dropdown resource.dropdown = data.dropdown
if (data.reloadable) {
Resource.reloadables.push(key)
}
if (data.displayNames) { if (data.displayNames) {
resource.displayName = data.displayNames[key] resource.displayName = data.displayNames[key]
Object.assign(Resource.displayNames, data.displayNames) Object.assign(Resource.displayNames, data.displayNames)
@ -1399,6 +1403,7 @@ Resource.manifest = {
}, },
useDarkStyle: { useDarkStyle: {
path: 'dark-styles.min.js', path: 'dark-styles.min.js',
reloadable: true,
alwaysPreview: true, alwaysPreview: true,
styles: [ styles: [
'darkStyle', 'darkStyle',
@ -1446,6 +1451,7 @@ Resource.manifest = {
}, },
hideBanner: { hideBanner: {
path: 'hide-banner.min.js', path: 'hide-banner.min.js',
reloadable: true,
style: 'instant', style: 'instant',
displayNames: { displayNames: {
hideBanner: '隐藏顶部横幅' hideBanner: '隐藏顶部横幅'
@ -1496,18 +1502,21 @@ Resource.manifest = {
}, },
harunaScale: { harunaScale: {
path: 'haruna-scale.min.js', path: 'haruna-scale.min.js',
reloadable: true,
displayNames: { displayNames: {
harunaScale: '缩放直播看板娘' harunaScale: '缩放直播看板娘'
} }
}, },
removeLiveWatermark: { removeLiveWatermark: {
path: 'remove-watermark.min.js', path: 'remove-watermark.min.js',
reloadable: true,
displayNames: { displayNames: {
removeLiveWatermark: '删除直播水印' removeLiveWatermark: '删除直播水印'
} }
}, },
fullTweetsTitle: { fullTweetsTitle: {
path: 'full-tweets-title.min.js', path: 'full-tweets-title.min.js',
reloadable: true,
style: 'instant', style: 'instant',
displayNames: { displayNames: {
fullTweetsTitle: '展开动态标题' fullTweetsTitle: '展开动态标题'
@ -1550,12 +1559,14 @@ Resource.manifest = {
}, },
removeVideoTopMask: { removeVideoTopMask: {
path: 'remove-top-mask.min.js', path: 'remove-top-mask.min.js',
reloadable: true,
displayNames: { displayNames: {
removeVideoTopMask: '删除视频标题层' removeVideoTopMask: '删除视频标题层'
} }
}, },
blurVideoControl: { blurVideoControl: {
path: 'blur-video-control.min.js', path: 'blur-video-control.min.js',
reloadable: true,
style: 'instant', style: 'instant',
displayNames: { displayNames: {
blurVideoControl: '模糊视频控制栏背景' blurVideoControl: '模糊视频控制栏背景'
@ -1617,6 +1628,7 @@ Resource.manifest = {
}, },
customControlBackground: { customControlBackground: {
path: 'custom-control-background.min.js', path: 'custom-control-background.min.js',
reloadable: true,
style: { style: {
key: 'customControlBackgroundStyle', key: 'customControlBackgroundStyle',
condition: () => settings.customControlBackgroundOpacity > 0 condition: () => settings.customControlBackgroundOpacity > 0
@ -1714,6 +1726,7 @@ Resource.manifest = {
}, },
compactLayout: { compactLayout: {
path: 'compact-layout.min.js', path: 'compact-layout.min.js',
reloadable: true,
style: true, style: true,
displayNames: { displayNames: {
compactLayout: '首页使用紧凑布局' compactLayout: '首页使用紧凑布局'
@ -1747,6 +1760,7 @@ Resource.manifest = {
}, },
useCommentStyle: { useCommentStyle: {
path: 'comment.min.js', path: 'comment.min.js',
reloadable: true,
style: 'important', style: 'important',
displayNames: { displayNames: {
useCommentStyle: '简化评论区' useCommentStyle: '简化评论区'
@ -1772,6 +1786,7 @@ Resource.manifest = {
}, },
framePlayback: { framePlayback: {
path: 'frame-playback.min.js', path: 'frame-playback.min.js',
reloadable: true,
style: 'instant', style: 'instant',
html: true, html: true,
displayNames: { displayNames: {
@ -1836,6 +1851,7 @@ Resource.manifest = {
}, },
customNavbar: { customNavbar: {
path: 'custom-navbar.min.js', path: 'custom-navbar.min.js',
reloadable: true,
style: 'instant', style: 'instant',
html: true, html: true,
displayNames: { displayNames: {
@ -1864,24 +1880,28 @@ Resource.manifest = {
}, },
playerShadow: { playerShadow: {
path: 'player-shadow.min.js', path: 'player-shadow.min.js',
reloadable: true,
displayNames: { displayNames: {
playerShadow: '播放器投影' playerShadow: '播放器投影'
} }
}, },
narrowDanmaku: { narrowDanmaku: {
path: 'narrow-danmaku.min.js', path: 'narrow-danmaku.min.js',
reloadable: true,
displayNames: { displayNames: {
narrowDanmaku: '强制保留弹幕栏' narrowDanmaku: '强制保留弹幕栏'
} }
}, },
hideOldEntry: { hideOldEntry: {
path: 'hide-old-entry.min.js', path: 'hide-old-entry.min.js',
reloadable: true,
displayNames: { displayNames: {
hideOldEntry: '隐藏返回旧版' hideOldEntry: '隐藏返回旧版'
} }
}, },
videoScreenshot: { videoScreenshot: {
path: 'screenshot.min.js', path: 'screenshot.min.js',
reloadable: true,
style: true, style: true,
displayNames: { displayNames: {
videoScreenshot: '启用视频截图' videoScreenshot: '启用视频截图'
@ -1892,6 +1912,7 @@ Resource.manifest = {
}, },
hideBangumiReviews: { hideBangumiReviews: {
path: 'hide-bangumi-reviews.min.js', path: 'hide-bangumi-reviews.min.js',
reloadable: true,
displayNames: { displayNames: {
hideBangumiReviews: '隐藏番剧点评' hideBangumiReviews: '隐藏番剧点评'
} }
@ -1911,6 +1932,7 @@ Resource.manifest = {
}, },
hideCategory: { hideCategory: {
path: 'hide-category.min.js', path: 'hide-category.min.js',
reloadable: true,
style: 'instant', style: 'instant',
displayNames: { displayNames: {
hideCategory: '隐藏分区栏', hideCategory: '隐藏分区栏',
@ -1974,6 +1996,7 @@ Resource.manifest = {
}, },
fullActivityContent: { fullActivityContent: {
path: 'full-activity-content.min.js', path: 'full-activity-content.min.js',
reloadable: true,
displayNames: { displayNames: {
fullActivityContent: '展开动态内容', fullActivityContent: '展开动态内容',
}, },
@ -1986,6 +2009,7 @@ Resource.manifest = {
}, },
selectableColumnText: { selectableColumnText: {
path: 'selectable-column-text.min.js', path: 'selectable-column-text.min.js',
reloadable: true,
displayNames: { displayNames: {
selectableColumnText: '专栏文字选择', selectableColumnText: '专栏文字选择',
}, },

View File

@ -572,31 +572,35 @@ function loadResources () {
Resource.root = 'https://raw.githubusercontent.com/the1812/Bilibili-Evolved/preview/' Resource.root = 'https://raw.githubusercontent.com/the1812/Bilibili-Evolved/preview/'
Resource.all = {} Resource.all = {}
Resource.displayNames = {} Resource.displayNames = {}
Resource.reloadables = [ // Resource.reloadables = [
'useDarkStyle', // 'useDarkStyle',
'hideBanner', // 'hideBanner',
'customNavbar', // 'customNavbar',
'playerShadow', // 'playerShadow',
'narrowDanmaku', // 'narrowDanmaku',
'compactLayout', // 'compactLayout',
'useCommentStyle', // 'useCommentStyle',
'removeVideoTopMask', // 'removeVideoTopMask',
'hideOldEntry', // 'hideOldEntry',
'hideBangumiReviews', // 'hideBangumiReviews',
'videoScreenshot', // 'videoScreenshot',
'blurVideoControl', // 'blurVideoControl',
'customControlBackground', // 'customControlBackground',
'harunaScale', // 'harunaScale',
'removeLiveWatermark', // 'removeLiveWatermark',
'framePlayback', // 'framePlayback',
'hideCategory', // 'hideCategory',
'fullTweetsTitle', // 'fullTweetsTitle',
'fullActivityContent', // 'fullActivityContent',
] // ]
Resource.reloadables = []
for (const [key, data] of Object.entries(Resource.manifest)) { for (const [key, data] of Object.entries(Resource.manifest)) {
const resource = new Resource(data.path, { styles: data.styles, alwaysPreview: data.alwaysPreview }) const resource = new Resource(data.path, { styles: data.styles, alwaysPreview: data.alwaysPreview })
resource.key = key resource.key = key
resource.dropdown = data.dropdown resource.dropdown = data.dropdown
if (data.reloadable) {
Resource.reloadables.push(key)
}
if (data.displayNames) { if (data.displayNames) {
resource.displayName = data.displayNames[key] resource.displayName = data.displayNames[key]
Object.assign(Resource.displayNames, data.displayNames) Object.assign(Resource.displayNames, data.displayNames)
@ -1452,6 +1456,7 @@ Resource.manifest = {
}, },
useDarkStyle: { useDarkStyle: {
path: 'dark-styles.min.js', path: 'dark-styles.min.js',
reloadable: true,
alwaysPreview: true, alwaysPreview: true,
styles: [ styles: [
'darkStyle', 'darkStyle',
@ -1499,6 +1504,7 @@ Resource.manifest = {
}, },
hideBanner: { hideBanner: {
path: 'hide-banner.min.js', path: 'hide-banner.min.js',
reloadable: true,
style: 'instant', style: 'instant',
displayNames: { displayNames: {
hideBanner: '隐藏顶部横幅' hideBanner: '隐藏顶部横幅'
@ -1549,18 +1555,21 @@ Resource.manifest = {
}, },
harunaScale: { harunaScale: {
path: 'haruna-scale.min.js', path: 'haruna-scale.min.js',
reloadable: true,
displayNames: { displayNames: {
harunaScale: '缩放直播看板娘' harunaScale: '缩放直播看板娘'
} }
}, },
removeLiveWatermark: { removeLiveWatermark: {
path: 'remove-watermark.min.js', path: 'remove-watermark.min.js',
reloadable: true,
displayNames: { displayNames: {
removeLiveWatermark: '删除直播水印' removeLiveWatermark: '删除直播水印'
} }
}, },
fullTweetsTitle: { fullTweetsTitle: {
path: 'full-tweets-title.min.js', path: 'full-tweets-title.min.js',
reloadable: true,
style: 'instant', style: 'instant',
displayNames: { displayNames: {
fullTweetsTitle: '展开动态标题' fullTweetsTitle: '展开动态标题'
@ -1603,12 +1612,14 @@ Resource.manifest = {
}, },
removeVideoTopMask: { removeVideoTopMask: {
path: 'remove-top-mask.min.js', path: 'remove-top-mask.min.js',
reloadable: true,
displayNames: { displayNames: {
removeVideoTopMask: '删除视频标题层' removeVideoTopMask: '删除视频标题层'
} }
}, },
blurVideoControl: { blurVideoControl: {
path: 'blur-video-control.min.js', path: 'blur-video-control.min.js',
reloadable: true,
style: 'instant', style: 'instant',
displayNames: { displayNames: {
blurVideoControl: '模糊视频控制栏背景' blurVideoControl: '模糊视频控制栏背景'
@ -1670,6 +1681,7 @@ Resource.manifest = {
}, },
customControlBackground: { customControlBackground: {
path: 'custom-control-background.min.js', path: 'custom-control-background.min.js',
reloadable: true,
style: { style: {
key: 'customControlBackgroundStyle', key: 'customControlBackgroundStyle',
condition: () => settings.customControlBackgroundOpacity > 0 condition: () => settings.customControlBackgroundOpacity > 0
@ -1767,6 +1779,7 @@ Resource.manifest = {
}, },
compactLayout: { compactLayout: {
path: 'compact-layout.min.js', path: 'compact-layout.min.js',
reloadable: true,
style: true, style: true,
displayNames: { displayNames: {
compactLayout: '首页使用紧凑布局' compactLayout: '首页使用紧凑布局'
@ -1800,6 +1813,7 @@ Resource.manifest = {
}, },
useCommentStyle: { useCommentStyle: {
path: 'comment.min.js', path: 'comment.min.js',
reloadable: true,
style: 'important', style: 'important',
displayNames: { displayNames: {
useCommentStyle: '简化评论区' useCommentStyle: '简化评论区'
@ -1825,6 +1839,7 @@ Resource.manifest = {
}, },
framePlayback: { framePlayback: {
path: 'frame-playback.min.js', path: 'frame-playback.min.js',
reloadable: true,
style: 'instant', style: 'instant',
html: true, html: true,
displayNames: { displayNames: {
@ -1889,6 +1904,7 @@ Resource.manifest = {
}, },
customNavbar: { customNavbar: {
path: 'custom-navbar.min.js', path: 'custom-navbar.min.js',
reloadable: true,
style: 'instant', style: 'instant',
html: true, html: true,
displayNames: { displayNames: {
@ -1917,24 +1933,28 @@ Resource.manifest = {
}, },
playerShadow: { playerShadow: {
path: 'player-shadow.min.js', path: 'player-shadow.min.js',
reloadable: true,
displayNames: { displayNames: {
playerShadow: '播放器投影' playerShadow: '播放器投影'
} }
}, },
narrowDanmaku: { narrowDanmaku: {
path: 'narrow-danmaku.min.js', path: 'narrow-danmaku.min.js',
reloadable: true,
displayNames: { displayNames: {
narrowDanmaku: '强制保留弹幕栏' narrowDanmaku: '强制保留弹幕栏'
} }
}, },
hideOldEntry: { hideOldEntry: {
path: 'hide-old-entry.min.js', path: 'hide-old-entry.min.js',
reloadable: true,
displayNames: { displayNames: {
hideOldEntry: '隐藏返回旧版' hideOldEntry: '隐藏返回旧版'
} }
}, },
videoScreenshot: { videoScreenshot: {
path: 'screenshot.min.js', path: 'screenshot.min.js',
reloadable: true,
style: true, style: true,
displayNames: { displayNames: {
videoScreenshot: '启用视频截图' videoScreenshot: '启用视频截图'
@ -1945,6 +1965,7 @@ Resource.manifest = {
}, },
hideBangumiReviews: { hideBangumiReviews: {
path: 'hide-bangumi-reviews.min.js', path: 'hide-bangumi-reviews.min.js',
reloadable: true,
displayNames: { displayNames: {
hideBangumiReviews: '隐藏番剧点评' hideBangumiReviews: '隐藏番剧点评'
} }
@ -1964,6 +1985,7 @@ Resource.manifest = {
}, },
hideCategory: { hideCategory: {
path: 'hide-category.min.js', path: 'hide-category.min.js',
reloadable: true,
style: 'instant', style: 'instant',
displayNames: { displayNames: {
hideCategory: '隐藏分区栏', hideCategory: '隐藏分区栏',
@ -2027,6 +2049,7 @@ Resource.manifest = {
}, },
fullActivityContent: { fullActivityContent: {
path: 'full-activity-content.min.js', path: 'full-activity-content.min.js',
reloadable: true,
displayNames: { displayNames: {
fullActivityContent: '展开动态内容', fullActivityContent: '展开动态内容',
}, },
@ -2039,6 +2062,7 @@ Resource.manifest = {
}, },
selectableColumnText: { selectableColumnText: {
path: 'selectable-column-text.min.js', path: 'selectable-column-text.min.js',
reloadable: true,
displayNames: { displayNames: {
selectableColumnText: '专栏文字选择', selectableColumnText: '专栏文字选择',
}, },

View File

@ -572,31 +572,35 @@ function loadResources () {
Resource.root = 'https://raw.githubusercontent.com/the1812/Bilibili-Evolved/master/' Resource.root = 'https://raw.githubusercontent.com/the1812/Bilibili-Evolved/master/'
Resource.all = {} Resource.all = {}
Resource.displayNames = {} Resource.displayNames = {}
Resource.reloadables = [ // Resource.reloadables = [
'useDarkStyle', // 'useDarkStyle',
'hideBanner', // 'hideBanner',
'customNavbar', // 'customNavbar',
'playerShadow', // 'playerShadow',
'narrowDanmaku', // 'narrowDanmaku',
'compactLayout', // 'compactLayout',
'useCommentStyle', // 'useCommentStyle',
'removeVideoTopMask', // 'removeVideoTopMask',
'hideOldEntry', // 'hideOldEntry',
'hideBangumiReviews', // 'hideBangumiReviews',
'videoScreenshot', // 'videoScreenshot',
'blurVideoControl', // 'blurVideoControl',
'customControlBackground', // 'customControlBackground',
'harunaScale', // 'harunaScale',
'removeLiveWatermark', // 'removeLiveWatermark',
'framePlayback', // 'framePlayback',
'hideCategory', // 'hideCategory',
'fullTweetsTitle', // 'fullTweetsTitle',
'fullActivityContent', // 'fullActivityContent',
] // ]
Resource.reloadables = []
for (const [key, data] of Object.entries(Resource.manifest)) { for (const [key, data] of Object.entries(Resource.manifest)) {
const resource = new Resource(data.path, { styles: data.styles, alwaysPreview: data.alwaysPreview }) const resource = new Resource(data.path, { styles: data.styles, alwaysPreview: data.alwaysPreview })
resource.key = key resource.key = key
resource.dropdown = data.dropdown resource.dropdown = data.dropdown
if (data.reloadable) {
Resource.reloadables.push(key)
}
if (data.displayNames) { if (data.displayNames) {
resource.displayName = data.displayNames[key] resource.displayName = data.displayNames[key]
Object.assign(Resource.displayNames, data.displayNames) Object.assign(Resource.displayNames, data.displayNames)
@ -1452,6 +1456,7 @@ Resource.manifest = {
}, },
useDarkStyle: { useDarkStyle: {
path: 'dark-styles.min.js', path: 'dark-styles.min.js',
reloadable: true,
alwaysPreview: true, alwaysPreview: true,
styles: [ styles: [
'darkStyle', 'darkStyle',
@ -1499,6 +1504,7 @@ Resource.manifest = {
}, },
hideBanner: { hideBanner: {
path: 'hide-banner.min.js', path: 'hide-banner.min.js',
reloadable: true,
style: 'instant', style: 'instant',
displayNames: { displayNames: {
hideBanner: '隐藏顶部横幅' hideBanner: '隐藏顶部横幅'
@ -1549,18 +1555,21 @@ Resource.manifest = {
}, },
harunaScale: { harunaScale: {
path: 'haruna-scale.min.js', path: 'haruna-scale.min.js',
reloadable: true,
displayNames: { displayNames: {
harunaScale: '缩放直播看板娘' harunaScale: '缩放直播看板娘'
} }
}, },
removeLiveWatermark: { removeLiveWatermark: {
path: 'remove-watermark.min.js', path: 'remove-watermark.min.js',
reloadable: true,
displayNames: { displayNames: {
removeLiveWatermark: '删除直播水印' removeLiveWatermark: '删除直播水印'
} }
}, },
fullTweetsTitle: { fullTweetsTitle: {
path: 'full-tweets-title.min.js', path: 'full-tweets-title.min.js',
reloadable: true,
style: 'instant', style: 'instant',
displayNames: { displayNames: {
fullTweetsTitle: '展开动态标题' fullTweetsTitle: '展开动态标题'
@ -1603,12 +1612,14 @@ Resource.manifest = {
}, },
removeVideoTopMask: { removeVideoTopMask: {
path: 'remove-top-mask.min.js', path: 'remove-top-mask.min.js',
reloadable: true,
displayNames: { displayNames: {
removeVideoTopMask: '删除视频标题层' removeVideoTopMask: '删除视频标题层'
} }
}, },
blurVideoControl: { blurVideoControl: {
path: 'blur-video-control.min.js', path: 'blur-video-control.min.js',
reloadable: true,
style: 'instant', style: 'instant',
displayNames: { displayNames: {
blurVideoControl: '模糊视频控制栏背景' blurVideoControl: '模糊视频控制栏背景'
@ -1670,6 +1681,7 @@ Resource.manifest = {
}, },
customControlBackground: { customControlBackground: {
path: 'custom-control-background.min.js', path: 'custom-control-background.min.js',
reloadable: true,
style: { style: {
key: 'customControlBackgroundStyle', key: 'customControlBackgroundStyle',
condition: () => settings.customControlBackgroundOpacity > 0 condition: () => settings.customControlBackgroundOpacity > 0
@ -1767,6 +1779,7 @@ Resource.manifest = {
}, },
compactLayout: { compactLayout: {
path: 'compact-layout.min.js', path: 'compact-layout.min.js',
reloadable: true,
style: true, style: true,
displayNames: { displayNames: {
compactLayout: '首页使用紧凑布局' compactLayout: '首页使用紧凑布局'
@ -1800,6 +1813,7 @@ Resource.manifest = {
}, },
useCommentStyle: { useCommentStyle: {
path: 'comment.min.js', path: 'comment.min.js',
reloadable: true,
style: 'important', style: 'important',
displayNames: { displayNames: {
useCommentStyle: '简化评论区' useCommentStyle: '简化评论区'
@ -1825,6 +1839,7 @@ Resource.manifest = {
}, },
framePlayback: { framePlayback: {
path: 'frame-playback.min.js', path: 'frame-playback.min.js',
reloadable: true,
style: 'instant', style: 'instant',
html: true, html: true,
displayNames: { displayNames: {
@ -1889,6 +1904,7 @@ Resource.manifest = {
}, },
customNavbar: { customNavbar: {
path: 'custom-navbar.min.js', path: 'custom-navbar.min.js',
reloadable: true,
style: 'instant', style: 'instant',
html: true, html: true,
displayNames: { displayNames: {
@ -1917,24 +1933,28 @@ Resource.manifest = {
}, },
playerShadow: { playerShadow: {
path: 'player-shadow.min.js', path: 'player-shadow.min.js',
reloadable: true,
displayNames: { displayNames: {
playerShadow: '播放器投影' playerShadow: '播放器投影'
} }
}, },
narrowDanmaku: { narrowDanmaku: {
path: 'narrow-danmaku.min.js', path: 'narrow-danmaku.min.js',
reloadable: true,
displayNames: { displayNames: {
narrowDanmaku: '强制保留弹幕栏' narrowDanmaku: '强制保留弹幕栏'
} }
}, },
hideOldEntry: { hideOldEntry: {
path: 'hide-old-entry.min.js', path: 'hide-old-entry.min.js',
reloadable: true,
displayNames: { displayNames: {
hideOldEntry: '隐藏返回旧版' hideOldEntry: '隐藏返回旧版'
} }
}, },
videoScreenshot: { videoScreenshot: {
path: 'screenshot.min.js', path: 'screenshot.min.js',
reloadable: true,
style: true, style: true,
displayNames: { displayNames: {
videoScreenshot: '启用视频截图' videoScreenshot: '启用视频截图'
@ -1945,6 +1965,7 @@ Resource.manifest = {
}, },
hideBangumiReviews: { hideBangumiReviews: {
path: 'hide-bangumi-reviews.min.js', path: 'hide-bangumi-reviews.min.js',
reloadable: true,
displayNames: { displayNames: {
hideBangumiReviews: '隐藏番剧点评' hideBangumiReviews: '隐藏番剧点评'
} }
@ -1964,6 +1985,7 @@ Resource.manifest = {
}, },
hideCategory: { hideCategory: {
path: 'hide-category.min.js', path: 'hide-category.min.js',
reloadable: true,
style: 'instant', style: 'instant',
displayNames: { displayNames: {
hideCategory: '隐藏分区栏', hideCategory: '隐藏分区栏',
@ -2027,6 +2049,7 @@ Resource.manifest = {
}, },
fullActivityContent: { fullActivityContent: {
path: 'full-activity-content.min.js', path: 'full-activity-content.min.js',
reloadable: true,
displayNames: { displayNames: {
fullActivityContent: '展开动态内容', fullActivityContent: '展开动态内容',
}, },
@ -2039,6 +2062,7 @@ Resource.manifest = {
}, },
selectableColumnText: { selectableColumnText: {
path: 'selectable-column-text.min.js', path: 'selectable-column-text.min.js',
reloadable: true,
displayNames: { displayNames: {
selectableColumnText: '专栏文字选择', selectableColumnText: '专栏文字选择',
}, },

View File

@ -2,31 +2,35 @@ export function loadResources () {
Resource.root = 'https://raw.githubusercontent.com/the1812/Bilibili-Evolved/preview/' Resource.root = 'https://raw.githubusercontent.com/the1812/Bilibili-Evolved/preview/'
Resource.all = {} Resource.all = {}
Resource.displayNames = {} Resource.displayNames = {}
Resource.reloadables = [ // Resource.reloadables = [
'useDarkStyle', // 'useDarkStyle',
'hideBanner', // 'hideBanner',
'customNavbar', // 'customNavbar',
'playerShadow', // 'playerShadow',
'narrowDanmaku', // 'narrowDanmaku',
'compactLayout', // 'compactLayout',
'useCommentStyle', // 'useCommentStyle',
'removeVideoTopMask', // 'removeVideoTopMask',
'hideOldEntry', // 'hideOldEntry',
'hideBangumiReviews', // 'hideBangumiReviews',
'videoScreenshot', // 'videoScreenshot',
'blurVideoControl', // 'blurVideoControl',
'customControlBackground', // 'customControlBackground',
'harunaScale', // 'harunaScale',
'removeLiveWatermark', // 'removeLiveWatermark',
'framePlayback', // 'framePlayback',
'hideCategory', // 'hideCategory',
'fullTweetsTitle', // 'fullTweetsTitle',
'fullActivityContent', // 'fullActivityContent',
] // ]
Resource.reloadables = []
for (const [key, data] of Object.entries(Resource.manifest)) { for (const [key, data] of Object.entries(Resource.manifest)) {
const resource = new Resource(data.path, { styles: data.styles, alwaysPreview: data.alwaysPreview }) const resource = new Resource(data.path, { styles: data.styles, alwaysPreview: data.alwaysPreview })
resource.key = key resource.key = key
resource.dropdown = data.dropdown resource.dropdown = data.dropdown
if (data.reloadable) {
Resource.reloadables.push(key)
}
if (data.displayNames) { if (data.displayNames) {
resource.displayName = data.displayNames[key] resource.displayName = data.displayNames[key]
Object.assign(Resource.displayNames, data.displayNames) Object.assign(Resource.displayNames, data.displayNames)

View File

@ -103,6 +103,7 @@ Resource.manifest = {
}, },
useDarkStyle: { useDarkStyle: {
path: 'dark-styles.min.js', path: 'dark-styles.min.js',
reloadable: true,
alwaysPreview: true, alwaysPreview: true,
styles: [ styles: [
'darkStyle', 'darkStyle',
@ -150,6 +151,7 @@ Resource.manifest = {
}, },
hideBanner: { hideBanner: {
path: 'hide-banner.min.js', path: 'hide-banner.min.js',
reloadable: true,
style: 'instant', style: 'instant',
displayNames: { displayNames: {
hideBanner: '隐藏顶部横幅' hideBanner: '隐藏顶部横幅'
@ -200,18 +202,21 @@ Resource.manifest = {
}, },
harunaScale: { harunaScale: {
path: 'haruna-scale.min.js', path: 'haruna-scale.min.js',
reloadable: true,
displayNames: { displayNames: {
harunaScale: '缩放直播看板娘' harunaScale: '缩放直播看板娘'
} }
}, },
removeLiveWatermark: { removeLiveWatermark: {
path: 'remove-watermark.min.js', path: 'remove-watermark.min.js',
reloadable: true,
displayNames: { displayNames: {
removeLiveWatermark: '删除直播水印' removeLiveWatermark: '删除直播水印'
} }
}, },
fullTweetsTitle: { fullTweetsTitle: {
path: 'full-tweets-title.min.js', path: 'full-tweets-title.min.js',
reloadable: true,
style: 'instant', style: 'instant',
displayNames: { displayNames: {
fullTweetsTitle: '展开动态标题' fullTweetsTitle: '展开动态标题'
@ -254,12 +259,14 @@ Resource.manifest = {
}, },
removeVideoTopMask: { removeVideoTopMask: {
path: 'remove-top-mask.min.js', path: 'remove-top-mask.min.js',
reloadable: true,
displayNames: { displayNames: {
removeVideoTopMask: '删除视频标题层' removeVideoTopMask: '删除视频标题层'
} }
}, },
blurVideoControl: { blurVideoControl: {
path: 'blur-video-control.min.js', path: 'blur-video-control.min.js',
reloadable: true,
style: 'instant', style: 'instant',
displayNames: { displayNames: {
blurVideoControl: '模糊视频控制栏背景' blurVideoControl: '模糊视频控制栏背景'
@ -321,6 +328,7 @@ Resource.manifest = {
}, },
customControlBackground: { customControlBackground: {
path: 'custom-control-background.min.js', path: 'custom-control-background.min.js',
reloadable: true,
style: { style: {
key: 'customControlBackgroundStyle', key: 'customControlBackgroundStyle',
condition: () => settings.customControlBackgroundOpacity > 0 condition: () => settings.customControlBackgroundOpacity > 0
@ -418,6 +426,7 @@ Resource.manifest = {
}, },
compactLayout: { compactLayout: {
path: 'compact-layout.min.js', path: 'compact-layout.min.js',
reloadable: true,
style: true, style: true,
displayNames: { displayNames: {
compactLayout: '首页使用紧凑布局' compactLayout: '首页使用紧凑布局'
@ -451,6 +460,7 @@ Resource.manifest = {
}, },
useCommentStyle: { useCommentStyle: {
path: 'comment.min.js', path: 'comment.min.js',
reloadable: true,
style: 'important', style: 'important',
displayNames: { displayNames: {
useCommentStyle: '简化评论区' useCommentStyle: '简化评论区'
@ -476,6 +486,7 @@ Resource.manifest = {
}, },
framePlayback: { framePlayback: {
path: 'frame-playback.min.js', path: 'frame-playback.min.js',
reloadable: true,
style: 'instant', style: 'instant',
html: true, html: true,
displayNames: { displayNames: {
@ -540,6 +551,7 @@ Resource.manifest = {
}, },
customNavbar: { customNavbar: {
path: 'custom-navbar.min.js', path: 'custom-navbar.min.js',
reloadable: true,
style: 'instant', style: 'instant',
html: true, html: true,
displayNames: { displayNames: {
@ -568,24 +580,28 @@ Resource.manifest = {
}, },
playerShadow: { playerShadow: {
path: 'player-shadow.min.js', path: 'player-shadow.min.js',
reloadable: true,
displayNames: { displayNames: {
playerShadow: '播放器投影' playerShadow: '播放器投影'
} }
}, },
narrowDanmaku: { narrowDanmaku: {
path: 'narrow-danmaku.min.js', path: 'narrow-danmaku.min.js',
reloadable: true,
displayNames: { displayNames: {
narrowDanmaku: '强制保留弹幕栏' narrowDanmaku: '强制保留弹幕栏'
} }
}, },
hideOldEntry: { hideOldEntry: {
path: 'hide-old-entry.min.js', path: 'hide-old-entry.min.js',
reloadable: true,
displayNames: { displayNames: {
hideOldEntry: '隐藏返回旧版' hideOldEntry: '隐藏返回旧版'
} }
}, },
videoScreenshot: { videoScreenshot: {
path: 'screenshot.min.js', path: 'screenshot.min.js',
reloadable: true,
style: true, style: true,
displayNames: { displayNames: {
videoScreenshot: '启用视频截图' videoScreenshot: '启用视频截图'
@ -596,6 +612,7 @@ Resource.manifest = {
}, },
hideBangumiReviews: { hideBangumiReviews: {
path: 'hide-bangumi-reviews.min.js', path: 'hide-bangumi-reviews.min.js',
reloadable: true,
displayNames: { displayNames: {
hideBangumiReviews: '隐藏番剧点评' hideBangumiReviews: '隐藏番剧点评'
} }
@ -615,6 +632,7 @@ Resource.manifest = {
}, },
hideCategory: { hideCategory: {
path: 'hide-category.min.js', path: 'hide-category.min.js',
reloadable: true,
style: 'instant', style: 'instant',
displayNames: { displayNames: {
hideCategory: '隐藏分区栏', hideCategory: '隐藏分区栏',
@ -678,6 +696,7 @@ Resource.manifest = {
}, },
fullActivityContent: { fullActivityContent: {
path: 'full-activity-content.min.js', path: 'full-activity-content.min.js',
reloadable: true,
displayNames: { displayNames: {
fullActivityContent: '展开动态内容', fullActivityContent: '展开动态内容',
}, },
@ -690,6 +709,7 @@ Resource.manifest = {
}, },
selectableColumnText: { selectableColumnText: {
path: 'selectable-column-text.min.js', path: 'selectable-column-text.min.js',
reloadable: true,
displayNames: { displayNames: {
selectableColumnText: '专栏文字选择', selectableColumnText: '专栏文字选择',
}, },