Editable Title

Makes document title element editable

  1. // ==UserScript==
  2. // @name Editable Title
  3. // @namespace myfonj
  4. // @include *
  5. // @grant none
  6. // @version 1.0.2
  7. // @run-at document-start
  8. // @description Makes document title element editable
  9. // @license CC0
  10. // ==/UserScript==
  11. /*
  12. https://gf.qytechs.cn/en/scripts/454707/versions/new
  13. 1.0.1 (2022-11-14) workaround for Firefox https://bugzilla.mozilla.org/show_bug.cgi?id=1291467
  14. */
  15.  
  16. const conf = {capture: true};
  17. const dd = document.documentElement;
  18.  
  19. function editablizeTitleWhenClickizored ( event ) {
  20. const tgt = event.target;
  21. if( tgt?.constructor?.name !== 'HTMLTitleElement' ) {
  22. return;
  23. }
  24. // workaround for bug 1291467
  25. document.body.appendChild(tgt);
  26. tgt.addEventListener('blur',function(){document.head.appendChild(tgt)},{once:true})
  27. tgt.setAttribute('contenteditable', '');
  28. // tgt.focus();
  29. // dd.removeEventListener('click', editablizeTitleWhenClickizored, conf);
  30. }
  31.  
  32. dd.addEventListener('mousedown', editablizeTitleWhenClickizored, conf);

QingJ © 2025

镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址