From 5fdcf6a0108d0cf9c1445c45838593888b7c0341 Mon Sep 17 00:00:00 2001 From: Kubat <mael.martin31@gmail.com> Date: Fri, 6 Nov 2020 13:09:27 +0100 Subject: [PATCH] Place scripts in the js file and add a shortcut for the search bar --- instance/index.html | 13 +------------ instance/main.js | 17 +++++++++++++++++ main.js | 1 + 3 files changed, 19 insertions(+), 12 deletions(-) diff --git a/instance/index.html b/instance/index.html index cc36629..bb77bf4 100644 --- a/instance/index.html +++ b/instance/index.html @@ -22,18 +22,7 @@ display: none; } </style> - <script> - $(document).ready(() => { - $('#filterInput').on('keypress', e => { - /* On 'Return'. */ - if (e.which != 13) return; - ipcRenderer.send( - 'reload-db-request', - $('#filterInput').val() - ); - }); - }); - </script> + <script></script> </head> <body> <div id="mainFrame" class="container-fluid"> diff --git a/instance/main.js b/instance/main.js index ae5fd86..d09f36a 100644 --- a/instance/main.js +++ b/instance/main.js @@ -48,6 +48,23 @@ window.onload = () => { addIpcToButton('reloadDb', ['reload-db-request', 'reload-queue-request']); logger.debug('instance', 'Window loaded'); + + $('#filterInput').on('keypress', e => { + /* On 'Return'. */ + if (e.which != 13) return; + ipcRenderer.send('reload-db-request', $('#filterInput').val()); + }); + + document.addEventListener( + 'keydown', + e => { + if (e.ctrlKey && e.keyCode == 70) { + logger.debug('instance', 'Focus find bar'); + $('#filterInput').focus(); + } + }, + false + ); }; /* Create the button list */ diff --git a/main.js b/main.js index 9fdaefb..5241605 100644 --- a/main.js +++ b/main.js @@ -31,6 +31,7 @@ function createInstanceWindow() { const win = new BrowserWindow({ width: 1280, height: 720, + hasShadow: false, frame: false, menuBarVisible: true, webPreferences: { -- GitLab