Last active
April 16, 2024 04:29
-
-
Save mzavoloka/fbcac7ad5825e2c1cca8da13f11bd886 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==UserScript== | |
// @name Smartlab direct external links | |
// @namespace Mikhail Zavoloka | |
// @version 1.0 | |
// @description Make smart-lab.ru links to lead directly to external website without warning | |
// @match https://smart-lab.ru/* | |
// @run-at document-end | |
// @grant none | |
// ==/UserScript== | |
var links = document.getElementsByTagName("a"); | |
for(var i=0, max=links.length; i<max; i++) { | |
if ( !links[i].href.match( /.+\/r.php\?u=/ ) ) { continue } | |
var param_u = links[i].href | |
.replace(/^.+\/r.php\?u=/g, '') // убрать всё до значения параметра 'u' | |
.replace(/&s=\d+$/g, ''); // убрать всё после значения параметра 'u' | |
links[i].href = decodeURIComponent( param_u ); // деэкранизация параметра 'u' | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment