contentEditable

Applies contentEditable when F7 is pressed

当前为 2017-04-17 提交的版本,查看 最新版本

  1. // ==UserScript==
  2. // @name contentEditable
  3. // @version 1
  4. // @description Applies contentEditable when F7 is pressed
  5. // @author JaPNaA
  6. // @match *://*/*
  7. // @grant none
  8. // @namespace https://greasyfork.org/users/117222
  9. // ==/UserScript==
  10.  
  11. var j=118;
  12. // Set "j" to any keyCode you wish.
  13. // KeyCode 118 is the [ F7 ] key.
  14.  
  15. (function() {
  16. var a=false,b=document.body;
  17. window.addEventListener('keydown',function(e){
  18. if(e.keyCode==j){
  19. if(!a){
  20. b.setAttribute('contentEditable',"");
  21. b.setAttribute("spellcheck","false");
  22. }else{
  23. b.removeAttribute('contentEditable');
  24. b.removeAttribute('spellcheck');
  25. }
  26. a=!a;
  27. }
  28. });
  29. })();