Add always preview option

This commit is contained in:
the1812 2019-06-02 13:16:27 +08:00
parent 765d78e203
commit 4bc26a297b
9 changed files with 96 additions and 161 deletions

View File

@ -1,6 +1,6 @@
// ==UserScript== // ==UserScript==
// @name Bilibili Evolved (Offline) // @name Bilibili Evolved (Offline)
// @version 320.34 // @version 320.90
// @description Bilibili Evolved 的离线版, 所有功能都已内置于脚本中. // @description Bilibili Evolved 的离线版, 所有功能都已内置于脚本中.
// @author Grant Howard, Coulomb-G // @author Grant Howard, Coulomb-G
// @copyright 2019, Grant Howard (https://github.com/the1812) & Coulomb-G (https://github.com/Coulomb-G) // @copyright 2019, Grant Howard (https://github.com/the1812) & Coulomb-G (https://github.com/Coulomb-G)
@ -534,7 +534,7 @@ function loadResources()
]; ];
for (const [key, data] of Object.entries(Resource.manifest)) for (const [key, data] of Object.entries(Resource.manifest))
{ {
const resource = new Resource(data.path, data.styles); 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.displayNames) if (data.displayNames)
@ -545,7 +545,7 @@ function loadResources()
if (data.style) if (data.style)
{ {
const styleKey = key + "Style"; const styleKey = key + "Style";
const style = Resource.all[styleKey] = new Resource(data.path.replace(".js", ".css")); const style = Resource.all[styleKey] = new Resource(data.path.replace(".js", ".css"), { alwaysPreview: data.alwaysPreview });
style.key = styleKey; style.key = styleKey;
switch (data.style) switch (data.style)
{ {
@ -580,7 +580,7 @@ function loadResources()
if (data.html === true) if (data.html === true)
{ {
const htmlKey = key + "Html"; const htmlKey = key + "Html";
const html = Resource.all[htmlKey] = new Resource(data.path.replace(".js", ".html")); const html = Resource.all[htmlKey] = new Resource(data.path.replace(".js", ".html"), { alwaysPreview: data.alwaysPreview });
html.key = htmlKey; html.key = htmlKey;
resource.dependencies.push(html); resource.dependencies.push(html);
} }
@ -1213,17 +1213,26 @@ class Resource
{ {
return this.text !== null; return this.text !== null;
} }
constructor(url, styles = []) constructor(url, { styles = [], alwaysPreview: false } = {})
{ {
this.url = Resource.root + "min/" + url; this.rawUrl = Resource.root + "min/" + url;
this.dependencies = []; this.dependencies = [];
// this.priority = priority; // this.priority = priority;
this.styles = styles; this.styles = styles;
this.text = null; this.text = null;
this.key = null; this.key = null;
this.alwaysPreview = alwaysPreview;
this.type = ResourceType.fromUrl(url); this.type = ResourceType.fromUrl(url);
this.displayName = ""; this.displayName = "";
} }
get url()
{
if (this.alwaysPreview)
{
return this.rawUrl.replace("/master/", "/preview/");
}
return this.rawUrl;
}
flatMapPolyfill() flatMapPolyfill()
{ {
if (Array.prototype.flatMap === undefined) if (Array.prototype.flatMap === undefined)
@ -1364,12 +1373,15 @@ Resource.manifest = {
}, },
darkStyle: { darkStyle: {
path: "dark.min.css", path: "dark.min.css",
alwaysPreview: true,
}, },
darkStyleImportant: { darkStyleImportant: {
path: "dark-important.min.css", path: "dark-important.min.css",
alwaysPreview: true,
}, },
darkStyleNavBar: { darkStyleNavBar: {
path: "dark-navbar.min.css", path: "dark-navbar.min.css",
alwaysPreview: true,
}, },
touchPlayerStyle: { touchPlayerStyle: {
path: "touch-player.min.css", path: "touch-player.min.css",
@ -1446,6 +1458,7 @@ Resource.manifest = {
}, },
useDarkStyle: { useDarkStyle: {
path: "dark-styles.min.js", path: "dark-styles.min.js",
alwaysPreview: true,
styles: [ styles: [
"darkStyle", "darkStyle",
"scrollbarStyle", "scrollbarStyle",
@ -1491,22 +1504,6 @@ Resource.manifest = {
blurBackgroundOpacity: "顶栏(对横幅)透明度", blurBackgroundOpacity: "顶栏(对横幅)透明度",
}, },
}, },
// overrideNavBar: {
// path: "override-navbar.min.js",
// styles: [
// "tweetsStyle",
// "navbarOverrideStyle",
// {
// key: "noBannerStyle",
// condition: () => !settings.showBanner
// },
// ],
// displayNames: {
// overrideNavBar: "搜索栏置顶",
// showBanner: "显示顶部横幅",
// preserveRank: "显示排行榜图标",
// },
// },
hideBanner: { hideBanner: {
path: "hide-banner.min.js", path: "hide-banner.min.js",
style: true, style: true,
@ -1800,20 +1797,10 @@ Resource.manifest = {
useCommentStyle: { useCommentStyle: {
path: "comment.min.js", path: "comment.min.js",
style: "important", style: "important",
// styles: [
// {
// key: "commentDarkStyle",
// important: true,
// condition: () => settings.useDarkStyle,
// },
// ],
displayNames: { displayNames: {
useCommentStyle: "简化评论区", useCommentStyle: "简化评论区",
}, },
}, },
// commentDarkStyle: {
// path: "comment-dark.min.css"
// },
title: { title: {
path: "title.min.js", path: "title.min.js",
displayNames: { displayNames: {

View File

@ -1,6 +1,6 @@
// ==UserScript== // ==UserScript==
// @name Bilibili Evolved (Preview Offline) // @name Bilibili Evolved (Preview Offline)
// @version 320.34 // @version 320.90
// @description Bilibili Evolved 的预览离线版, 可以抢先体验新功能, 并且所有功能都已内置于脚本中. // @description Bilibili Evolved 的预览离线版, 可以抢先体验新功能, 并且所有功能都已内置于脚本中.
// @author Grant Howard, Coulomb-G // @author Grant Howard, Coulomb-G
// @copyright 2019, Grant Howard (https://github.com/the1812) & Coulomb-G (https://github.com/Coulomb-G) // @copyright 2019, Grant Howard (https://github.com/the1812) & Coulomb-G (https://github.com/Coulomb-G)
@ -534,7 +534,7 @@ function loadResources()
]; ];
for (const [key, data] of Object.entries(Resource.manifest)) for (const [key, data] of Object.entries(Resource.manifest))
{ {
const resource = new Resource(data.path, data.styles); 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.displayNames) if (data.displayNames)
@ -545,7 +545,7 @@ function loadResources()
if (data.style) if (data.style)
{ {
const styleKey = key + "Style"; const styleKey = key + "Style";
const style = Resource.all[styleKey] = new Resource(data.path.replace(".js", ".css")); const style = Resource.all[styleKey] = new Resource(data.path.replace(".js", ".css"), { alwaysPreview: data.alwaysPreview });
style.key = styleKey; style.key = styleKey;
switch (data.style) switch (data.style)
{ {
@ -580,7 +580,7 @@ function loadResources()
if (data.html === true) if (data.html === true)
{ {
const htmlKey = key + "Html"; const htmlKey = key + "Html";
const html = Resource.all[htmlKey] = new Resource(data.path.replace(".js", ".html")); const html = Resource.all[htmlKey] = new Resource(data.path.replace(".js", ".html"), { alwaysPreview: data.alwaysPreview });
html.key = htmlKey; html.key = htmlKey;
resource.dependencies.push(html); resource.dependencies.push(html);
} }
@ -1213,17 +1213,26 @@ class Resource
{ {
return this.text !== null; return this.text !== null;
} }
constructor(url, styles = []) constructor(url, { styles = [], alwaysPreview: false } = {})
{ {
this.url = Resource.root + "min/" + url; this.rawUrl = Resource.root + "min/" + url;
this.dependencies = []; this.dependencies = [];
// this.priority = priority; // this.priority = priority;
this.styles = styles; this.styles = styles;
this.text = null; this.text = null;
this.key = null; this.key = null;
this.alwaysPreview = alwaysPreview;
this.type = ResourceType.fromUrl(url); this.type = ResourceType.fromUrl(url);
this.displayName = ""; this.displayName = "";
} }
get url()
{
if (this.alwaysPreview)
{
return this.rawUrl.replace("/master/", "/preview/");
}
return this.rawUrl;
}
flatMapPolyfill() flatMapPolyfill()
{ {
if (Array.prototype.flatMap === undefined) if (Array.prototype.flatMap === undefined)
@ -1364,12 +1373,15 @@ Resource.manifest = {
}, },
darkStyle: { darkStyle: {
path: "dark.min.css", path: "dark.min.css",
alwaysPreview: true,
}, },
darkStyleImportant: { darkStyleImportant: {
path: "dark-important.min.css", path: "dark-important.min.css",
alwaysPreview: true,
}, },
darkStyleNavBar: { darkStyleNavBar: {
path: "dark-navbar.min.css", path: "dark-navbar.min.css",
alwaysPreview: true,
}, },
touchPlayerStyle: { touchPlayerStyle: {
path: "touch-player.min.css", path: "touch-player.min.css",
@ -1446,6 +1458,7 @@ Resource.manifest = {
}, },
useDarkStyle: { useDarkStyle: {
path: "dark-styles.min.js", path: "dark-styles.min.js",
alwaysPreview: true,
styles: [ styles: [
"darkStyle", "darkStyle",
"scrollbarStyle", "scrollbarStyle",
@ -1491,22 +1504,6 @@ Resource.manifest = {
blurBackgroundOpacity: "顶栏(对横幅)透明度", blurBackgroundOpacity: "顶栏(对横幅)透明度",
}, },
}, },
// overrideNavBar: {
// path: "override-navbar.min.js",
// styles: [
// "tweetsStyle",
// "navbarOverrideStyle",
// {
// key: "noBannerStyle",
// condition: () => !settings.showBanner
// },
// ],
// displayNames: {
// overrideNavBar: "搜索栏置顶",
// showBanner: "显示顶部横幅",
// preserveRank: "显示排行榜图标",
// },
// },
hideBanner: { hideBanner: {
path: "hide-banner.min.js", path: "hide-banner.min.js",
style: true, style: true,
@ -1800,20 +1797,10 @@ Resource.manifest = {
useCommentStyle: { useCommentStyle: {
path: "comment.min.js", path: "comment.min.js",
style: "important", style: "important",
// styles: [
// {
// key: "commentDarkStyle",
// important: true,
// condition: () => settings.useDarkStyle,
// },
// ],
displayNames: { displayNames: {
useCommentStyle: "简化评论区", useCommentStyle: "简化评论区",
}, },
}, },
// commentDarkStyle: {
// path: "comment-dark.min.css"
// },
title: { title: {
path: "title.min.js", path: "title.min.js",
displayNames: { displayNames: {

View File

@ -1,6 +1,6 @@
// ==UserScript== // ==UserScript==
// @name Bilibili Evolved (Preview) // @name Bilibili Evolved (Preview)
// @version 1.8.4 // @version 1.8.5
// @description Bilibili Evolved 的预览版, 可以抢先体验新功能. // @description Bilibili Evolved 的预览版, 可以抢先体验新功能.
// @author Grant Howard, Coulomb-G // @author Grant Howard, Coulomb-G
// @copyright 2019, Grant Howard (https://github.com/the1812) & Coulomb-G (https://github.com/Coulomb-G) // @copyright 2019, Grant Howard (https://github.com/the1812) & Coulomb-G (https://github.com/Coulomb-G)
@ -533,7 +533,7 @@ function loadResources()
]; ];
for (const [key, data] of Object.entries(Resource.manifest)) for (const [key, data] of Object.entries(Resource.manifest))
{ {
const resource = new Resource(data.path, data.styles); 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.displayNames) if (data.displayNames)
@ -544,7 +544,7 @@ function loadResources()
if (data.style) if (data.style)
{ {
const styleKey = key + "Style"; const styleKey = key + "Style";
const style = Resource.all[styleKey] = new Resource(data.path.replace(".js", ".css")); const style = Resource.all[styleKey] = new Resource(data.path.replace(".js", ".css"), { alwaysPreview: data.alwaysPreview });
style.key = styleKey; style.key = styleKey;
switch (data.style) switch (data.style)
{ {
@ -579,7 +579,7 @@ function loadResources()
if (data.html === true) if (data.html === true)
{ {
const htmlKey = key + "Html"; const htmlKey = key + "Html";
const html = Resource.all[htmlKey] = new Resource(data.path.replace(".js", ".html")); const html = Resource.all[htmlKey] = new Resource(data.path.replace(".js", ".html"), { alwaysPreview: data.alwaysPreview });
html.key = htmlKey; html.key = htmlKey;
resource.dependencies.push(html); resource.dependencies.push(html);
} }
@ -1093,17 +1093,26 @@ class Resource
{ {
return this.text !== null; return this.text !== null;
} }
constructor(url, styles = []) constructor(url, { styles = [], alwaysPreview: false } = {})
{ {
this.url = Resource.root + "min/" + url; this.rawUrl = Resource.root + "min/" + url;
this.dependencies = []; this.dependencies = [];
// this.priority = priority; // this.priority = priority;
this.styles = styles; this.styles = styles;
this.text = null; this.text = null;
this.key = null; this.key = null;
this.alwaysPreview = alwaysPreview;
this.type = ResourceType.fromUrl(url); this.type = ResourceType.fromUrl(url);
this.displayName = ""; this.displayName = "";
} }
get url()
{
if (this.alwaysPreview)
{
return this.rawUrl.replace("/master/", "/preview/");
}
return this.rawUrl;
}
flatMapPolyfill() flatMapPolyfill()
{ {
if (Array.prototype.flatMap === undefined) if (Array.prototype.flatMap === undefined)
@ -1286,12 +1295,15 @@ Resource.manifest = {
}, },
darkStyle: { darkStyle: {
path: "dark.min.css", path: "dark.min.css",
alwaysPreview: true,
}, },
darkStyleImportant: { darkStyleImportant: {
path: "dark-important.min.css", path: "dark-important.min.css",
alwaysPreview: true,
}, },
darkStyleNavBar: { darkStyleNavBar: {
path: "dark-navbar.min.css", path: "dark-navbar.min.css",
alwaysPreview: true,
}, },
touchPlayerStyle: { touchPlayerStyle: {
path: "touch-player.min.css", path: "touch-player.min.css",
@ -1368,6 +1380,7 @@ Resource.manifest = {
}, },
useDarkStyle: { useDarkStyle: {
path: "dark-styles.min.js", path: "dark-styles.min.js",
alwaysPreview: true,
styles: [ styles: [
"darkStyle", "darkStyle",
"scrollbarStyle", "scrollbarStyle",
@ -1413,22 +1426,6 @@ Resource.manifest = {
blurBackgroundOpacity: "顶栏(对横幅)透明度", blurBackgroundOpacity: "顶栏(对横幅)透明度",
}, },
}, },
// overrideNavBar: {
// path: "override-navbar.min.js",
// styles: [
// "tweetsStyle",
// "navbarOverrideStyle",
// {
// key: "noBannerStyle",
// condition: () => !settings.showBanner
// },
// ],
// displayNames: {
// overrideNavBar: "搜索栏置顶",
// showBanner: "显示顶部横幅",
// preserveRank: "显示排行榜图标",
// },
// },
hideBanner: { hideBanner: {
path: "hide-banner.min.js", path: "hide-banner.min.js",
style: true, style: true,
@ -1722,20 +1719,10 @@ Resource.manifest = {
useCommentStyle: { useCommentStyle: {
path: "comment.min.js", path: "comment.min.js",
style: "important", style: "important",
// styles: [
// {
// key: "commentDarkStyle",
// important: true,
// condition: () => settings.useDarkStyle,
// },
// ],
displayNames: { displayNames: {
useCommentStyle: "简化评论区", useCommentStyle: "简化评论区",
}, },
}, },
// commentDarkStyle: {
// path: "comment-dark.min.css"
// },
title: { title: {
path: "title.min.js", path: "title.min.js",
displayNames: { displayNames: {

View File

@ -1,6 +1,6 @@
// ==UserScript== // ==UserScript==
// @name Bilibili Evolved // @name Bilibili Evolved
// @version 1.8.4 // @version 1.8.5
// @description 增强哔哩哔哩Web端体验: 下载视频, 音乐, 封面, 弹幕; 自定义播放器的画质, 模式, 布局; 自定义顶栏, 删除广告, 使用夜间模式; 以及增加对触屏设备的支持等. // @description 增强哔哩哔哩Web端体验: 下载视频, 音乐, 封面, 弹幕; 自定义播放器的画质, 模式, 布局; 自定义顶栏, 删除广告, 使用夜间模式; 以及增加对触屏设备的支持等.
// @author Grant Howard, Coulomb-G // @author Grant Howard, Coulomb-G
// @copyright 2019, Grant Howard (https://github.com/the1812) & Coulomb-G (https://github.com/Coulomb-G) // @copyright 2019, Grant Howard (https://github.com/the1812) & Coulomb-G (https://github.com/Coulomb-G)
@ -533,7 +533,7 @@ function loadResources()
]; ];
for (const [key, data] of Object.entries(Resource.manifest)) for (const [key, data] of Object.entries(Resource.manifest))
{ {
const resource = new Resource(data.path, data.styles); 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.displayNames) if (data.displayNames)
@ -544,7 +544,7 @@ function loadResources()
if (data.style) if (data.style)
{ {
const styleKey = key + "Style"; const styleKey = key + "Style";
const style = Resource.all[styleKey] = new Resource(data.path.replace(".js", ".css")); const style = Resource.all[styleKey] = new Resource(data.path.replace(".js", ".css"), { alwaysPreview: data.alwaysPreview });
style.key = styleKey; style.key = styleKey;
switch (data.style) switch (data.style)
{ {
@ -579,7 +579,7 @@ function loadResources()
if (data.html === true) if (data.html === true)
{ {
const htmlKey = key + "Html"; const htmlKey = key + "Html";
const html = Resource.all[htmlKey] = new Resource(data.path.replace(".js", ".html")); const html = Resource.all[htmlKey] = new Resource(data.path.replace(".js", ".html"), { alwaysPreview: data.alwaysPreview });
html.key = htmlKey; html.key = htmlKey;
resource.dependencies.push(html); resource.dependencies.push(html);
} }
@ -1093,17 +1093,26 @@ class Resource
{ {
return this.text !== null; return this.text !== null;
} }
constructor(url, styles = []) constructor(url, { styles = [], alwaysPreview: false } = {})
{ {
this.url = Resource.root + "min/" + url; this.rawUrl = Resource.root + "min/" + url;
this.dependencies = []; this.dependencies = [];
// this.priority = priority; // this.priority = priority;
this.styles = styles; this.styles = styles;
this.text = null; this.text = null;
this.key = null; this.key = null;
this.alwaysPreview = alwaysPreview;
this.type = ResourceType.fromUrl(url); this.type = ResourceType.fromUrl(url);
this.displayName = ""; this.displayName = "";
} }
get url()
{
if (this.alwaysPreview)
{
return this.rawUrl.replace("/master/", "/preview/");
}
return this.rawUrl;
}
flatMapPolyfill() flatMapPolyfill()
{ {
if (Array.prototype.flatMap === undefined) if (Array.prototype.flatMap === undefined)
@ -1286,12 +1295,15 @@ Resource.manifest = {
}, },
darkStyle: { darkStyle: {
path: "dark.min.css", path: "dark.min.css",
alwaysPreview: true,
}, },
darkStyleImportant: { darkStyleImportant: {
path: "dark-important.min.css", path: "dark-important.min.css",
alwaysPreview: true,
}, },
darkStyleNavBar: { darkStyleNavBar: {
path: "dark-navbar.min.css", path: "dark-navbar.min.css",
alwaysPreview: true,
}, },
touchPlayerStyle: { touchPlayerStyle: {
path: "touch-player.min.css", path: "touch-player.min.css",
@ -1368,6 +1380,7 @@ Resource.manifest = {
}, },
useDarkStyle: { useDarkStyle: {
path: "dark-styles.min.js", path: "dark-styles.min.js",
alwaysPreview: true,
styles: [ styles: [
"darkStyle", "darkStyle",
"scrollbarStyle", "scrollbarStyle",
@ -1413,22 +1426,6 @@ Resource.manifest = {
blurBackgroundOpacity: "顶栏(对横幅)透明度", blurBackgroundOpacity: "顶栏(对横幅)透明度",
}, },
}, },
// overrideNavBar: {
// path: "override-navbar.min.js",
// styles: [
// "tweetsStyle",
// "navbarOverrideStyle",
// {
// key: "noBannerStyle",
// condition: () => !settings.showBanner
// },
// ],
// displayNames: {
// overrideNavBar: "搜索栏置顶",
// showBanner: "显示顶部横幅",
// preserveRank: "显示排行榜图标",
// },
// },
hideBanner: { hideBanner: {
path: "hide-banner.min.js", path: "hide-banner.min.js",
style: true, style: true,
@ -1722,20 +1719,10 @@ Resource.manifest = {
useCommentStyle: { useCommentStyle: {
path: "comment.min.js", path: "comment.min.js",
style: "important", style: "important",
// styles: [
// {
// key: "commentDarkStyle",
// important: true,
// condition: () => settings.useDarkStyle,
// },
// ],
displayNames: { displayNames: {
useCommentStyle: "简化评论区", useCommentStyle: "简化评论区",
}, },
}, },
// commentDarkStyle: {
// path: "comment-dark.min.css"
// },
title: { title: {
path: "title.min.js", path: "title.min.js",
displayNames: { displayNames: {

View File

@ -1,6 +1,6 @@
// ==UserScript== // ==UserScript==
// @name Bilibili Evolved (Preview) // @name Bilibili Evolved (Preview)
// @version 1.8.4 // @version 1.8.5
// @description Bilibili Evolved 的预览版, 可以抢先体验新功能. // @description Bilibili Evolved 的预览版, 可以抢先体验新功能.
// @author Grant Howard, Coulomb-G // @author Grant Howard, Coulomb-G
// @copyright 2019, Grant Howard (https://github.com/the1812) & Coulomb-G (https://github.com/Coulomb-G) // @copyright 2019, Grant Howard (https://github.com/the1812) & Coulomb-G (https://github.com/Coulomb-G)

View File

@ -23,7 +23,7 @@ export function loadResources()
]; ];
for (const [key, data] of Object.entries(Resource.manifest)) for (const [key, data] of Object.entries(Resource.manifest))
{ {
const resource = new Resource(data.path, data.styles); 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.displayNames) if (data.displayNames)
@ -34,7 +34,7 @@ export function loadResources()
if (data.style) if (data.style)
{ {
const styleKey = key + "Style"; const styleKey = key + "Style";
const style = Resource.all[styleKey] = new Resource(data.path.replace(".js", ".css")); const style = Resource.all[styleKey] = new Resource(data.path.replace(".js", ".css"), { alwaysPreview: data.alwaysPreview });
style.key = styleKey; style.key = styleKey;
switch (data.style) switch (data.style)
{ {
@ -69,7 +69,7 @@ export function loadResources()
if (data.html === true) if (data.html === true)
{ {
const htmlKey = key + "Html"; const htmlKey = key + "Html";
const html = Resource.all[htmlKey] = new Resource(data.path.replace(".js", ".html")); const html = Resource.all[htmlKey] = new Resource(data.path.replace(".js", ".html"), { alwaysPreview: data.alwaysPreview });
html.key = htmlKey; html.key = htmlKey;
resource.dependencies.push(html); resource.dependencies.push(html);
} }

View File

@ -10,12 +10,15 @@ Resource.manifest = {
}, },
darkStyle: { darkStyle: {
path: "dark.min.css", path: "dark.min.css",
alwaysPreview: true,
}, },
darkStyleImportant: { darkStyleImportant: {
path: "dark-important.min.css", path: "dark-important.min.css",
alwaysPreview: true,
}, },
darkStyleNavBar: { darkStyleNavBar: {
path: "dark-navbar.min.css", path: "dark-navbar.min.css",
alwaysPreview: true,
}, },
touchPlayerStyle: { touchPlayerStyle: {
path: "touch-player.min.css", path: "touch-player.min.css",
@ -92,6 +95,7 @@ Resource.manifest = {
}, },
useDarkStyle: { useDarkStyle: {
path: "dark-styles.min.js", path: "dark-styles.min.js",
alwaysPreview: true,
styles: [ styles: [
"darkStyle", "darkStyle",
"scrollbarStyle", "scrollbarStyle",
@ -137,22 +141,6 @@ Resource.manifest = {
blurBackgroundOpacity: "顶栏(对横幅)透明度", blurBackgroundOpacity: "顶栏(对横幅)透明度",
}, },
}, },
// overrideNavBar: {
// path: "override-navbar.min.js",
// styles: [
// "tweetsStyle",
// "navbarOverrideStyle",
// {
// key: "noBannerStyle",
// condition: () => !settings.showBanner
// },
// ],
// displayNames: {
// overrideNavBar: "搜索栏置顶",
// showBanner: "显示顶部横幅",
// preserveRank: "显示排行榜图标",
// },
// },
hideBanner: { hideBanner: {
path: "hide-banner.min.js", path: "hide-banner.min.js",
style: true, style: true,
@ -446,20 +434,10 @@ Resource.manifest = {
useCommentStyle: { useCommentStyle: {
path: "comment.min.js", path: "comment.min.js",
style: "important", style: "important",
// styles: [
// {
// key: "commentDarkStyle",
// important: true,
// condition: () => settings.useDarkStyle,
// },
// ],
displayNames: { displayNames: {
useCommentStyle: "简化评论区", useCommentStyle: "简化评论区",
}, },
}, },
// commentDarkStyle: {
// path: "comment-dark.min.css"
// },
title: { title: {
path: "title.min.js", path: "title.min.js",
displayNames: { displayNames: {

View File

@ -4,17 +4,26 @@ export class Resource
{ {
return this.text !== null; return this.text !== null;
} }
constructor(url, styles = []) constructor(url, { styles = [], alwaysPreview: false } = {})
{ {
this.url = Resource.root + "min/" + url; this.rawUrl = Resource.root + "min/" + url;
this.dependencies = []; this.dependencies = [];
// this.priority = priority; // this.priority = priority;
this.styles = styles; this.styles = styles;
this.text = null; this.text = null;
this.key = null; this.key = null;
this.alwaysPreview = alwaysPreview;
this.type = ResourceType.fromUrl(url); this.type = ResourceType.fromUrl(url);
this.displayName = ""; this.displayName = "";
} }
get url()
{
if (this.alwaysPreview)
{
return this.rawUrl.replace("/master/", "/preview/");
}
return this.rawUrl;
}
flatMapPolyfill() flatMapPolyfill()
{ {
if (Array.prototype.flatMap === undefined) if (Array.prototype.flatMap === undefined)

View File

@ -1 +1 @@
1.8.4 1.8.5