antizapret.info links

Adds hyperlinks to the blocked pages for your very important browsing purposes

Stan na 16-04-2018. Zobacz najnowsza wersja.

Aby zainstalować ten skrypt, wymagana jest instalacje jednego z następujących rozszerzeń: Tampermonkey, Greasemonkey lub Violentmonkey.

Aby zainstalować ten skrypt, wymagana jest instalacje jednego z następujących rozszerzeń: Tampermonkey, Violentmonkey.

Aby zainstalować ten skrypt, wymagana jest instalacje jednego z następujących rozszerzeń: Tampermonkey, Violentmonkey.

Aby zainstalować ten skrypt, wymagana będzie instalacja rozszerzenia Tampermonkey lub Userscripts.

You will need to install an extension such as Tampermonkey to install this script.

Aby zainstalować ten skrypt, musisz zainstalować rozszerzenie menedżera skryptów użytkownika.

(Mam już menedżera skryptów użytkownika, pozwól mi to zainstalować!)

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

Będziesz musiał zainstalować rozszerzenie menedżera stylów użytkownika, aby zainstalować ten styl.

Będziesz musiał zainstalować rozszerzenie menedżera stylów użytkownika, aby zainstalować ten styl.

Musisz zainstalować rozszerzenie menedżera stylów użytkownika, aby zainstalować ten styl.

(Mam już menedżera stylów użytkownika, pozwól mi to zainstalować!)

// ==UserScript==
// @name         antizapret.info links
// @namespace    http://tampermonkey.net/
// @version      0.12
// @description  Adds hyperlinks to the blocked pages for your very important browsing purposes
// @author       紫
// @match        https://antizapret.info/
// @match        https://antizapret.info/?*
// @match        https://antizapret.info/org.php*
// @match        https://antizapret.info/minjust.php*
// @grant        GM_xmlhttpRequest
// ==/UserScript==

(function() {
    'use strict';

    // function section

    const replaceWildcard = s => /\*\..+/.exec(s) ? s.replace(/\*\.(.+)/, "$1") : s;
    const replaceNoDomain = (url, ip) => url == "ip only" ? ip : url;

    const extSiteLink = (link_url, link_ip) => {
        let link_node, img_node;

        img_node = document.createElement('img');
        img_node.src = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAoAAAAKCAYAAACNMs+9AAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAFZJREFUeF59z4EJADEIQ1F36k7u5E7ZKXeUQPACJ3wK7UNokVxVk9kHnQH7bY9hbDyDhNXgjpRLqFlo4M2GgfyJHhjq8V4agfrgPQX3JtJQGbofmCHgA/nAKks+JAjFAAAAAElFTkSuQmCC';
        link_node = document.createElement('a');
        link_node.style.marginRight = '5px';
        link_node.href = 'http://';

        if (link_url.length >= 50)
            new GM_xmlhttpRequest({
                method: 'GET',
                url: 'http://api.' + window.location.host + '/get.php?type=json&item=' + link_url,
                onload: response => {
                    link_node.href = JSON.parse(response.responseText).register[0].url;
                }
            });
        else
            link_node.href = 'http://' + replaceWildcard(replaceNoDomain(link_url, link_ip));

        link_node.target = '_blank';
        link_node.appendChild(img_node);

        return link_node;
    };

    // executed code section

    let trs = document.getElementsByTagName('tbody')[0].getElementsByTagName('tr');

    for (let i = 0, len = trs.length; i < len; i++) {
        let linkTd = trs[i].getElementsByTagName('td')[1];
        let linkField = linkTd.getElementsByTagName('a')[0];

        let ipTd = trs[i].getElementsByTagName('td')[2];
        let ipField = ipTd.getElementsByTagName('a')[0];

        linkTd.insertBefore(extSiteLink(linkField.text, ipField.text), linkField);
    }
})();