Merge branch 'main' into main
This commit is contained in:
commit
a7f5682546
File diff suppressed because one or more lines are too long
31
src/app.js
31
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,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
|
||||||
|
Loading…
Reference in New Issue
Block a user