From 10e29090d8318555d6ca7860d2ce00d9fcc3ce9e Mon Sep 17 00:00:00 2001 From: Araxeus <78568641+Araxeus@users.noreply.github.com> Date: Sun, 4 Apr 2021 21:52:16 +0300 Subject: [PATCH] stylecheck --- menu.js | 41 ++++++++----------- prompt/customTitlebar.js | 4 +- prompt/darkPrompt.css | 52 ++++++++++++------------ prompt/page/prompt.css | 88 ++++++++++++++++++++-------------------- 4 files changed, 90 insertions(+), 95 deletions(-) diff --git a/menu.js b/menu.js index 0312778f..18764681 100644 --- a/menu.js +++ b/menu.js @@ -148,7 +148,7 @@ const mainMenuTemplate = (win) => [ type: "checkbox", checked: !!config.get("options.proxy"), click: (item) => { - setProxy(item); + setProxy(item, win); } }, { @@ -311,36 +311,31 @@ module.exports.setApplicationMenu = (win) => { const iconPath = path.join(__dirname, "assets", "youtube-music-tray.png"); const example = `Example: "socks5://127.0.0.1:9999"`; -function setProxy(item) { +function setProxy(item, win) { let options = { title: 'Set Proxy', - label: 'Enter Proxy Address (leave empty to disable)', + label: 'Enter Proxy Address: (leave empty to disable)', value: config.get("options.proxy") || example, inputAttrs: { type: 'text' }, type: 'input', - alwaysOnTop: true, icon: iconPath, - customStylesheet: path.join(__dirname, "prompt","darkPrompt.css"), + customStylesheet: path.join(__dirname, "prompt", "darkPrompt.css"), + frame: false, + customScript: path.join(__dirname, "prompt", "customTitlebar.js"), + enableRemoteModule: true, + height: 200, + width: 450, }; - if (config.plugins.isEnabled("in-app-menu")) { - Object.assign(options, { - frame: false, - customScript: path.join(__dirname, "prompt","customTitlebar.js"), - enableRemoteModule: true, - height: 200, - width: 450, + prompt(options, win) + .then((input) => { + if (input !== null && input !== example) { + config.set("options.proxy", input); + item.checked = (input === "") ? false : true; + } else { //user pressed cancel + item.checked = !item.checked; //reset checkbox + } }) - } - prompt(options) - .then((input) => { - if(input !== null && input !== example) { - config.set("options.proxy", input); - item.checked = (input === "") ? false : true; - } else { //user pressed cancel - item.checked = !item.checked; //reset checkbox - } - }) - .catch(console.error); + .catch(console.error); } \ No newline at end of file diff --git a/prompt/customTitlebar.js b/prompt/customTitlebar.js index 5dc942cf..116aa56c 100644 --- a/prompt/customTitlebar.js +++ b/prompt/customTitlebar.js @@ -2,11 +2,11 @@ const customTitlebar = require("custom-electron-titlebar"); module.exports = () => { const bar = new customTitlebar.Titlebar({ - backgroundColor: customTitlebar.Color.fromHex("#050505"), + backgroundColor: customTitlebar.Color.fromHex("#050505"), minimizable: false, maximizable: false, unfocusEffect: true, - }); + }); try { bar.updateMenu(null); } catch (e) { diff --git a/prompt/darkPrompt.css b/prompt/darkPrompt.css index 311c42b5..8b343a25 100644 --- a/prompt/darkPrompt.css +++ b/prompt/darkPrompt.css @@ -1,47 +1,45 @@ - body { - background-color: rgba(0, 0, 0, 0.3); - background-image: linear-gradient(315deg, #200000 0%, #13253a 74%); - color:whitesmoke; + background-color: rgba(0, 0, 0, 0.3); + background-image: linear-gradient(315deg, #200000 0%, #13253a 74%); + color: whitesmoke; } #label { - text-align: center; + text-align: center; } #container { - background: rgba( 0, 0, 0, 0.7 ); - box-shadow: 0 8px 32px 0 rgba( 31, 38, 135, 0.37 ); - backdrop-filter: blur( 10.0px ); - -webkit-backdrop-filter: blur( 10.0px ); - border-radius: 10px; - border: 1px solid rgba(80, 0, 0, 0.4); - overflow: hidden; + background: rgba(0, 0, 0, 0.7); + box-shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.37); + backdrop-filter: blur(10px); + -webkit-backdrop-filter: blur(10px); + border-radius: 10px; + border: 1px solid rgba(80, 0, 0, 0.4); + overflow: hidden; } #data { - background: unset; - color: whitesmoke; - border: 1px solid rgb(54, 54, 54); + background: unset; + color: whitesmoke; + border: 1px solid rgb(54, 54, 54); } #data:hover { - border: 1px solid rgb(85, 85, 85); + border: 1px solid rgb(85, 85, 85); } #data:focus { - outline: unset; - border: 1px solid rgb(85, 85, 85); + outline: unset; + border: 1px solid rgb(85, 85, 85); } - #ok:hover, #cancel:hover { - outline: rgba(60, 0, 0, 0.4) solid 2px; - /* - border: 1px solid rgba(60, 0, 0, 0.4); - */ +#ok:hover, +#cancel:hover { + outline: rgba(60, 0, 0, 0.4) solid 2px; } -#ok, #cancel { - background-color: rgb(0, 0, 0); - color: whitesmoke; -} \ No newline at end of file +#ok, +#cancel { + background-color: rgb(0, 0, 0); + color: whitesmoke; +} diff --git a/prompt/page/prompt.css b/prompt/page/prompt.css index b18d1fc0..c3530e57 100644 --- a/prompt/page/prompt.css +++ b/prompt/page/prompt.css @@ -1,78 +1,80 @@ body { - font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", Helvetica, Arial, sans-serif; - line-height: 1.5em; - color: #333; - background-color: #fff; - overflow-y: hidden; + font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, + Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", Helvetica, Arial, + sans-serif; + line-height: 1.5em; + color: #333; + background-color: #fff; + overflow-y: hidden; } ::-webkit-scrollbar { - width: 0 !important; - display: none; + width: 0 !important; + display: none; } #container { - align-items: center; - justify-content: center; - display: flex; - height: 100%; - overflow-y: hidden; + align-items: center; + justify-content: center; + display: flex; + height: 100%; + overflow-y: hidden; } #form { - width: 100%; - padding-top: .5em; + width: 100%; + padding-top: 0.5em; } #label { - max-width: 100%; - max-height: 100%; - margin-bottom: .8em; - padding: 0 .5em; - white-space: nowrap; - overflow: hidden; - text-overflow: ellipsis; + max-width: 100%; + max-height: 100%; + margin-bottom: 0.8em; + padding: 0 0.5em; + white-space: nowrap; + overflow: hidden; + text-overflow: ellipsis; } #data { - border-radius: 2px; - background: #fff; - width: 90%; - padding: .4em .5em; - border: 1px solid black; - min-height: 2em; - margin: 0 0 1.2em; + border-radius: 2px; + background: #fff; + width: 90%; + padding: 0.4em 0.5em; + border: 1px solid black; + min-height: 2em; + margin: 0 0 1.2em; } select#data { - height: 2em; + height: 2em; } #data-container { - text-align: center; + text-align: center; } #buttons { - text-align: right; - padding: 0 .5em 0 0; + text-align: right; + padding: 0 0.5em 0 0; } #buttons > button, -#buttons > input[type=submit] { - border-radius: 2px; - border: 0; - margin: 0 0 0 .5em; - font-size: .8em; - line-height: 1em; - padding: .6em 1em +#buttons > input[type="submit"] { + border-radius: 2px; + border: 0; + margin: 0 0 0 0.5em; + font-size: 0.8em; + line-height: 1em; + padding: 0.6em 1em; } #ok { - background-color: #3879D9; - color: white; + background-color: #3879d9; + color: white; } #cancel { - background-color: #DDD; - color: black; + background-color: #ddd; + color: black; }