It enable to send comment with ctrl + enter
< 脚本Twitcasting Ctrl+Enter的反馈
(function() { 'use strict'; const area = document.getElementsByClassName('tw-textarea')[0]; const button = document.querySelectorAll('.tw-comment-post-operations .tw-button-primary')[0]; if(!area || !button) return; const send = () => { button.click(); } const handleEvent = (e) => { if(e.code=='Enter' && e.ctrlKey && area.value!==''){ send(); } } document.addEventListener("keydown",handleEvent);})();別のボタンをクリックしてしまっていたので、こちらが正しいようです。
登录以发表回复。
(function() {
'use strict';
const area = document.getElementsByClassName('tw-textarea')[0];
const button = document.querySelectorAll('.tw-comment-post-operations .tw-button-primary')[0];
if(!area || !button) return;
const send = () => {
button.click();
}
const handleEvent = (e) => {
if(e.code=='Enter' && e.ctrlKey && area.value!==''){
send();
}
}
document.addEventListener("keydown",handleEvent);
})();
別のボタンをクリックしてしまっていたので、こちらが正しいようです。