Py3Direct

Replaces text in the url to automatically redirect from Py 2 docs to Py 3

  1. // ==UserScript==
  2. // @name Py3Direct
  3. // @name:en Py3Direct
  4. // @version 0.3
  5. // @description Replaces text in the url to automatically redirect from Py 2 docs to Py 3
  6. // @namespace https://greatest.deepsurf.us/en/scripts/26235-py3direct
  7. // @author https://github.com/kimpeek
  8. // @include *docs.python.org/*
  9. // ==/UserScript==
  10.  
  11. if (/2\.\d?/.test(window.location.href)){
  12. window.location = window.location.href.replace(/2\.\d?/, '3');
  13. } else if (window.location.href.includes('docs.python.org/2/')){
  14. window.location = window.location.href.replace('docs.python.org/2/', 'docs.python.org/3/');
  15. }