# HG changeset patch # User HIROSE Yuuji # Date 1617688304 -32400 # Node ID 9184aa358773f6cc9612b888855e08988ce660e2 # Parent 3a19873ca4f5399a12cd5578ec82aa4f27dae566 Fake click at Ctrl-Enter posting for ajax post. diff -r 3a19873ca4f5 -r 9184aa358773 s4-main.js --- a/s4-main.js Sun Mar 28 16:33:40 2021 +0900 +++ b/s4-main.js Tue Apr 06 14:51:44 2021 +0900 @@ -478,9 +478,13 @@ } return stra.join("\n"); } - function submitThisForm(input) { + function submitThisForm(e) { + var input = e.target, ajaxpost = document.getElementById("c"); for (var elm=input.parentNode; elm; elm = elm.parentNode) { - if (elm.nodeName.match(/form/i)) { + if (ajaxpost) { + ajaxpost.click(); + return true; + } else if (elm.nodeName.match(/form/i)) { elm.submit(); return true; } @@ -505,7 +509,7 @@ } function helpMarkdownEnter(e) { if (e.keyCode == 13 && !e.shiftKey) { - if (e.ctrlKey && submitThisForm(e.target)) { + if (e.ctrlKey && submitThisForm(e)) { e.preventDefault(); return; }