Greasy Fork镜像 支持简体中文。

GreasyFork Script Numbers figuccio

Aggiunge numeri accanto agli script GreasyFork nelle pagine utente.

  1. // ==UserScript==
  2. // @name GreasyFork Script Numbers figuccio
  3. // @namespace https://gf.qytechs.cn/users/237458
  4. // @version 0.2
  5. // @description Aggiunge numeri accanto agli script GreasyFork nelle pagine utente.
  6. // @author figuccio
  7. // @match *://gf.qytechs.cn/*/users/*
  8. // @match https://gf.qytechs.cn/*
  9. // @match https://sleazyfork.org/*
  10. // @license MIT
  11. // ==/UserScript==
  12.  
  13. (function() {
  14. 'use strict';
  15.  
  16. //Funzione 1: Stile ed evidenziazione degli script utente
  17. function applyStylesAndHighlight() {
  18. const page = +new URLSearchParams(document.location.search).get('page') || 1;
  19. const q = `<style>
  20. #browse-script-list{counter-reset: section ${(page-1)*50};}
  21. .ad-entry{height:0;overflow:hidden;}
  22. #browse-script-list li{position:relative}
  23. .Finn{background:gold;}
  24. .ad-entry{display:none}
  25. #browse-script-list li:after{
  26. counter-increment: section;
  27. content:counter(section);
  28. font:bold 20px/30px Arial;
  29. background:red;
  30. color:green;
  31. position:absolute;
  32. bottom:8px;
  33. right:15px
  34. }
  35. </style>`;
  36. document.documentElement.insertAdjacentHTML('afterbegin', q);
  37.  
  38. const a = document.querySelector(".user-profile-link a")?.href; // Utilizzare il concatenamento facoltativo
  39. if (a) { // Procedere solo se a è definito
  40. document.querySelectorAll("#browse-script-list li").forEach(function(i) {
  41. const b = i.querySelector("dd.script-list-author a");
  42. if (b && b.href === a) {
  43. i.className = 'Finn';
  44. }
  45. });
  46. }
  47. }
  48.  
  49. //Funzione 2: Aggiungere la numerazione all'elenco degli script utente nelle pagine utente
  50. function addNumberingToUserScripts() {
  51. if (window.location.href.includes("/users/")) {
  52. const scriptList = document.querySelectorAll('.script-list > li');
  53.  
  54. if (scriptList) {
  55. scriptList.forEach((script, index) => {
  56. const numberSpan = document.createElement('span');
  57. numberSpan.style.marginRight = '5px';
  58. numberSpan.style.fontWeight = 'bold';
  59. numberSpan.style.background = 'red';
  60. numberSpan.style.color = 'green';
  61. numberSpan.textContent = `${index + 1}`;
  62. script.insertBefore(numberSpan, script.firstChild);
  63. });
  64. }
  65. }
  66. }
  67.  
  68. // Chiama entrambe le funzioni
  69. applyStylesAndHighlight();
  70. addNumberingToUserScripts();
  71.  
  72. })();

QingJ © 2025

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