Click to Not Edit

Prevents click-to-edit in JIRA (matches JIRA Cloud URLs by default)

当前为 2020-12-21 提交的版本,查看 最新版本

  1. // ==UserScript==
  2. // @name Click to Not Edit
  3. // @match *://*.atlassian.net/*
  4. // @version 0.0.1.20201221192427
  5. // @namespace https://gf.qytechs.cn/users/719533
  6. // @description Prevents click-to-edit in JIRA (matches JIRA Cloud URLs by default)
  7. // ==/UserScript==
  8. //
  9. // This is supposed to disable click-to-edit in Jira unless ctrl or cmd is held.
  10.  
  11. document.addEventListener('click',
  12. ((event)=>{
  13. if (event.cmdKey || event.ctrlKey){
  14. return; // allow normal click-to-edit
  15. }
  16. var e = event.target;
  17. while (e != document){
  18. var aa = e.attributes;
  19. for (var i=0; i<aa.length; ++i){
  20. var a = aa[i];
  21. if(a.name=='role' && a.value=='presentation' && e.tagName!='SPAN'){
  22. // This is an attempt to cleanly match relevant elements (comments, description) despite class obfuscation.
  23. // Excluding <span> avoids inhibiting clicks on attach/link buttons.
  24.  
  25. console.log("CLICKED TO NOT EDIT, hold ctrl/cmd if you really want the thing to happen");
  26. event.preventDefault(); event.stopPropagation(); return false;
  27. };
  28. }
  29. e = e.parentNode;
  30. }
  31. }),
  32. {capture: true})

QingJ © 2025

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