Merge branch 'preview-features' into component-option-types

This commit is contained in:
the1812 2022-03-20 10:29:04 +08:00
commit 3cffe14f50
13 changed files with 184 additions and 125 deletions

View File

@ -7,6 +7,7 @@ export const history: CustomNavbarItemInit = {
content: '历史',
href,
touch: true,
active: document.URL.replace(/\?.*$/, '') === href,
loginRequired: true,

View File

@ -239,6 +239,7 @@
}
}
.s_tag .tag-area {
.tag,
.tag-item {
@include background-color("4");
@include border-color();

View File

@ -112,6 +112,12 @@
@include color("e");
}
}
&-title {
@include color("e");
&:hover {
@include theme-color();
}
}
}
}
&_second-line {

View File

@ -1032,6 +1032,10 @@ $media-types: (video, bangumi, cheese, live, manga, movie, ogv, article);
}
}
}
.border-bottom-line {
@include background-color("6");
}
}
.up-info {
.u-face .u-face__avatar {
@ -1054,3 +1058,11 @@ $media-types: (video, bangumi, cheese, live, manga, movie, ogv, article);
}
}
}
.user-card {
.info p {
@include color("e");
}
.gray-text {
@include color("a");
}
}

View File

@ -112,7 +112,7 @@ export const builtInActions: Record<string, KeyBindingAction> = {
if (lodash.isNil(result)) {
return result
}
if (result) {
if (playerAgent.isMute()) {
showTip('已静音', 'mdi-volume-off')
} else {
showTip('已取消静音', 'mdi-volume-high')

View File

@ -14,6 +14,7 @@
<VIcon icon="mdi-close" :size="20" />
</VButton>
</div>
<div class="download-video-panel-content">
<div
v-if="selectedInput"
class="download-video-config-item"
@ -112,7 +113,7 @@
v-if="selectedOutput && selectedOutput.component"
ref="outputOptions"
/>
</div>
<div class="download-video-panel-footer">
<VButton
class="run-download"
@ -382,48 +383,29 @@ export default Vue.extend({
@import "common";
.download-video-panel {
@include no-scrollbar();
@include card();
font-size: 12px;
padding: 6px;
top: 100px;
left: 50%;
transform: translateX(-50%) scale(0.95);
transition: .2s ease-out;
z-index: 1000;
width: 320px;
max-height: calc(100vh - 200px);
height: calc(100vh - 200px);
display: flex;
flex-direction: column;
align-items: flex-start;
@include card();
&.open {
transform: translateX(-50%);
}
> * {
margin-top: 12px;
padding: 0 12px;
}
> :first-child {
margin-top: 0;
padding-top: 12px;
padding-bottom: 6px;
}
> :last-child {
margin-top: 6px;
padding-top: 6px;
padding-bottom: 12px;
}
.be-textbox,
.be-textarea {
flex-grow: 1;
}
&-header {
@include h-center();
align-self: stretch;
background-color: inherit;
position: sticky;
top: 0;
z-index: 1;
padding: 6px;
.title {
font-size: 16px;
@ -435,6 +417,16 @@ export default Vue.extend({
padding: 4px;
}
}
&-content {
@include no-scrollbar();
@include v-stretch();
flex: 1 0 0;
padding: 6px;
align-items: flex-start;
> :not(:first-child) {
margin-top: 12px;
}
}
.download-video-config-item {
@include h-center();
.download-video-config-title {
@ -452,13 +444,9 @@ export default Vue.extend({
margin-top: 4px;
}
&-footer {
position: sticky;
bottom: 0;
z-index: 1;
background-color: inherit;
align-self: stretch;
justify-content: center;
@include h-center();
padding: 6px;
justify-content: center;
}
.run-download {
font-size: 13px;

View File

@ -39,6 +39,7 @@ export default Vue.extend({
</script>
<style lang="scss">
.single-video-info.download-video-config-section {
position: relative;
height: 125px;
display: flex;
align-items: center;

View File

@ -207,7 +207,7 @@ const buildElementPart = (
const updateAvailableSpeedValues = () => {
availableSpeedValues = lodash([...menuListElement.children])
.map(element => lodash.attempt(() => parseSpeedText(element.innerHTML)))
.map(element => lodash.attempt(() => parseSpeedText(element.textContent)))
.reject(speed => lodash.isError(speed))
.sort(ascendingSort())
.value() as number[]

View File

@ -7,7 +7,7 @@ import { videoUrls } from '@/core/utils/urls'
export const component: ComponentMetadata = {
name: 'legacyAutoPlay',
displayName: '传统连播模式',
description: '模拟传统的多 P 连播策略: 仅连播视频的分 P 和番剧的多集, 最后 1P 放完禁止连播其他推荐视频.',
description: '模拟传统的多 P 连播策略: 仅连播视频的分 P, 最后 1P 放完禁止连播其他推荐视频.',
tags: [componentsTags.video],
urlInclude: videoUrls,
entry: async () => {
@ -19,10 +19,15 @@ export const component: ComponentMetadata = {
],
disable: ['.recommend-list .next-button'],
}
const disableConditions = [
// 最后 1P 时不能开启连播
const disableConditions = [
// 传统分 P
() => Boolean(dq('.multi-page .list-box li.on:last-child')),
// TODO: 合计列表如何确定是最后 1P?
// 替代分 P 的合集
// & 可分子合集的分 P 合集, 布局长得比下面那个丑一点
() => Boolean(dq('.video-sections-item:last-child .video-episode-card:last-child .video-episode-card__info-playing')),
// 可分子合集的合集
() => Boolean(dq('.video-sections-item:last-child .video-episode-card:last-child .video-episode-card__info-title-playing')),
]
const isChecked = (container: HTMLElement) => Boolean(
container.querySelector('.switch-button.on') || container.matches(':checked'),

View File

@ -0,0 +1,36 @@
- 文本颜色设为自动时, 背景色为主题色的元素, 会根据背景色的亮度自动决定使用黑色还是白色的文字.
- 更新源决定在线仓库中功能的数据来源, 请注意更换更新源不会影响已安装的组件, 脚本本体的更新源与这个选项无关.
- 文件下载模式决定多个文件下载时是打包为单个 zip 文件还是触发多个下载请求.
- 开发者模式若开启:
- 控制台中会统计各个功能的加载耗时.
- 本地安装的功能将无视更新间隔期.
- 允许输出 debug 级别的日志.
- 报错的 Toast 将会显示整个堆栈信息.
<details><summary>文件命名格式说明</summary>
自定义文件命名格式, 各个功能在下载单个文件时, 会根据这个格式来命名
可以使用的变量有:
- `title`: 视频标题/直播间标题
- `ep`: 选集标题
- `aid`: AV 号
- `bvid`: BV 号
- `cid`: CID (每个视频的唯一编号, AV 号对应的视频可能有多集)
- `lid`: 直播间号
- `y`/`M`/`d`: 年/月/日
- `h`/`m`/`s`/`ms`: 时/分/秒/毫秒
默认的格式是 `[title][ - ep]`, 标题+选集标题, 当没有选集标题时则只有标题.
变量要放在方括号里, 而方括号里的其他内容会在变量有效时出现. 比如格式如果写成 `[title] - [ep]`, 那么即使没有选集标题, 中间那个 ` - ` 也会出现在文件名里. 如果像默认那样放在方括号里, 没有选集标题时, ` - ` 也不会出现.
例如, 想要标题 + AV 号 + 时间的格式, 可以设定为 `[title][ AVaid] [y]-[M]-[d] [h]-[m]-[s]`, 能够得到类似 `xxxx AV23333 2019-05-29 19-59-44` 的名字.
</details>
<details><summary>批量命名格式说明</summary>
自定义批量下载时的文件命名格式, 基本规则同 `文件命名格式`.
新增的变量:
- `n`: 数字, 表示第n个视频.
</details>

View File

@ -6,6 +6,7 @@ import { addComponentListener } from '@/core/settings'
import { DownloadPackageEmitMode } from '@/core/download-mode'
import { ComponentEntry, ComponentMetadata, componentsTags } from '../types'
import { provideActions } from './external-actions'
import description from './desc.md'
export const WidgetsPlugin = 'widgets'
export enum SettingsPanelDockSide {
@ -31,7 +32,7 @@ export const component: ComponentMetadata = {
name: 'settingsPanel',
displayName: '通用设置',
configurable: false,
// hidden: true,
description,
entry,
options: {
themeColor: {

View File

@ -12,6 +12,7 @@ export const formatTitle = (
const now = new Date()
const data: StringMap = {
title: document.title
.replace(/-[^-]+-[^-]+在线观看-bilibili-哔哩哔哩$/, '')
.replace(/([^]+?)_.+?_bilibili_哔哩哔哩$/, '')
.replace(/_哔哩哔哩_bilibili$/, '')
.replace(/ - 哔哩哔哩$/, '')

View File

@ -19,6 +19,13 @@
p {
margin: 0;
}
details {
line-height: 1.75;
summary {
cursor: pointer;
margin: 4px 0;
}
}
> p {
line-height: 1.75;
}