Cases.GG - Text to Link

This script will replace all "case-battle/1234567" text messages to clickable links.

目前为 2025-01-12 提交的版本。查看 最新版本

  1. // ==UserScript==
  2. // @name Cases.GG - Text to Link
  3. // @description This script will replace all "case-battle/1234567" text messages to clickable links.
  4. // @match https://cases.gg/*
  5. // @grant none
  6. // @license WTFPL
  7. // @version 0.0.1.20250112001300
  8. // @namespace https://greasyfork.org/users/1422210
  9. // ==/UserScript==
  10. (function() {
  11. 'use strict';
  12. setInterval(function() {
  13. var textSpans = document.querySelectorAll('span');
  14. for (var i = 0; i < textSpans.length; i++) {
  15. var span = textSpans[i];
  16. var text = span.textContent;
  17. if (text.includes("case-battles")) {
  18. var regex = /(case-battles\/[^\s]+)/gi;
  19. var newText = text.replace(regex, '<a href="https:\/\/cases\.gg\/$&" target="_blank" style="color: #22c55e;">$&</a>');
  20. span.innerHTML = newText;
  21. }
  22. }
  23. }, 500);
  24. })();