Unity Docs Redirect

Redirect old Unity docs to its latest LTS version

  1. // ==UserScript==
  2. // @name Unity Docs Redirect
  3. // @namespace https://github.com/Maoyeedy/
  4. // @version 1.0
  5. // @author Maoyeedy
  6. // @license MIT
  7. // @description Redirect old Unity docs to its latest LTS version
  8. // @icon https://unity.com/favicon.ico
  9.  
  10. // @match https://docs.unity3d.com/*/Documentation/*
  11. // @grant none
  12.  
  13. // ==/UserScript==
  14.  
  15. const regex = /^https:\/\/docs\.unity3d\.com\/[0-9.]+\/Documentation\//
  16.  
  17. if (regex.test(window.location.href)) {
  18. let newUrl = window.location.href.replace(regex, 'https://docs.unity3d.com/Documentation/')
  19. window.location.replace(newUrl)
  20. }