Redirect remover

Tính năng: xoá redirect link

Pada tanggal 13 Oktober 2015. Lihat %(latest_version_link).

// ==UserScript==
// @name         Redirect remover
// @version      1.7.7
// @description  Tính năng: xoá redirect link
// @namespace    idmresettrial
// @author       idmresettrial
// @run-at       document-end
// @require      http://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js
// @grant        GM_addStyle
// @icon         http://i.imgur.com/cnWhhD8.png
// Website list
// @include       *
// End list
// ==/UserScript==
site = window.location.hostname;
if (window.top !== window.self && site !== 'www.google.com') {
  return;
}
this.$ = this.jQuery = jQuery.noConflict(true);
document.addEventListener('DOMContentLoaded', function () {
  switch (site)
    {
    case 'vozforums.com':
    case 'sinhvienit.net':
    case 'phienbanmoi.com':
    case 'forum.vietdesigner.net':
    case 'www.webtretho.com':
    case 'chiaseit.vn':
    case 'www.hdvietnam.com':
      {
        $('a').each(function () {
          url = unescape($(this).attr('href'));
          if (site === 'forum.vietdesigner.net' || site === 'chiaseit.vn') url = unescape(url);
          redirect = /[?=]http/i;
          if (redirect.test(url)) {
            $(this).attr('href', url.replace(/^.+[?=]http/i, 'http'));
          }
        });
        errPage = [
          'Database Error',
          '502 Bad Gateway',
          '500 Internal Server Error'
        ]
        if (errPage.indexOf(document.title) > - 1) {
          document.title = 'Connecting... - By Redirect Remover';
          setTimeout(function () {
            location.reload();
          }, 2000);
        }
        break;
      }
    case 'adf.ly':
    case 'q.gs':
    case 'chathu.apkmania.co':
      {
        var url = '';
        speedUp();
        t = setInterval(function () {
          url = $('#skip_button').attr('href') || '';
          if (url.length) {
            clearInterval(t);
            window.onbeforeunload = null;
            window.onunload = null;
            gogogo(url);
          }
        }, 1000);
        break;
      }
    case 'www.oni.vn':
      {
        domain = window.location.protocol + '//' + window.location.host + '/';
        $.ajax({
          type: 'GET',
          url: domain + 'click.html',
          data: $('html').html().match(/code=([^"]+)/i) [0],
          contentType: 'application/json; charset=utf-8',
          success: function (html) {
            url = html;
            gogogo(url);
          }
        });
        break;
      }
    case 'ouo.io':
      {
        url = $('a#btn-main').attr('href');
        gogogo(url);
        break;
      }
    case 'www.google.com':
      {
        if (!(/(9gag\.com|vechai\.info)/gi).test(document.referrer)) {
          setTimeout(function () {
            bVerify = $('div.recaptcha-checkbox-checkmark');
            if (bVerify.length) bVerify.click();
          }, 1000);
        }
        break;
      }
    case 'acer-a500.ru':
    case 'vegaviet.com':
      {
        $('a').each(function () {
          url = unescape($(this).attr('href'));
          redirect = {
            'acer-a500.ru': 'http://acer-a500.ru/engine/redir/index/leech_out.php?a:',
            'vegaviet.com': 'http://vegaviet.com/redirect/?to='
          };
          if (url.indexOf(redirect[site]) === 0) {
            $(this).attr('href', window.atob(url.substring(redirect[site].length, url.length)));
          }
        });
        break;
      }
    case 'www.fshare.vn':
      {
        if ($('.file-info').length) {
          csrf = $('input[name="fs_csrf"]');
          if (csrf.length) {
            csrf = csrf.attr('value');
            data = {
              ajax: 'download-form',
              'DownloadForm[pwd]': '',
              fs_csrf: csrf
            };
            t = setInterval(function () {
              $.post('/download/get', data, function (data) {
                if (typeof data.url !== 'undefined') {
                  clearInterval(t);
                  insert = $('#download-form').parent();
                  $('<div class="col-xs-4" id="rrdownload"><a data-toggle="modal" href="#" class="btn btn-success btn-lg btn-block clearfix"><i class="fa fa-cloud-download fa-2x animated pulse infinite pull-left"></i><span class="pull-right text-right">Tải miễn phí<br><small>(redirect remover)</small></span></a></div>').insertBefore(insert);
                  $('#rrdownload').click(function () {
                    window.location.replace(data.url);
                  });
                }
              });
            }, 1000);
          }
        }
        break;
      }
    case 'www.facebook.com':
      {
        $('body').on('mouseenter', 'a[onclick^="LinkshimAsyncLink.swap"]', function () {
          $(this) [0].removeAttribute('onclick');
          $(this) [0].removeAttribute('onmouseover');
          $(this) [0].outerHTML += '';
        });
        break;
      }
    case 'muare.vn':
      {
        $('a.ProxyLink').removeClass('ProxyLink');
        break;
      }
    case 'www.vn-zoom.com':
      {
        $('a[href^="http://www.mediafire.com/"]').click(function (e) {
          e.preventDefault();
          $('body').append('<iframe style="visibility:hidden" id="rr" src="about:blank"></iframe>').find('iframe#rr').contents().find('body').append('<a onclick="window.open(this.href);return false;" target="_blank"></a>').find('a').attr('href', $(this).attr('href')) [0].click();
          $('iframe#rr').remove();
        });
        break;
      }
    case 'mp3.zing.vn':
      {
        var bt320 = $('a.button.fn-320');
        if (bt320.length) {
          var song = new function () {
            this.id = window.location.href.match(/http:\/\/mp3\.zing\.vn\/bai-hat\/[^\/]+\/([^.]+)/) [1],
            this.link320 = 'http://v3.mp3.zing.vn/download/vip/song/' + this.id
          };
          setTimeout(function () {
            bt320[0].outerHTML += '';
            bt320 = $('a.button.fn-320');
            bt320.attr('href', song.link320);
            bt320.next().find('a.fn-viprequire').html('miễn phí');
          }, 2000);
        }
        break;
      }
    default:
      {
        //if ($('body').text().match(/\b(london|hotel|deal)s?\b/gi).length > 5) {
        selector = {
          'baomoitoday.com': 'div[align="center"][style="padding:5px"] a',
          'travelworld24h.com': 'div.cms-content a',
          'kenhphunu180.com': 'center a, div#news_main a, strong a, div.main_content a'
        };
        //if (typeof selector[site] === 'undefined') site = 'default';
        url = $(selector[site]).attr('href');
        gogogo(url);
        //}
        break;
      }
  }
});
function gogogo(url) {
  if (typeof url !== 'undefined') {
    page = '' +
    '<html><head><title>Đang chuyển hướng...</title>' +
    '<style type="text/css">' +
    'div#rr{margin:10px;}a{text-decoration:none;color:#000}.ellipsis{overflow:hidden;display:inline-block;vertical-align:bottom;-webkit-animation:ellipsis 1s infinite;-moz-animation:ellipsis 1s infinite}@-webkit-keyframes ellipsis{from{width:2px}to{width:12px}}@-moz-keyframes ellipsis{from{width:2px}to{width:12px}}' +
    '</style>' +
    '</head><body>' +
    '<div style="background-image:url(http://i.imgur.com/qflyJA3.gif?r=' + (new Date().getTime()) + ')"></div>' + // Redirect removed count
    '<div id="rr"><b>Đang chuyển hướng đến <a href="' + url + '">trang gốc</a></b><span class="ellipsis">...</span></div>' +
    '</body></html>';
    $('html').html(page);
    $(window).unload(function () {
      $('title').html(url);
      $('body').html('');
    });
    window.location.replace(url);
  }
}
function speedUp() {
  var tmp = (function () {
    oSetInterval = setInterval;
    setInterval = function (fn, delay) {
      oSetInterval(fn, 10);
    };
  }).toString();
  $('head').append('<script>(' + tmp + ')()</script>');
}