Greasy Fork 支持 简体中文。

Invisible Typer

Type an invisible character when pressing CTRL + Space.

  1. // ==UserScript==
  2. // @name Invisible Typer
  3. // @namespace Royalgamer06
  4. // @version 1.0
  5. // @description Type an invisible character when pressing CTRL + Space.
  6. // @author Royalgamer06
  7. // @include *
  8. // @exclude file://*
  9. // @grant unsafeWindow
  10. // @run-at document-idle
  11. // ==/UserScript==
  12.  
  13. var charcode = 8290; //10240, 8290, 8192, 8193, 8239, 8204, 8195, 4448, 12644
  14. unsafeWindow.onkeydown = function(e) {
  15. if (e.ctrlKey && e.keyCode == 32) {
  16. try {
  17. document.execCommand('insertText', false, String.fromCharCode(charcode));
  18. } catch(c) {
  19. try {
  20. document.activeElement.value = document.activeElement.value.slice(0, document.activeElement.selectionStart) + String.fromCharCode(charcode) + document.activeElement.value.slice(document.activeElement.selectionEnd);
  21. } catch(c) {}
  22. }
  23. }
  24. };