s4
changeset 934:9184aa358773
Fake click at Ctrl-Enter posting for ajax post.
author | HIROSE Yuuji <yuuji@gentei.org> |
---|---|
date | Tue, 06 Apr 2021 14:51:44 +0900 |
parents | 3a19873ca4f5 |
children | c17e67348950 |
files | s4-main.js |
diffstat | 1 files changed, 7 insertions(+), 3 deletions(-) [+] |
line diff
1.1 --- a/s4-main.js Sun Mar 28 16:33:40 2021 +0900 1.2 +++ b/s4-main.js Tue Apr 06 14:51:44 2021 +0900 1.3 @@ -478,9 +478,13 @@ 1.4 } 1.5 return stra.join("\n"); 1.6 } 1.7 - function submitThisForm(input) { 1.8 + function submitThisForm(e) { 1.9 + var input = e.target, ajaxpost = document.getElementById("c"); 1.10 for (var elm=input.parentNode; elm; elm = elm.parentNode) { 1.11 - if (elm.nodeName.match(/form/i)) { 1.12 + if (ajaxpost) { 1.13 + ajaxpost.click(); 1.14 + return true; 1.15 + } else if (elm.nodeName.match(/form/i)) { 1.16 elm.submit(); 1.17 return true; 1.18 } 1.19 @@ -505,7 +509,7 @@ 1.20 } 1.21 function helpMarkdownEnter(e) { 1.22 if (e.keyCode == 13 && !e.shiftKey) { 1.23 - if (e.ctrlKey && submitThisForm(e.target)) { 1.24 + if (e.ctrlKey && submitThisForm(e)) { 1.25 e.preventDefault(); 1.26 return; 1.27 }