From 8c0e35e766d2ff645ce5059be04426518931b151 Mon Sep 17 00:00:00 2001 From: hunlongyu Date: Wed, 20 May 2020 11:39:46 +0800 Subject: [PATCH] =?UTF-8?q?=F0=9F=8E=8E=20=E6=96=B0=E5=A2=9E=E5=85=A8?= =?UTF-8?q?=E5=B1=80=E7=9B=91=E5=90=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- package.json | 2 +- src/assets/scss/style.scss | 4 +- src/background.js | 29 +- src/components/Film.vue | 33 +- src/components/Play.vue | 26 +- src/components/Setting.vue | 2 +- src/components/Star.vue | 35 +- src/locales/en.json | 1 + src/locales/zh-cn.json | 1 + src/mini/Mini.vue | 32 + yarn.lock | 3584 ++++++++++++++++++------------------ 11 files changed, 1960 insertions(+), 1789 deletions(-) diff --git a/package.json b/package.json index fc18011..66f87a5 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "zy", - "version": "1.0.1", + "version": "1.0.4", "private": true, "author": { "name": "Hunlongyu", diff --git a/src/assets/scss/style.scss b/src/assets/scss/style.scss index 5aa9119..a70cf0a 100644 --- a/src/assets/scss/style.scss +++ b/src/assets/scss/style.scss @@ -93,7 +93,7 @@ width: 120px; } &.operate{ - width: 120px; + width: 170px; } } } @@ -133,7 +133,7 @@ width: 120px; } &.operate{ - width: 120px; + width: 170px; } } } diff --git a/src/background.js b/src/background.js index f335a70..01f7cfe 100644 --- a/src/background.js +++ b/src/background.js @@ -8,6 +8,7 @@ import { import path from 'path' import { autoUpdater } from 'electron-updater' const isDevelopment = process.env.NODE_ENV !== 'production' +const globalShortcut = require('electron').globalShortcut let win let mini @@ -20,7 +21,7 @@ function createWindow () { width: 1080, height: 720, frame: false, - resizable: false, + resizable: true, transparent: true, webPreferences: { webSecurity: false, @@ -126,6 +127,32 @@ if (!gotTheLock) { // 创建 win, 加载应用的其余部分, etc... app.on('ready', () => { + globalShortcut.register('CommandOrControl+right', function () { + if (win) { + win.webContents.send('next', 0) + } + if (mini) { + mini.webContents.send('next', 0) + } + }) + globalShortcut.register('CommandOrControl+left', function () { + if (win) { + win.webContents.send('prev', 0) + } + if (mini) { + mini.webContents.send('prev', 0) + } + }) + globalShortcut.register('CommandOrControl+up', function () { + if (mini) { + mini.webContents.send('up', 0) + } + }) + globalShortcut.register('CommandOrControl+down', function () { + if (mini) { + mini.webContents.send('down', 0) + } + }) if (!process.env.WEBPACK_DEV_SERVER_URL) { createProtocol('app') } diff --git a/src/components/Film.vue b/src/components/Film.vue index 5a5db84..8e24b15 100644 --- a/src/components/Film.vue +++ b/src/components/Film.vue @@ -59,6 +59,7 @@ {{$t('play')}} {{$t('star')}} {{$t('share')}} + {{$t('download')}} @@ -80,6 +81,7 @@ import { sites, getSite } from '../lib/site/sites' import tools from '../lib/site/tools' import video from '../lib/dexie/video' import setting from '../lib/dexie/setting' +const { clipboard } = require('electron') export default { name: 'film', data () { @@ -261,6 +263,33 @@ export default { v: e } }, + downloadEvent (e) { + tools.detail_get(e.site, e.detail).then(res => { + if (res.mp4_urls.length > 0) { + const urls = [...res.mp4_urls] + let txt = `${e.name}\n` + for (const i of urls) { + const name = i.split('$')[0] + const url = encodeURI(i.split('$')[1]) + txt += (name + ': ' + url + '\n') + } + clipboard.writeText(txt) + this.$m.success('〖MP4〗: ' + this.$t('copy_success')) + return false + } + if (res.m3u8_urls.length > 0) { + const urls = [...res.m3u8_urls] + let txt = `${e.name}\n` + for (const i of urls) { + const name = i.split('$')[0] + const url = encodeURI(i.split('$')[1]) + txt += (name + ': ' + url + '\n') + } + clipboard.writeText(txt) + this.$m.success('〖M3U8〗: ' + this.$t('copy_success')) + } + }) + }, tbPageChange (e) { this.tb.loading = true this.tb.page = e @@ -277,7 +306,7 @@ export default {