diff --git a/src/renderer/views/pages/settings.ejs b/src/renderer/views/pages/settings.ejs index df0c031a..cd61c92d 100644 --- a/src/renderer/views/pages/settings.ejs +++ b/src/renderer/views/pages/settings.ejs @@ -1333,78 +1333,6 @@ } }) }, - keyBindUpdate: function (action) { - const blur = document.createElement('div'); - blur.className = 'blur'; - blur.style.backgroundColor = 'rgba(0,0,0,0.25)'; - blur.style.position = 'fixed'; - blur.style.top = '0'; - blur.style.left = '0'; - blur.style.width = '100%'; - blur.style.height = '100%'; - blur.style.zIndex = '9999'; - blur.style.display = 'flex'; - blur.style.alignItems = 'center'; - blur.style.justifyContent = 'center'; - blur.style.fontSize = '2em'; - blur.style.color = 'white'; - blur.innerHTML = 'Press a combination of two keys to update keybinding. Press Escape key to go back.' - document.body.appendChild(blur); - - let keyBind = []; - const keyBindTimeout = setTimeout(function () { - keyBind = []; - document.body.removeChild(blur); - }, 30000); - const keyBindUpdate = function (e) { - if (document.body.contains(blur)) { - if (e.key == 'Escape') { - document.body.removeChild(blur); - clearTimeout(keyBindTimeout); - return; - } else { - if (e.keyCode >= 65 && e.keyCode <= 90 && e.keyCode <= 97 && e.keyCode <= 122) { - keyBind.push(e.key.toUpperCase()); - } else { - keyBind.push(e.key); - } - if (keyBind.length === 2) { - if (keyBind[0] !== keyBind[1]) { - app.cfg.general.keybindings[action] = keyBind - document.body.removeChild(blur); - clearTimeout(keyBindTimeout); - notyf.success(app.getLz('settings.notyf.general.keybindings.update.success')); - bootbox.confirm(app.getLz("settings.prompt.general.keybindings.update.success"), (ok) => { - if (ok) ipcRenderer.invoke("relaunchApp") - }) - } else { - keyBind = []; - } - } - } - } - }; - document.addEventListener('keydown', keyBindUpdate); - }, - keyBindReset: function () { - app.cfg.general.keybindings.search = [app.platform == "darwin" ? "Command" : "Control", "S"]; - app.cfg.general.keybindings.listennow = [app.platform == "darwin" ? "Command" : "Control", "L"]; - app.cfg.general.keybindings.browse = [app.platform == "darwin" ? "Command" : "Control", "B"]; - app.cfg.general.keybindings.recentAdded = [app.platform == "darwin" ? "Command" : "Control", "G"]; - app.cfg.general.keybindings.albums = [app.platform == "darwin" ? "Command" : "Control", "F"]; - app.cfg.general.keybindings.artists = [app.platform == "darwin" ? "Command" : "Control", "D"]; - app.cfg.general.keybindings.togglePrivateSession = [app.platform == "darwin" ? "Command" : "Control", "P"]; - app.cfg.general.keybindings.webRemote = [app.platform == "darwin" ? "Command" : "Control", "W"]; - app.cfg.general.keybindings.audioSettings = [app.platform == "darwin" ? "Option" : "Alt", "A"]; - app.cfg.general.keybindings.pluginMenu = [app.platform == "darwin" ? "Option" : "Alt", "P"]; - app.cfg.general.keybindings.castToDevices = [app.platform == "darwin" ? "Option" : "Alt", "C"]; - app.cfg.general.keybindings.settings = [app.platform == "darwin" ? "Option" : "Alt", "S"]; - app.cfg.general.keybindings.openDeveloperTools = [app.platform == "darwin" ? "Command" : "Control", app.platform == "darwin" ? "Option" : "Shift", "I"]; - notyf.success(app.getLz('settings.notyf.general.keybindings.update.success')); - bootbox.confirm(app.getLz("settings.prompt.general.keybindings.update.success"), (ok) => { - if (ok) ipcRenderer.invoke("relaunchApp") - }) - }, gitHubExplore() { app.appRoute("themes-github") },