Decloak links and open directly

Open redirected/cloaked links directly

目前為 2017-05-28 提交的版本,檢視 最新版本

  1. // ==UserScript==
  2. // @name Decloak links and open directly
  3. // @description Open redirected/cloaked links directly
  4. // @version 1.1.4
  5. // @author wOxxOm
  6. // @namespace wOxxOm.scripts
  7. // @icon https://i.imgur.com/cfmXJHv.png
  8. // @license MIT License
  9. // @run-at document-start
  10. // @match *://*/*
  11. // ==/UserScript==
  12.  
  13. /* jshint lastsemic:true, multistr:true, laxbreak:true, -W030, -W041, -W084 */
  14.  
  15. window.addEventListener('mousedown', decloak, true);
  16. window.addEventListener('keydown', function(e) { if (e.keyCode == 13) decloak(e) }, true);
  17.  
  18. function decloak(e) {
  19. var a = e.target.closest('a');
  20. if (!a || !a.href.match(/^(http|ftp)/))
  21. return;
  22.  
  23. if (e.altKey)
  24. return console.debug('Decloak skipped: Alt key is pressed.');
  25.  
  26. if (location.hostname.indexOf('yandex.') >= 0) {
  27. a.onmousedown = null;
  28. a.onclick = null;
  29. }
  30.  
  31. var m = a.href.match(/=(\w+(?::\/\/|%3[Aa]%2[Ff]%2[Ff])[^+&?]+)/);
  32. if (!m) {
  33. return;
  34. }
  35.  
  36. var realUrl = decodeURIComponent(m[1]);
  37. if (new URL(realUrl).hostname == a.hostname || a.pathname.match(/[?&=\/]\w*(sign|log)[io]n/))
  38. return console.debug('Decloak skipped: assumed a login redirection.');
  39.  
  40. if (a.hostname == 'disq.us' && realUrl.lastIndexOf(':') != realUrl.indexOf(':'))
  41. realUrl = realUrl.substr(0, realUrl.lastIndexOf(':'));
  42. a.href = realUrl;
  43. }

QingJ © 2025

镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址