Sleazy Fork is available in English.

去掉烦人的“外链安全检查”

如题,点击即达

  1. // ==UserScript==
  2. // @name 去掉烦人的“外链安全检查”
  3. // @namespace http://tampermonkey.net/
  4. // @version 2
  5. // @description 如题,点击即达
  6. // @author raincore
  7. // @match https://www.vikacg.com/p/*
  8. // @grant none
  9. // @require https://update.greasyfork.org/scripts/441505/1028182/crypto-js411.js
  10. // @license MIT
  11. // ==/UserScript==
  12.  
  13. (function() {
  14. 'use strict';
  15. const DEBUG = false;
  16.  
  17. function ConsoleLog(e){
  18. if (!DEBUG){return;}
  19. console.log(e);
  20. }
  21. function DecryptUrl(e){
  22. const r = CryptoJS.enc.Base64.stringify(CryptoJS.enc.Hex.parse(e));
  23. const key = CryptoJS.enc.Utf8.parse("7R75R3JZE2PZUTHH");
  24. const iv = CryptoJS.enc.Utf8.parse("XWO76NCVZM2X1UCU");
  25. return CryptoJS.AES.decrypt(r, key, {
  26. iv,
  27. mode: CryptoJS.mode.CBC,
  28. padding: CryptoJS.pad.Pkcs7
  29. }).toString(CryptoJS.enc.Utf8);
  30. }
  31. function ReplaceHref(entryContent){
  32. if (entryContent === undefined){
  33. return 0;
  34. }
  35. const a_list = entryContent.getElementsByTagName('a');
  36. ConsoleLog(`found a_list:${a_list.length} in entry content`);
  37. let processCnt = 0;
  38. for (let a of a_list){
  39. if(a.href.indexOf('/external?e=') >= 0){
  40. processCnt++;
  41. ConsoleLog(`found external a:${a}`);
  42. const e = new URLSearchParams((new URL(a.href)).search).get('e')
  43. const url = DecryptUrl(e);
  44. ConsoleLog(`raw url:${url}`);
  45. //replace with new "a"
  46. const new_a = document.createElement("a");
  47. new_a.innerHTML = a.innerHTML;
  48. new_a.href = url;
  49. new_a.target="_blank";
  50. a.parentNode.replaceChild(new_a, a);
  51. }
  52. }
  53. return processCnt;
  54. }
  55. function sleep(time){
  56. return new Promise((resolve) => setTimeout(resolve, time));
  57. }
  58. async function main(){
  59. //wait for 'content-excerpt' to disappear
  60. let content_excerpts;
  61. while(true){
  62. content_excerpts = document.getElementsByClassName('content-excerpt');
  63. if (content_excerpts.length == 0) {
  64. break;
  65. }
  66. ConsoleLog("content_excerpts exists");
  67. await sleep(1);
  68. }
  69. ConsoleLog("content_excerpts not exists");
  70. // wait for 'entry-content' to appear
  71. let entry_contents;
  72. while(true){
  73. entry_contents = document.getElementsByClassName('entry-content');
  74. if (entry_contents.length > 0){
  75. break;
  76. }
  77. ConsoleLog("entry content not exist");
  78. await sleep(1);
  79. }
  80. ConsoleLog("entry content exist");
  81. while(true){
  82. let processCnt = ReplaceHref(entry_contents[0]);
  83. await sleep(1);
  84. ConsoleLog(`processCnt:${processCnt}`);
  85. }
  86. }
  87. main();
  88. })();