From da5e8039db01042b2b694a5a70e512d009286cd1 Mon Sep 17 00:00:00 2001 From: nekobit Date: Sat, 9 Jul 2022 08:27:08 +0000 Subject: [PATCH] Control + enter to submit form FossilOrigin-Name: 8f7945affc483246637b0cd636a609b1f697469350ceef114d1ac54ebe9180bf --- dist/js/main.js | 12 ++++++++++++ dist/treebird-dark.css | 16 ++++++++++++++++ dist/treebird.css | 9 ++++++++- static/post.tmpl | 2 +- 4 files changed, 37 insertions(+), 2 deletions(-) diff --git a/dist/js/main.js b/dist/js/main.js index 57b0d9b..49e8308 100644 --- a/dist/js/main.js +++ b/dist/js/main.js @@ -25,6 +25,17 @@ function reply_get_mentions(reply, content) return res; } +function form_enter_submit(e, that) +{ + if ((e.ctrlKey || e.metaKey) && e.keyCode === 13) + that.closest('form').submit(); +} + +// Submit form entry on enter when in textbox/textarea +document.querySelectorAll("input[type=text], input[type=url], input[type=email], input[type=password], textarea").forEach((i) => { + i.addEventListener("keydown", e => form_enter_submit(e, i)); +}); + function construct_quick_reply_form(status) { let src = document.createElement("form"); @@ -87,6 +98,7 @@ function construct_quick_reply_form(status) statusfooter.appendChild(statusfooter_sides.left); statusfooter.appendChild(statusfooter_sides.right); statusbox.appendChild(textarea); + textarea.addEventListener("keydown", e => form_enter_submit(e, textarea)); statusbox.appendChild(statusfooter); src.appendChild(hiddeninput); src.appendChild(statusbox); diff --git a/dist/treebird-dark.css b/dist/treebird-dark.css index b26d169..55e23db 100644 --- a/dist/treebird-dark.css +++ b/dist/treebird-dark.css @@ -262,3 +262,19 @@ ul.large-list li .edit-list-btn { background-color: #371b1b; } + +.statusbox .post-group input[type=radio].hidden:checked + .visibility-icon svg +{ + stroke: #fff; +} + +.statusbox .post-group .visibility-icon:hover +{ + background-color: #4f4f4f; +} + +.emoji-react-box +{ + border: 1px solid #515151; + padding: 3px 7px; +} diff --git a/dist/treebird.css b/dist/treebird.css index 6554149..4e998ea 100644 --- a/dist/treebird.css +++ b/dist/treebird.css @@ -1729,11 +1729,18 @@ input[type=radio].hidden:not(:checked) + .emoji-picker-emojos { display: inline-block; list-style-type: none; - padding: 5px 7px; + padding: 3px 7px; margin: 1px 2px; vertical-align: middle; } +.emoji-react-box .emoji +{ + position: relative; + top: 1px; + font-size: 20px; +} + .emoji-react-box.custom-emoji-container { padding: 1px 5px; diff --git a/static/post.tmpl b/static/post.tmpl index 042b5cc..dd5e9d1 100644 --- a/static/post.tmpl +++ b/static/post.tmpl @@ -43,7 +43,7 @@