Added CTRL+BACKSPACE and CTRL+V global shortcuts
This commit is contained in:
parent
fb87766ea0
commit
1e69e48486
File diff suppressed because one or more lines are too long
26
src/app.js
26
src/app.js
@ -14,6 +14,10 @@ import { socket } from '@/utils/socket'
|
|||||||
import { toast } from '@/utils/toasts'
|
import { toast } from '@/utils/toasts'
|
||||||
import { init as initTabs } from '@js/tabs.js'
|
import { init as initTabs } from '@js/tabs.js'
|
||||||
|
|
||||||
|
import { isValidURL } from '@/utils/utils'
|
||||||
|
import Downloads from '@/utils/downloads'
|
||||||
|
import EventBus from '@/utils/EventBus.js'
|
||||||
|
|
||||||
/* ===== App initialization ===== */
|
/* ===== App initialization ===== */
|
||||||
|
|
||||||
function startApp() {
|
function startApp() {
|
||||||
@ -39,6 +43,28 @@ function initClient() {
|
|||||||
document.addEventListener('DOMContentLoaded', startApp)
|
document.addEventListener('DOMContentLoaded', startApp)
|
||||||
window.addEventListener('pywebviewready', initClient)
|
window.addEventListener('pywebviewready', initClient)
|
||||||
|
|
||||||
|
/* ===== Global shortcuts ===== */
|
||||||
|
|
||||||
|
document.addEventListener('keyup', keyEvent => {
|
||||||
|
if (keyEvent.key == "Backspace" && keyEvent.ctrlKey){
|
||||||
|
let searchbar = document.querySelector('#searchbar')
|
||||||
|
searchbar.value = ""
|
||||||
|
searchbar.focus()
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
document.addEventListener('paste', pasteEvent => {
|
||||||
|
pasteText = pasteEvent.clipboardData.getData('Text')
|
||||||
|
if (pasteEvent.target.localName != "input" && isValidURL(pasteText)){
|
||||||
|
if (main_selected === 'analyzer_tab') {
|
||||||
|
EventBus.$emit('linkAnalyzerTab:reset')
|
||||||
|
socket.emit('analyzeLink', pasteText)
|
||||||
|
} else {
|
||||||
|
Downloads.sendAddToQueue(pasteText)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
/* ===== Socketio listeners ===== */
|
/* ===== Socketio listeners ===== */
|
||||||
|
|
||||||
// Debug messages for socketio
|
// Debug messages for socketio
|
||||||
|
Loading…
Reference in New Issue
Block a user