navigate-canonical

Go to the canonical page

  1. // ==UserScript==
  2. // @name navigate-canonical
  3. // @namespace https://ciffelia.com/
  4. // @version 1.0.0
  5. // @description Go to the canonical page
  6. // @author Ciffelia <mc.prince.0203@gmail.com> (https://ciffelia.com/)
  7. // @license MIT
  8. // @homepage https://github.com/ciffelia/navigate-canonical#readme
  9. // @supportURL https://github.com/ciffelia/navigate-canonical/issues
  10. // @include *
  11. // @grant GM_registerMenuCommand
  12. // @run-at document-idle
  13. // ==/UserScript==
  14.  
  15. (function () {
  16. 'use strict';
  17.  
  18. const navigate = () => {
  19. location.href = document.querySelector('link[rel=canonical]').href;
  20. };
  21.  
  22. GM_registerMenuCommand('Go to the canonical page', navigate, 'g');
  23.  
  24. }());