Greasy Fork镜像 支持简体中文。

SlidySim Online Long Replay Links Fix

Resolves the "URI Too Long" error when loading large replays on SlidySim Online and bypasses Google redirect error page

  1. // ==UserScript==
  2. // @name SlidySim Online Long Replay Links Fix
  3. // @version 1.2.0
  4. // @description Resolves the "URI Too Long" error when loading large replays on SlidySim Online and bypasses Google redirect error page
  5. // @author dphdmn
  6. // @match https://slidysim.online/*
  7. // @match https://www.google.com/url?q=https://slidysim.online/*
  8. // @icon https://raw.githubusercontent.com/dphdmn/openslidy/refs/heads/main/images/eggIcon.ico
  9. // @license MIT
  10. // @namespace dphdmn
  11. // ==/UserScript==
  12. /* global loadCustomReplay */
  13.  
  14. (function() {
  15. 'use strict';
  16.  
  17. const ERROR_MESSAGE = 'Error: URI Too Long';
  18. const GOOGLE_ERROR_MESSAGE = 'The page you were on is trying to send you to an invalid URL (https://slidysim';
  19. const STORAGE_KEY = 'slidysim_replay_data';
  20. const REPLAY_URL = 'https://slidysim.online/replay';
  21.  
  22. const saveReplayData = data => localStorage.setItem(STORAGE_KEY, data);
  23. const loadReplayData = () => localStorage.getItem(STORAGE_KEY);
  24. const clearReplayData = () => localStorage.removeItem(STORAGE_KEY);
  25.  
  26. const handleSlidySimReplay = () => {
  27. if (document.body.textContent.includes(ERROR_MESSAGE)) {
  28. saveReplayData(window.location.href);
  29. window.location.href = REPLAY_URL;
  30. } else if (window.location.pathname === '/replay') {
  31. const replayData = loadReplayData();
  32. if (!replayData) return;
  33.  
  34. try {
  35. const urlParams = new URL(replayData).searchParams;
  36. const replayParam = urlParams.get('r');
  37. if (replayParam) {
  38. loadCustomReplay(replayParam);
  39. clearReplayData();
  40. }
  41. } catch (error) {
  42. // Silently ignore invalid URLs
  43. }
  44. }
  45. };
  46.  
  47. const handleGoogleRedirect = () => {
  48. if (document.body.textContent.includes(GOOGLE_ERROR_MESSAGE)) {
  49. const match = document.body.textContent.match(/URL \((https:\/\/slidysim[^)]+)\)/);
  50. if (match && match[1]) {
  51. window.location.href = match[1];
  52. }
  53. }
  54. };
  55.  
  56. if (window.location.hostname === 'www.google.com') {
  57. handleGoogleRedirect();
  58. } else if (window.location.hostname === 'slidysim.online') {
  59. handleSlidySimReplay();
  60. }
  61. })();

QingJ © 2025

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