Fix "You can't perform that action at this time" for Github

Fix issue of Github when star repo. Reference: https://github.com/orgs/community/discussions/69366

  1. // ==UserScript==
  2. // @name Fix "You can't perform that action at this time" for Github
  3. // @namespace Cesar
  4. // @match https://github.com/*
  5. // @grant none
  6. // @version 1.0
  7. // @author Cesar
  8. // @license MIT
  9. // @description Fix issue of Github when star repo. Reference: https://github.com/orgs/community/discussions/69366
  10. // ==/UserScript==
  11.  
  12. // This code is generated by ChatGPT
  13. if (!Element.prototype.checkVisibility) {
  14. Element.prototype.checkVisibility = function() {
  15. var computedStyle = window.getComputedStyle(this);
  16.  
  17. // Check if the element has display:none or is hidden
  18. if (computedStyle.display === 'none' || this.hidden) {
  19. return false;
  20. }
  21.  
  22. // Check if the element has visibility:hidden
  23. if (computedStyle.visibility === 'hidden') {
  24. return false;
  25. }
  26.  
  27. // Check if the element has content-visibility:auto and is not hidden
  28. if (computedStyle.contentVisibility === 'auto' && this.offsetHeight === 0) {
  29. return false;
  30. }
  31.  
  32. // Check if the element has opacity:0
  33. if (computedStyle.opacity === '0') {
  34. return false;
  35. }
  36.  
  37. return true;
  38. };
  39. }