Twitcasting Ctrl+Enter

It enable to send comment with ctrl + enter

< Opiniones de Twitcasting Ctrl+Enter

Puntuación: Malo; el script no funciona

§
Publicado: 22/04/2023
Editado: 22/04/2023

(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);
})();

別のボタンをクリックしてしまっていたので、こちらが正しいようです。

Publicar respuesta

Inicia sesión para responder.