Merge branch 'main' into main

This commit is contained in:
Peter Cuevas 2020-08-25 15:44:12 +02:00
commit a7f5682546
2 changed files with 32 additions and 1 deletions

File diff suppressed because one or more lines are too long

View File

@ -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,33 @@ 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"){
if (isValidURL(pasteText)){
if (main_selected === 'analyzer_tab') {
EventBus.$emit('linkAnalyzerTab:reset')
socket.emit('analyzeLink', pasteText)
} else {
Downloads.sendAddToQueue(pasteText)
}
}else{
let searchbar = document.querySelector('#searchbar')
searchbar.focus()
}
}
})
/* ===== Socketio listeners ===== */ /* ===== Socketio listeners ===== */
// Debug messages for socketio // Debug messages for socketio