mirror of
https://github.com/the1812/Bilibili-Evolved.git
synced 2025-11-04 21:22:45 +08:00
Support copy image (#4806)
This commit is contained in:
parent
2da58cef98
commit
560d651d35
@ -74,7 +74,7 @@
|
|||||||
## 最低配置
|
## 最低配置
|
||||||
- 操作系统: Windows 8.1 / macOS Big Sur
|
- 操作系统: Windows 8.1 / macOS Big Sur
|
||||||
- 分辨率: 1920x1080, 缩放 125%
|
- 分辨率: 1920x1080, 缩放 125%
|
||||||
- 浏览器: Chrome 105+ / Firefox 121+ / Safari 15.4+ (仅理论上能运行, 没测试过)
|
- 浏览器: Chrome 105+ / Firefox 127+ / Safari 15.4+ (仅理论上能运行, 没测试过)
|
||||||
- 处理器: Intel Core i5-10500 / AMD Ryzen 5 3600
|
- 处理器: Intel Core i5-10500 / AMD Ryzen 5 3600
|
||||||
- 内存: 8GB
|
- 内存: 8GB
|
||||||
- 脚本管理器: Tampermonkey 5.0 / Violentmonkey 2.18
|
- 脚本管理器: Tampermonkey 5.0 / Violentmonkey 2.18
|
||||||
@ -84,7 +84,7 @@
|
|||||||
## 推荐配置
|
## 推荐配置
|
||||||
- 操作系统: Windows 10 / macOS Sonoma
|
- 操作系统: Windows 10 / macOS Sonoma
|
||||||
- 分辨率: 3840x2160, 缩放 200%
|
- 分辨率: 3840x2160, 缩放 200%
|
||||||
- 浏览器: Chrome 120+ / Firefox 121+
|
- 浏览器: Chrome 120+ / Firefox 127+
|
||||||
- 处理器: Intel Core i7-11700 / AMD Ryzen 7 5800
|
- 处理器: Intel Core i7-11700 / AMD Ryzen 7 5800
|
||||||
- 内存: 32GB
|
- 内存: 32GB
|
||||||
- 脚本管理器: Tampermonkey 5.0 / Violentmonkey 2.18
|
- 脚本管理器: Tampermonkey 5.0 / Violentmonkey 2.18
|
||||||
|
|||||||
@ -13,7 +13,10 @@
|
|||||||
<button class="save" title="保存" @click="save">
|
<button class="save" title="保存" @click="save">
|
||||||
<VIcon :size="28" icon="mdi-content-save-outline"></VIcon>
|
<VIcon :size="28" icon="mdi-content-save-outline"></VIcon>
|
||||||
</button>
|
</button>
|
||||||
<button title="丢弃" class="discard" @click="discard">
|
<button class="copy" title="复制" @click="copy">
|
||||||
|
<VIcon :size="24" :icon="showCopyTip ? 'mdi-check' : 'mdi-content-copy'"></VIcon>
|
||||||
|
</button>
|
||||||
|
<button class="discard" title="丢弃" @click="discard">
|
||||||
<VIcon :size="28" icon="mdi-delete-forever-outline"></VIcon>
|
<VIcon :size="28" icon="mdi-delete-forever-outline"></VIcon>
|
||||||
</button>
|
</button>
|
||||||
<span class="time">{{ time }}</span>
|
<span class="time">{{ time }}</span>
|
||||||
@ -23,29 +26,48 @@
|
|||||||
</template>
|
</template>
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import { VIcon } from '@/ui'
|
import { VIcon } from '@/ui'
|
||||||
|
import { Screenshot } from './screenshot'
|
||||||
|
|
||||||
export default Vue.extend({
|
export default Vue.extend({
|
||||||
components: {
|
components: {
|
||||||
VIcon,
|
VIcon,
|
||||||
},
|
},
|
||||||
props: {
|
props: {
|
||||||
objectUrl: {
|
screenshot: {
|
||||||
type: String,
|
type: Screenshot,
|
||||||
required: true,
|
required: true,
|
||||||
},
|
},
|
||||||
filename: {
|
},
|
||||||
type: String,
|
data() {
|
||||||
required: true,
|
return {
|
||||||
|
showCopyTip: false,
|
||||||
|
}
|
||||||
|
},
|
||||||
|
computed: {
|
||||||
|
objectUrl() {
|
||||||
|
return this.screenshot.url
|
||||||
},
|
},
|
||||||
time: {
|
filename() {
|
||||||
type: String,
|
return this.screenshot.filename
|
||||||
required: true,
|
},
|
||||||
|
time() {
|
||||||
|
return this.screenshot.time
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
discard() {
|
discard() {
|
||||||
this.$emit('discard')
|
this.$emit('discard')
|
||||||
},
|
},
|
||||||
|
async copy() {
|
||||||
|
const screenshot = this.screenshot as Screenshot
|
||||||
|
await navigator.clipboard.write([
|
||||||
|
new ClipboardItem({ [screenshot.mimeType]: screenshot.blob }),
|
||||||
|
])
|
||||||
|
this.showCopyTip = true
|
||||||
|
setTimeout(() => {
|
||||||
|
this.showCopyTip = false
|
||||||
|
}, 1000)
|
||||||
|
},
|
||||||
save() {
|
save() {
|
||||||
const link = this.$refs.link as HTMLAnchorElement
|
const link = this.$refs.link as HTMLAnchorElement
|
||||||
link.addEventListener(
|
link.addEventListener(
|
||||||
|
|||||||
@ -4,9 +4,7 @@
|
|||||||
<VideoScreenshot
|
<VideoScreenshot
|
||||||
v-for="screenshot of screenshots"
|
v-for="screenshot of screenshots"
|
||||||
:key="screenshot.id"
|
:key="screenshot.id"
|
||||||
:filename="screenshot.filename"
|
:screenshot="screenshot"
|
||||||
:object-url="screenshot.url"
|
|
||||||
:time="screenshot.time"
|
|
||||||
@discard="discard(screenshot)"
|
@discard="discard(screenshot)"
|
||||||
></VideoScreenshot>
|
></VideoScreenshot>
|
||||||
</transition-group>
|
</transition-group>
|
||||||
|
|||||||
@ -3,6 +3,7 @@ import { getFriendlyTitle } from '@/core/utils/title'
|
|||||||
|
|
||||||
const canvas = document.createElement('canvas')
|
const canvas = document.createElement('canvas')
|
||||||
export class Screenshot {
|
export class Screenshot {
|
||||||
|
readonly mimeType = 'image/png'
|
||||||
url = ''
|
url = ''
|
||||||
blob: Blob
|
blob: Blob
|
||||||
timeStamp = new Date().getTime()
|
timeStamp = new Date().getTime()
|
||||||
@ -57,7 +58,7 @@ export class Screenshot {
|
|||||||
}
|
}
|
||||||
this.blob = blob
|
this.blob = blob
|
||||||
this.url = URL.createObjectURL(blob)
|
this.url = URL.createObjectURL(blob)
|
||||||
}, 'image/png')
|
}, this.mimeType)
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
logError(
|
logError(
|
||||||
'视频截图失败: 操作被浏览器阻止. 这通常发生于电影的试看片段, 请在正片尝试使用截图功能.',
|
'视频截图失败: 操作被浏览器阻止. 这通常发生于电影的试看片段, 请在正片尝试使用截图功能.',
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user