mirror of
https://github.com/VueTorrent/VueTorrent.git
synced 2025-03-14 12:10:18 +03:00
perf: support command key for mac + unfocus on escape
This commit is contained in:
parent
0cc22ae1ea
commit
acb75a6a81
4 changed files with 20 additions and 6 deletions
|
@ -197,3 +197,11 @@ export class Hostname {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
export function isMac() {
|
||||
return window.navigator.userAgent.toUpperCase().indexOf('MAC') >= 0
|
||||
}
|
||||
|
||||
export function doesCommand(e) {
|
||||
return isMac ? e.metaKey : e.ctrlKey
|
||||
}
|
||||
|
|
|
@ -81,7 +81,7 @@ export class QBitApi {
|
|||
}
|
||||
|
||||
async getMainData(rid?: number): Promise<MainDataResponse> {
|
||||
return this.axios.get('/sync/maindata', { params: { rid } }).then(res => res.data)
|
||||
return this.axios.get('/sync/maindata', { params: { rid } }).then(res => res.data)
|
||||
}
|
||||
|
||||
async toggleSpeedLimitsMode(): Promise<void> {
|
||||
|
|
|
@ -69,11 +69,11 @@ export default {
|
|||
Torrents.update(data)
|
||||
DocumentTitle.update()
|
||||
} catch (error: any) {
|
||||
if(error?.response?.status === 403){
|
||||
console.error("No longer authtenticated, logging out...")
|
||||
if (error?.response?.status === 403) {
|
||||
console.error('No longer authtenticated, logging out...')
|
||||
state.authenticated = false
|
||||
router.push({ name: 'login' })
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
FETCH_SETTINGS: async (state: StoreState, settings: AppPreferences) => {
|
||||
|
|
|
@ -152,6 +152,7 @@ import Torrent from '@/components/Torrent/Torrent.vue'
|
|||
import TorrentRightClickMenu from '@/components/Torrent/TorrentRightClickMenu.vue'
|
||||
|
||||
import { TorrentSelect, General } from '@/mixins'
|
||||
import { doesCommand } from '@/helpers'
|
||||
|
||||
export default {
|
||||
name: 'Dashboard',
|
||||
|
@ -396,20 +397,25 @@ export default {
|
|||
return null
|
||||
}
|
||||
// 'ctrl + A' => select torrents
|
||||
if (e.keyCode === 65 && e.ctrlKey && e.target?.tagName !== 'INPUT') {
|
||||
if (e.keyCode === 65 && doesCommand(e) && e.target?.tagName !== 'INPUT') {
|
||||
e.preventDefault()
|
||||
|
||||
this.selectAllTorrents()
|
||||
}
|
||||
|
||||
// 'ctrl + F' => Focus search filter field
|
||||
if (e.keyCode === 70 && e.ctrlKey) {
|
||||
if (e.keyCode === 70 && doesCommand(e)) {
|
||||
e.preventDefault()
|
||||
|
||||
this.searchFilterEnabled = true
|
||||
document.getElementById('searchInput').focus()
|
||||
}
|
||||
|
||||
if (e.keyCode === 27) {
|
||||
document.getElementById('searchInput').blur()
|
||||
this.searchFilterEnabled = false
|
||||
}
|
||||
|
||||
// 'Delete' => Delete modal
|
||||
if (e.keyCode === 46) {
|
||||
e.preventDefault()
|
||||
|
|
Loading…
Add table
Reference in a new issue