Warning: fopen(/www/sites/greasyfork.icu/index/store/temp/e727375d92f9502949f6e0c1ae3c71d4.html): failed to open stream: No space left on device in /www/sites/greasyfork.icu/index/scriptsControl.php on line 132
Twitcasting Ctrl+Enter - 源代码

Greasy Fork

Greasy Fork is available in English.

Twitcasting Ctrl+Enter

It enable to send comment with ctrl + enter

// ==UserScript==
// @name         Twitcasting Ctrl+Enter
// @namespace    https://twitter.com/yoigara3
// @version      1.0
// @description  It enable to send comment with ctrl + enter
// @author       yoigara3
// @match        https://twitcasting.tv/*
// @exclude      https://twitcasting.tv/
// @icon         https://www.google.com/s2/favicons?sz=64&domain=twitcasting.tv
// @grant        none
// @license      WTFPL
// ==/UserScript==

(function() {
    'use strict';
    const area = document.getElementsByClassName('tw-textarea')[0];
    const button = document.getElementsByClassName('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);
})();