-
Notifications
You must be signed in to change notification settings - Fork 0
/
reestr.rublacklist.net_URL_decoder.user.js
32 lines (28 loc) · 1.27 KB
/
reestr.rublacklist.net_URL_decoder.user.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
// ==UserScript==
// @name reestr.rublacklist.net URL decoder
// @name:ru Киллические адреса страниц для списка reestr.rublacklist.net
// @description
// @description:ru
// @namespace github.com/totalamd
// @match *://*.rublacklist.net/*
// @exclude
// @version 1.0.0.1
// @downloadURL https://github.com/totalamd/GM-scripts/raw/master/reestr.rublacklist.net_URL_decoder.user.js
// @updateURL https://github.com/totalamd/GM-scripts/raw/master/reestr.rublacklist.net_URL_decoder.user.js
// @grant none
// @noframes
// ==/UserScript==
// TODO:
// - [ ] deal with win-1251 encoding for anchor part of the links (after #)
"use strict";
const l = function(){}, i = function(){};
(function(){
const l = console.log.bind(console, `${GM_info.script.name} debug:`), i = console.info.bind(console, `${GM_info.script.name} debug:`);
const linksList = Array.from(document.querySelectorAll('a[href^="/rec/"]'));
linksList.forEach(function(link){
if (link.text.match(/^http/)) {
link.text = decodeURIComponent(link.text.replace(/(.*)(#.*)/, function(match, p1, p2){p2=p2||""; return p1 + p2.replace(/\./g, '%');}));
link.href = link.text;
}
});
}())