Url Redir by Userscript

Posted on Sun 24 February 2019 in coding

One day ...

When clicking on links within Evernote, there's a redir page for outbound confirmation, which is kinda nuisance.

The countermeasure

Use a userscript to skip the redir page:

// ==UserScript==
// @name         skip Evernote outbound redir
// @namespace    no
// @version      0.1
// @description  auto-skip the redir page when clicking a link in Evernote
// @author       nobody
// @match        https://www.evernote.com/OutboundRedirect.action?dest=*
// @grant        none
// @run-at       document-start
// ==/UserScript==

window.location = decodeURIComponent(window.location.href.replace(
    'https://www.evernote.com/OutboundRedirect.action?dest=', ''));

Install it in a userscript engine (Tamermonkey, Violentmonkey, Greasemonkey).

Sidenote

The real url, at the end of Evernote's redir url, is percent-encoded.
In js, the decoding function is decodeURIComponent.
In Python3, btw, it's:

from urllib import parse
parse.unquote('https%3A%2F%2Flala.im%2F2960.html')

and of course, there's the inverse function, to encode/quote urls.

Another url redir example

Play youtube videos without Google's trackers.

// ==UserScript==
// @name        YouTube No Tracker
// @namespace   no
// @description play youtube videos without trackers
// @match       https://www.youtube.com/watch?v=*
// @version     0.1
// @grant       none
// @run-at document-start
// ==/UserScript==
var vid = /watch\?v=(\w+)/.exec(window.location.href)[1];
window.location = 'https://cadence.gq/cloudtube/video/' + vid;

Similar browser plugins

js