Chrome bookmarklet to convert old api page links to api_current

I'm not sure if this is the appropriate place to put such a thing, but many of us paste links to docs and older Questions should perhaps be updated whenever it makes sense. This makes that slightly more convenient..

I use this a lot, maybe others will find some use for it

javascript:(function()%7Bvar current %3D window.location %2B ""%3Bvar newUrl %3D current.replace(%2Fpython_api_(.%2B)%5C%2F%2Fgi%2C 'python_api_current%2F')%3Bwindow.location%3DnewUrl%7D)()


the non mangled version:

javascript:(
function(){
var current = window.location + "";
var newUrl = current.replace(/python_api_(.+)\//gi, 'python_api_current/');
window.location = newUrl
})()


Installation

To install, go to Other Bookmarks > Add Page > URL and paste the single line javascript at the top, then pick a useful name for the bookmark.

• Maybe add a quick "install" line for some users. Useful, thanks. Sep 6 '16 at 17:06
• i might be overlooking something but it appears that bookmarklet link creation is prohibited on SE , which totally makes sense. Sep 6 '16 at 17:49