Redirect remover

Tính năng: xoá redirect link

  1. // ==UserScript==
  2. // @name Redirect remover
  3. // @version 2018.06.29.01
  4. // @description Tính năng: xoá redirect link
  5. // @namespace idmresettrial
  6. // @author idmresettrial
  7. // @run-at document-start
  8. // @require http://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js
  9. // @grant GM_addStyle
  10. // @grant GM_xmlhttpRequest
  11. // @icon http://i.imgur.com/cnWhhD8.png
  12. // Website list
  13. // @include *
  14. // End list
  15. // ==/UserScript==
  16. var site = window.location.hostname;
  17. site = site.replace(/[^.]+\.deviantart\.com/i, 'www.deviantart.com');
  18. if (window.top !== window.self && site !== 'www.google.com') {
  19. return;
  20. }
  21. this.$ = this.jQuery = jQuery.noConflict(true);
  22. document.addEventListener('DOMContentLoaded', function () {
  23. var link, i, url;
  24. switch (site)
  25. {
  26. case 'forums.voz.vn':
  27. case 'sinhvienit.net':
  28. case 'phienbanmoi.com':
  29. case 'forum.vietdesigner.net':
  30. case 'www.webtretho.com':
  31. case 'chiaseit.vn':
  32. case 'www.hdvietnam.com':
  33. case 'www.deviantart.com':
  34. {
  35. $('a').each(function () {
  36. url = unescape($(this).attr('href'));
  37. if (site === 'forum.vietdesigner.net' || site === 'chiaseit.vn') url = unescape(url);
  38. redirect = /[?=]http/i;
  39. if (redirect.test(url)) {
  40. $(this).attr('href', url.replace(/^.+[?=]http/i, 'http'));
  41. }
  42. });
  43. var particular = {
  44. 'vozforums.com': function () {
  45. var errPage = [
  46. 'vozForums Database Error',
  47. '502 Bad Gateway',
  48. '500 Internal Server Error'
  49. ];
  50. if (errPage.indexOf(document.title) > - 1) {
  51. document.title = 'Connecting... - By Redirect Remover';
  52. setTimeout(function () {
  53. location.reload();
  54. }, 2000);
  55. }
  56. },
  57. 'sinhvienit.net': function () {
  58. if ($('form[name=vtlai_firewall]').length) {
  59. $('#btnSubmit1').click();
  60. }
  61. }
  62. };
  63. if (Object.keys(particular).indexOf(site) > - 1) particular[site]();
  64. break;
  65. }
  66. case 'adf.ly':
  67. case 'q.gs':
  68. case 'chathu.apkmania.co':
  69. {
  70. url = '';
  71. speedUp();
  72. t = setInterval(function () {
  73. url = $('#skip_button').attr('href') || '';
  74. if (url.length) {
  75. clearInterval(t);
  76. window.onbeforeunload = null;
  77. window.onunload = null;
  78. gogogo(url);
  79. }
  80. }, 1000);
  81. break;
  82. }
  83. case 'linkshrink.net':
  84. {
  85. url = $('#skip a.bt').attr('href');
  86. if (url.length) gogogo(url);
  87. break;
  88. }
  89. case 'www.oni.vn':
  90. {
  91. domain = window.location.protocol + '//' + window.location.host + '/';
  92. $.ajax({
  93. type: 'GET',
  94. url: domain + 'click.html',
  95. data: $('html').html().match(/code=([^"]+)/i) [0],
  96. contentType: 'application/json; charset=utf-8',
  97. success: function (html) {
  98. url = html;
  99. gogogo(url);
  100. }
  101. });
  102. break;
  103. }
  104. case 'ouo.io':
  105. case 'ouo.press':
  106. {
  107. url = $('a#btn-main').attr('href');
  108. gogogo(url);
  109. break;
  110. }
  111. /*case 'www.google.com':
  112. {
  113. if (!(/(9gag\.com|vechai\.info)/gi).test(document.referrer)) {
  114. setTimeout(function () {
  115. bVerify = $('div.recaptcha-checkbox-checkmark');
  116. if (bVerify.length) bVerify.click();
  117. }, 1000);
  118. }
  119. break;
  120. }*/
  121. case 'acer-a500.ru':
  122. case 'vegaviet.com':
  123. {
  124. $('a').each(function () {
  125. url = unescape($(this).attr('href'));
  126. redirect = {
  127. 'acer-a500.ru': 'http://acer-a500.ru/engine/redir/index/leech_out.php?a:',
  128. 'vegaviet.com': 'http://vegaviet.com/redirect/?to='
  129. };
  130. if (url.indexOf(redirect[site]) === 0) {
  131. $(this).attr('href', window.atob(url.substring(redirect[site].length, url.length)));
  132. }
  133. });
  134. break;
  135. }
  136. case 'www.facebook.com':
  137. {
  138. $('body').on('mouseenter', 'a[onmouseover^="LinkshimAsyncLink.swap"]', function () {
  139. $(this) [0].removeAttribute('onclick');
  140. $(this) [0].removeAttribute('onmouseover');
  141. $(this) [0].outerHTML += '';
  142. });
  143. $('body').on('mouseenter', 'a[href^="https://l.facebook.com/l.php?u="]', function () {
  144. $(this) [0].href = unescape( $(this) [0].href.match(/\?u=(.*)&h=/) [1] );
  145. });
  146. break;
  147. }
  148. case 'muare.vn':
  149. {
  150. $('a.ProxyLink').removeClass('ProxyLink');
  151. break;
  152. }
  153. case 'www.vn-zoom.com':
  154. {
  155. $('a[href^="http://www.mediafire.com/"]').click(function (e) {
  156. e.preventDefault();
  157. $('body').append('<iframe style="visibility:hidden" id="rr-mf" src="about:blank"></iframe>').find('iframe#rr-mf').contents().find('body').append('<a onclick="window.open(this.href);return false;" target="_blank"></a>').find('a').attr('href', $(this).attr('href')) [0].click();
  158. $('iframe#rr-mf').remove();
  159. });
  160. $('img[src*="i.imgur.com/"]').each(function () {
  161. $(this).attr('src', $(this).attr('src').replace('http://i.imgur.com/', 'http://kageurufu.net/imgur/?'));
  162. });
  163. break;
  164. }
  165. case 'linksvip.net':
  166. {
  167. if (window.location.href.indexOf('linksvip.net/dl') > - 1) {
  168. setTimeout(function () {
  169. url = $('a.linkvip').attr('href');
  170. if (url.length && url.indexOf('linksvip.net') > - 1) {
  171. gogogo(url);
  172. }
  173. }, 1000);
  174. }
  175. if (window.location.href.indexOf('linksvip.net/get-link') > - 1) {
  176. url = $('#skip a.bt').attr('href');
  177. if (url.length) {
  178. gogogo(url);
  179. }
  180. }
  181. if (window.location.href.indexOf('&ref=idmresettrial') > - 1) {
  182. /*var alert = (function alert() {
  183. window.location.href = $('#a_down').attr('href');
  184. }).toString();
  185. var script = document.createElement('script');
  186. script.innerHTML = alert;
  187. document.head.appendChild(script);
  188. */
  189. i = setInterval(function() {
  190. var a_down = $('#a_down').attr('href');
  191. if (a_down.length) {
  192. clearInterval(i);
  193. gogogo(a_down);
  194. }
  195. }, 1000);
  196. }
  197. break;
  198. }
  199. case 'www.linkvip.info':
  200. {
  201. if (window.location.href.indexOf('&ref=idmresettrial') > - 1) {
  202. link = window.location.href.match(/link=(.*?)&ref/)[1];
  203. i = setInterval(function() {
  204. url = $("input[name=url");
  205. if (url.length) {
  206. clearInterval(i);
  207. $('input[name="url"]').val(link);
  208. $('button[type=submit]')[0].click();
  209. setTimeout(function() {
  210. if (link.indexOf("4share") > -1) {
  211. GM_xmlhttpRequest({
  212. method: "GET",
  213. url: $('a[href*="4share"]').attr("href"),
  214. onload: function(data) {
  215. window.location.href = $(data.responseText).find("direct_link").text();
  216. }
  217. });
  218. } else if (link.indexOf("fshare") > -1) {
  219. var directLink = $('div.ui.message a[href*="fshare"]');
  220. if (directLink.length) console.log(directLink.attr("href"));
  221. }
  222. }, 1000);
  223. }
  224. }, 1000);
  225. }
  226. break;
  227. }
  228. case 'getlinkfshare.com':
  229. {
  230. if (window.location.href.indexOf('&ref=idmresettrial') > - 1) {
  231. link = window.location.href.match(/link=(.*?)&ref/)[1];
  232. $("#linkget").val(link);
  233. $("#getlink").click();
  234. }
  235. break;
  236. }
  237. case '4share.vn':
  238. {
  239. if (window.location.href.indexOf("4share.vn/d/") > -1) {
  240. $('a[href^="/f/"]').each(function() {
  241. $(this).attr("href", "http://www.4share.vn" + $(this).attr("href"));
  242. });
  243. }
  244. break;
  245. }
  246. case 'srnk.co':
  247. {
  248. if (window.location.href.indexOf('srnk.co/i') > - 1) {
  249. speedUp();
  250. setTimeout(function () {
  251. $('#btn-with-link').click();
  252. }, 10000);
  253. }
  254. break;
  255. }
  256. case 'www.teamos-hkrg.com':
  257. case 'teamos-hkrg.com':
  258. {
  259. $('a.externalLink').each(function() {
  260. $(this).attr("href", unescape($(this).attr("data-proxy-href").match(/link=(.*)&hash/)[1]));
  261. });
  262. break;
  263. }
  264. default:
  265. {
  266. /*
  267. //if ($('body').text().match(/\b(london|hotel|deal)s?\b/gi).length > 5) {
  268. selector = {
  269. 'baomoitoday.com': 'div[align="center"][style="padding:5px"] a',
  270. 'travelworld24h.com': 'div.cms-content a',
  271. 'kenhphunu180.com': 'center a, div#news_main a, strong a, div.main_content a'
  272. };
  273. //if (typeof selector[site] === 'undefined') site = 'default';
  274. url = $(selector[site]).attr('href');
  275. gogogo(url);
  276. //}
  277. */
  278. break;
  279. }
  280. }
  281.  
  282. // fshare link
  283.  
  284. $('a[href^="https://www.fshare.vn/file"], a[href^="http://www.fshare.vn/file"]').each(function () {
  285. var style = "display:inline-block; margin:0px 5px; padding:0px 5px; background:#fff; border:1px solid #cdcdcd; border-radius:3px; color:#7e7e7e; font-size:10px; line-height:15px; height:18px;";
  286. GM_addStyle("#dlfolder .filelist .file_name, #dlfolder .filelist_header .file_name {width: 580px} #download_folder {width: 890px;} .container {width: 1190px;} #dlfolder #dlnav.affix {width: 850px;}");
  287. $('<a style="' + style + '" target="_blank" href="http://linksvip.net/?link=' + $(this).attr('href') + '&ref=idmresettrial">Get vip link 1</a>' +
  288. '<a style="' + style + '" target="_blank" href="https://getlinkfshare.com/?link=' + $(this).attr('href') + '&ref=idmresettrial">Get vip link 2</a>').insertAfter($(this));
  289. });
  290.  
  291. // 4share link
  292.  
  293. $('a[href^="https://www.4share.vn/f/"], a[href^="http://www.4share.vn/f/"], a[href^="http://4share.vn/f/"]').each(function () {
  294. var style = "display:inline-block; margin:0px 5px; padding:0px 5px; background:#fff; border:1px solid #cdcdcd; border-radius:3px; color:#7e7e7e; font-size:10px; line-height:15px; height:18px;";
  295. $('<a style="' + style + '" target="_blank" href="http://www.linkvip.info/?link=' + $(this).attr('href') + '&ref=idmresettrial">Get vip link 1</a>' +
  296. '').insertAfter($(this));
  297. });
  298.  
  299. });
  300. function gogogo(url) {
  301. if (typeof url !== 'undefined') {
  302. if (url.length === 0) return;
  303. page = '' +
  304. '<html><head><title>Đang chuyển hướng...</title>' +
  305. '<style type="text/css">' +
  306. '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}}' +
  307. '</style>' +
  308. '</head><body>' +
  309. '<div style="background-image:url(http://i.imgur.com/qflyJA3.gif?r=' + (new Date().getTime()) + ')"></div>' + // Redirect removed count
  310. '<div id="rr"><b>Đang chuyển hướng đến <a href="' + url + '">trang gốc</a></b><span class="ellipsis">...</span></div>' +
  311. '</body></html>';
  312. $('html').html(page);
  313. $(window).unload(function () {
  314. $('title').html(url);
  315. $('body').html('');
  316. });
  317. window.location.replace(url);
  318. }
  319. }
  320. function speedUp() {
  321. var tmp = (function () {
  322. var oSetInterval = setInterval;
  323. setInterval = function (fn, delay) {
  324. oSetInterval(fn, 10);
  325. };
  326. }).toString();
  327. $('head').append('<script>(' + tmp + ')()</script>');
  328. }