您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
beehaw.org Ctrl + Enter to submit comment 2
当前为
// ==UserScript== // @name beehaw.org Ctrl + Enter to submit comment // @namespace english // @description beehaw.org Ctrl + Enter to submit comment 2 // @include http*://*beehaw.org* // @version 1.5 // @run-at document-end // @license MIT // @grant GM_addStyle // ==/UserScript== // Main - CSS hides two classes - video add box, and call to action box under it. - also social media document.body.addEventListener('keydown', (event) => { if(event.key === "Enter" && (event.metaKey || event.ctrlKey)) { ctrlenterforlemmy(); //END } }); var style = document.createElement('style'); style.type = 'text/css'; style.innerHTML = ' '; document.getElementsByTagName('head')[0].appendChild(style); function ctrlenterforlemmy(){ var keyboardEvent = document.createEvent('KeyboardEvent'); var initMethod = typeof keyboardEvent.initKeyboardEvent !== 'undefined' ? 'initKeyboardEvent' : 'initKeyEvent'; keyboardEvent[initMethod]( 'keydown', // event type: keydown, keyup, keypress true, // bubbles true, // cancelable window, // view: should be window false, // ctrlKey false, // altKey false, // shiftKey false, // metaKey 9, // keyCode: unsigned long - the virtual key code, else 0 0, // charCode: unsigned long - the Unicode character associated with the depressed key, else 0 ); document.dispatchEvent(keyboardEvent); keyboardEvent = document.createEvent('KeyboardEvent'); initMethod = typeof keyboardEvent.initKeyboardEvent !== 'undefined' ? 'initKeyboardEvent' : 'initKeyEvent'; keyboardEvent2[initMethod]( 'keydown', // event type: keydown, keyup, keypress true, // bubbles true, // cancelable window, // view: should be window false, // ctrlKey false, // altKey false, // shiftKey false, // metaKey 13, // keyCode: unsigned long - the virtual key code, else 0 0, // charCode: unsigned long - the Unicode character associated with the depressed key, else 0 ); document.dispatchEvent(keyboardEvent); }