Redirect remover

Bypass redirected links.

Verze ze dne 15. 03. 2015. Zobrazit nejnovější verzi.

// ==UserScript==
// @name         Redirect remover
// @version      1.2
// @description  Bypass redirected links.
// @namespace    idmresettrial
// @author       idmresettrial
// @run-at       document-end
// @require      http://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js
// @grant        none

// Website list

// @match        *://*.vozforums.com/*
// @match        *://*.sinhvienit.net/*
// @match        *://*.adf.ly/*
// @match        *://*.phienbanmoi.com/*
// @match        *://*.acer-a500.ru/*
// @match        *://*.duhoclondon.com/*
// @match        *://*.baomoitoday.com/*
// @match        *://*.baomoinhanhnhat.com/*


// End list


// ==/UserScript==

this.$ = this.jQuery = jQuery.noConflict(true);

// Do not run on frames or iframes
if (window.top !== window.self) {
    return;
}

site = window.location.hostname;

switch (site)
{
    case "vozforums.com":
    case "sinhvienit.net":
    case "phienbanmoi.com":
        {
            atag = document.getElementsByTagName("a");

            for (i=0;i<atag.length;i++)
            {
                url = unescape(atag[i].href);
                redirect = /[?=]http/i;
                if (redirect.test(url)) {
                    atag[i].href = url.replace(/http\S+[?=]http/i,"http");
                }
            }
            break;
        }
    case "adf.ly":
        {

            url = decode_adly();
            if (url.length>0)
            {
                window.onbeforeunload = null;
                window.onunload = null;
                gogogo(url);
            }
            break;
        }
    case "acer-a500.ru":
        {
            atag = document.getElementsByTagName("a");

            for (i=0;i<atag.length;i++)
            {
                url = unescape(atag[i].href);
                redirect = "http://acer-a500.ru/engine/redir/index/leech_out.php?a:";
                if (url.indexOf(redirect) === 0) {
                    atag[i].href = window.atob(url.substring(redirect.length,url.length));
                }
            }
            break;
        }

    case "baomoitoday.com":
    case "baomoinhanhnhat.com":
    case "duhoclondon.com":
        {
            a = {"baomoitoday.com":"div[id='news_main'] a","baomoinhanhnhat.com":"div[class='l-container'] a","duhoclondon.com":"div.maincontent a"};
            url = $(a[site]).attr('href');
            if (typeof(url) !== 'undefined') gogogo(url);
            break;
        }


}

function decode_adly()
{
    url="";
    if (window.ysmm)
    {
        ysmm = window.ysmm;
        url0 = ""; url1 = "";
        for (i=0;i<ysmm.length;i++)
        {
            if (i%2===0)
            {
                url0 +=ysmm.charAt(i);
                url1 +=ysmm.charAt(ysmm.length-1-i);
            }
        }
        url = window.atob(url0 + url1);
        url = url.substring(2,url.length);
    }
    return url;
}

function gogogo(url) {
    $('body').html('<h1>Đang chuyển hướng đến trang gốc...</h1>');
    window.location.replace(url);
}