Where is magnet!

你看,下多了视力模糊了吧?

目前为 2020-06-22 提交的版本。查看 最新版本

  1. // ==UserScript==
  2. // @name Where is magnet!
  3. // @license GPL version 3
  4. // @encoding utf-8
  5. // @namespace http://tampermonkey.net/
  6. // @version 0.2
  7. // @description 你看,下多了视力模糊了吧?
  8. // @date 2020/06/22
  9. // @modified 2020/06/22
  10. // @author TautCony
  11. // @match https://www.liuli.se/*
  12. // @grant none
  13. // ==/UserScript==
  14.  
  15. (function() {
  16. 'use strict';
  17. if (typeof jQuery === 'undefined') {
  18. return;
  19. }
  20. var container = jQuery('.entry-content');
  21. if (container.length === 0) {
  22. return;
  23. }
  24. var rawHtml = container.html();
  25.  
  26. container.html(rawHtml.replace(/([a-fA-F0-9]{40})/g, function (a, b) {
  27. var url = `magnet:?xt=urn:btih${b}`;
  28. return `<br><a style="color: #ff0070;font-weight: bold;font-size: 120%" href="${url}">${b}</a><br>`;
  29. }));
  30. })();