Skip to main content
8 of 9
deleted 1189 characters in body
Brock Adams
  • 13k
  • 5
  • 39
  • 64

Good idea. There's a few minor niggles, though:

  1. Don't use unsafeWindow, this will break in Chrome and will not even work in Firefox+Greasemonkey if the effective @grant changes.

  2. Avoid leading * wildcards in @includes, if you can help it. This is a big performance hit. @match limits the wildcard scope and performs much better and reports the sites/security correctly on Chrome. This gets all current SE sites:

     // @match       *://*.askubuntu.com/questions/*
     // @match       *://*.onstartups.com/questions/*
     // @match       *://*.serverfault.com/questions/*
     // @match       *://*.stackapps.com/questions/*
     // @match       *://*.stackexchange.com/questions/*
     // @match       *://*.stackoverflow.com/questions/*
     // @match       *://*.superuser.com/questions/*
    
  3. The regex match needs to be more robust, to account for all legal characters in the URL, and for anchors.

  4. Use injection so that the script will work on most userscript-capable browsers (Chrome, Firefox, Opera, Safari, etc.).


Here's a variant of the script I've been using. It also adds a "revisions" link since a post's history is sometimes hidden. It works on Chrome and Firefox, and should work on most other userscript-capable browsers:

###View the source at GitHub Gist.

# Install from GitHub Gist


Change log:

Versn  Date        Change
-----  ----------  --------------------------------------------------------------------------
1.5    2019-08-28  Updated Metadata and Lint config for Tampermonkey changes and performance.
1.4    2019-08-28  SE renamed `short-link` to `js-share-link`.
1.3    2016-08-19  SE changed Timelines. Answers were separated out from the question timeline.
1.2    2015-07-22  Updated match list.
1.1    2014-02-07  Added revisions link. (On private copy, didn't update Gist until 2015.)
1.0    2013-06-11  Initial release to the public.
Brock Adams
  • 13k
  • 5
  • 39
  • 64