360搜索真实链接地址重定向

搜索结果链接修正,直接跳转至目标网址,而不经过中间的二次跳转页面

目前为 2016-06-10 提交的版本。查看 最新版本

  1. // ==UserScript==
  2. // @name Link Redirect Fix for 360so
  3. // @name:zh-CN 360搜索真实链接地址重定向
  4. // @name:zh-TW 360搜索真實鏈接地址重定向
  5. // @description Avoid link redirect for 360 search
  6. // @description:zh-CN 搜索结果链接修正,直接跳转至目标网址,而不经过中间的二次跳转页面
  7. // @description:zh-TW 搜索結果鏈接修正,直接跳轉至目標網址,而不經過中間的二次跳轉頁面
  8. // @author Moshel
  9. // @namespace http://hzy.pw
  10. // @homepageURL http://hzy.pw/p/2056
  11. // @license GPL-3.0
  12. // @supportURL https://github.com/h2y/link-fix
  13. // @icon https://p.ssl.qhimg.com/t011a6c04685b5d3b80.png
  14.  
  15. // @include https://www.so.com/s?*
  16. // @grant none
  17. // @run-at document_end
  18.  
  19. // @date 06/09/2016
  20. // @modified 06/10/2016
  21. // @version 1.0.0.0
  22. // ==/UserScript==
  23.  
  24.  
  25. !function() {
  26.  
  27. var dom = null;
  28. function ajax_fixer() {
  29. var new_dom = document.querySelector('#m-result');
  30. if (new_dom && new_dom !== dom) {
  31. dom = new_dom;
  32. main();
  33. }
  34. setTimeout(ajax_fixer, 2222);
  35. }
  36. ajax_fixer();
  37.  
  38.  
  39. function main() {
  40. var num = 0,
  41. as = dom.querySelectorAll('a');
  42. for(var i=0; i<as.length; i++) {
  43. var old = as[i].href.match(/url=(.*?)(&|$)/);
  44. if(old && old.length>=2) {
  45. as[i].href = decodeURIComponent(old[1]);
  46. num++;
  47. }
  48. }
  49. if(num)
  50. console.log(num+' 条链接已重定向至真实地址');
  51. }
  52.  
  53. }();