琉璃神社老司机

Don't panic.

  1. // ==UserScript==
  2. // @name 琉璃神社老司机
  3. // @namespace https://greasyfork.org/users/8650
  4. // @version 1.0.1
  5. // @description Don't panic.
  6. // @author 圆环之理
  7. // @match *://hacg.*/*
  8. // @match *://*.hacg.*/*
  9. // @match *://*.llss.*/*
  10. // @match *://*.llss.fun/*
  11. // @match *://*.liuli.*/*
  12. // @icon https://www.llss.me/favicon.ico
  13. // @run-at document-end
  14. // @grant none
  15. // @license MIT
  16. // ==/UserScript==
  17.  
  18.  
  19.  
  20. (function(){
  21. 'use strict';
  22.  
  23. // Force HTTPS
  24. if(self.location.protocol == "http:") self.location.replace(self.location.href.replace(/^http/, "https"));
  25.  
  26. let oldDriver = document.querySelector('.entry-content');
  27. let childDriver = oldDriver.childNodes;
  28. let takeMe;
  29. let fuel;
  30. let i;
  31. let j;
  32. for(i = childDriver.length - 1; i >= 0; --i) {
  33. if(takeMe = childDriver[i].textContent.match(/([a-z0-9]{40})|(\w{32})|(([a-z0-9]{8,39})( ?)[\u4e00-\u9fa5 ]{2,}( ?)+([a-z0-9]{2,31})\b)/ig)){
  34. for(j = 0;j < takeMe.length; ++j) {
  35. fuel = '<a href="magnet:?xt=urn:btih:' +
  36. ( takeMe[j].length >= 40 ? takeMe[j].toString().replace(/(\s|[\u4e00-\u9fa5])+/g, '').trim() : takeMe[j] ) +
  37. '">老司机链接</a>';
  38. // console.log(takeMe[j], '<a href="magnet:?xt=urn:btih:' + fuel);
  39. childDriver[i].innerHTML = childDriver[i].innerHTML.toString().replace(takeMe[j], fuel);
  40. }}
  41. }})();