GreasyFork 增强

便捷功能

  1. // ==UserScript==
  2. // @name GreasyFork 增强
  3. // @namespace https://greasyfork.org/
  4. // @version 2024.12.26
  5. // @description 便捷功能
  6. // @author Ejin
  7. // @match https://greasyfork.org/*/users/*
  8. // @match https://greasyfork.org/*/scripts*
  9. // @grant none
  10. // ==/UserScript==
  11.  
  12. // 2024.08.04 用户自己的脚本列表,讨论提醒:删除已回答过的讨论和更早的讨论
  13. // 2024.01.30 脚本列表、脚本搜索列表,收藏页脚本列表增加快捷进入代码页链接。
  14. // 2024.01.30 用户自己的脚本列表增加快捷进入代码页、更新页的链接。
  15. setTimeout(function() {
  16.  
  17. //用户自己的脚本列表,增加快捷进入代码页、更新页的链接。
  18. if( /users\/\d+/.test(location.href) ){
  19. // 选择器=(脚本+未上架脚本链接)
  20. document.querySelectorAll("#user-script-list-section .script-link, #user-unlisted-script-list-section .script-link").forEach(ele => {
  21. var newspan=document.createElement("span");
  22. newspan.style.fontSize="0.75em";
  23. newspan.innerHTML=`
  24. <a href="${ele.href}/code">code</a>
  25. &nbsp;
  26. <a href="${ele.href}/versions/new">edit</a>
  27. `;
  28. ele.parentElement.insertBefore(newspan,ele.parentElement.children[2]);
  29. });
  30. }
  31.  
  32. //用户自己的脚本列表,讨论提醒:删除已回答过的讨论和更早的讨论
  33. if( /users\/\d+/.test(location.href) ){
  34. var hide=0;
  35. document.querySelectorAll(".discussion-list-container").forEach((ele,i)=>{
  36. if(i==0)return;
  37. if(hide==1 || ele.querySelectorAll("a[href*='/users/']")[1].href.indexOf("ejin") != -1){
  38. ele.remove();
  39. hide=1;
  40. }
  41. });
  42. }
  43.  
  44. //脚本列表、脚本搜索列表,收藏页脚本列表增加快捷进入代码页链接。
  45. if( location.pathname.indexOf("/scripts")!= -1 ){
  46. document.querySelectorAll(".script-link").forEach(ele => {
  47. var newspan=document.createElement("span");
  48. newspan.style.fontSize="0.75em";
  49. newspan.innerHTML=`
  50. <a href="${ele.href}/code">code</a>
  51. `;
  52. ele.parentElement.insertBefore(newspan,ele.parentElement.children[2]);
  53. });
  54. }
  55. },0);