Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

merge dev to main, v4.0.3 #163

Merged
merged 8 commits into from
Oct 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@
# CHANGELOG

## 4.0.3

- 新增:首页 隐藏刷新按钮文字提示
- 新增:播放页 恢复分P视频编号 默认开启
- 修复:播放页 视频信息相关功能
- 修复:播放页 展开视频标题
- 优化:拖拽面板性能
- 更新:播放页 隐藏弹幕列表改为默认禁用

## 4.0.2

- 更新:播放页 相关视频功能 适配页面变化
Expand Down
74 changes: 45 additions & 29 deletions src/components/PanelComp.vue
Original file line number Diff line number Diff line change
@@ -1,15 +1,7 @@
<template>
<div
ref="panel"
:style="[
{
width: widthPercent + 'vw',
height: heightPercent + 'vh',
minWidth: minWidth + 'px',
minHeight: minHeight + 'px',
},
style,
]"
:style="[panelStyle, style]"
class="no-scrollbar fixed z-[10000000] select-none overflow-auto overscroll-none rounded-xl bg-white shadow-lg"
>
<div ref="bar" class="sticky top-0 z-10 w-full cursor-move bg-[#00AEEC] py-1.5 text-center">
Expand Down Expand Up @@ -37,8 +29,10 @@
</template>

<script setup lang="ts">
import { useDraggable, useElementBounding } from '@vueuse/core'
import { computed, ref, watch } from 'vue'
import { Position, useDraggable, useElementBounding, useWindowSize } from '@vueuse/core'
import { computed, ref } from 'vue'

const emit = defineEmits(['close'])

const props = defineProps<{
title: string
Expand All @@ -48,34 +42,56 @@ const props = defineProps<{
minHeight: number // 单位px
}>()

const emit = defineEmits(['close'])

const panel = ref<HTMLElement | null>(null)
const bar = ref<HTMLElement | null>(null)

const windowSize = useWindowSize({ includeScrollbar: false })
const { width, height } = useElementBounding(bar, { windowScroll: false }) // bar元素长宽

const { x, y, style } = useDraggable(panel, {
const maxPos = computed(() => {
return {
x: windowSize.width.value - width.value,
y: windowSize.height.value - height.value,
}
})
let rAF = 0
const { style } = useDraggable(panel, {
initialValue: {
x: innerWidth / 2 - Math.max((innerWidth * props.widthPercent) / 100, props.minWidth) / 2,
y: innerHeight / 2 - Math.max((innerHeight * props.heightPercent) / 100, props.minHeight) / 2,
x:
windowSize.width.value / 2 -
Math.max((windowSize.width.value * props.widthPercent) / 100, props.minWidth) / 2,
y:
windowSize.height.value / 2 -
Math.max((windowSize.height.value * props.heightPercent) / 100, props.minHeight) / 2,
},
handle: computed(() => bar.value),
preventDefault: true,
// 限制拖拽范围
onMove: (pos: Position) => {
cancelAnimationFrame(rAF)
rAF = requestAnimationFrame(() => {
if (pos.x < 0) {
pos.x = 0
}
if (pos.y < 0) {
pos.y = 0
}
if (pos.x > maxPos.value.x) {
pos.x = maxPos.value.x
}
if (pos.y > maxPos.value.y) {
pos.y = maxPos.value.y
}
})
},
})

// 限制拖拽范围
watch([x, y], ([newX, newY]) => {
if (newX < 0) {
x.value = 0
}
if (newY < 0) {
y.value = 0
}
if (newY + height.value > innerHeight) {
y.value = innerHeight - height.value
}
if (newX + width.value > innerWidth) {
x.value = innerWidth - width.value
const panelStyle = computed(() => {
return {
width: props.widthPercent + 'vw',
height: props.heightPercent + 'vh',
minWidth: props.minWidth + 'px',
minHeight: props.minHeight + 'px',
}
})
</script>
1 change: 0 additions & 1 deletion src/modules/rules/bangumi/groups/right.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ export const bangumiRightItems: Item[] = [
type: 'switch',
id: 'video-page-hide-right-container-danmaku',
name: '隐藏 弹幕列表',
defaultEnable: true,
},
{
type: 'switch',
Expand Down
9 changes: 8 additions & 1 deletion src/modules/rules/homepage/groups/sidebar.scss
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,14 @@ html[homepage-hide-watchlater-pip-button] {
}
}

// 隐藏 刷新
// 隐藏 刷新按钮文字提示
html[homepage-hide-flexible-roll-btn-text] {
.palette-button-wrap .flexible-roll-btn .btn-text {
display: none !important;
}
}

// 隐藏 刷新按钮
html[homepage-hide-flexible-roll-btn] {
.palette-button-wrap .flexible-roll-btn {
display: none !important;
Expand Down
7 changes: 6 additions & 1 deletion src/modules/rules/homepage/groups/sidebar.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,15 @@ export const homepageSidebarItems: Item[] = [
id: 'homepage-hide-watchlater-pip-button',
name: '隐藏 稍后再看',
},
{
type: 'switch',
id: 'homepage-hide-flexible-roll-btn-text',
name: '隐藏 刷新按钮 文字提示',
},
{
type: 'switch',
id: 'homepage-hide-flexible-roll-btn',
name: '隐藏 刷新',
name: '隐藏 刷新按钮',
},
{
type: 'switch',
Expand Down
Loading