🏠 Home 

Zimuku2pianyuan

增加片源网的搜索按钮,并直接显示字幕下载地址。


Install this script?
  1. // ==UserScript==
  2. // @name Zimuku2pianyuan
  3. // @namespace http://tampermonkey.net/
  4. // @version 1.0.5
  5. // @description 增加片源网的搜索按钮,并直接显示字幕下载地址。
  6. // @author Johnxon
  7. // @include *://zmk.pw/detail/*
  8. // @include *://zimuku.org/detail/*
  9. // @include *://zimuku.pw/detail/*
  10. // @include *://srtku.com/detail/*
  11. // @grant GM_addStyle
  12. // ==/UserScript==
  13. (function () {
  14. function addButton() {
  15. GM_addStyle("span.py{background:#20A4FF;padding:16px 20px !important;height:50px;font-size:18px;color:#fff !important}");
  16. let keywords = $("meta[name='keywords']").attr("content");
  17. let [title, en_title, ...rest] = keywords.split(',');
  18. let pianyuanBtn = `<a href="http://pianyuan.org/search?q=${encodeURIComponent(title)}" target="_blank"><span class="py">片源</span></a>`;
  19. let btnDownload = $('.dl').parent();
  20. btnDownload.after(pianyuanBtn);
  21. }
  22. async function fetchDLinks() {
  23. GM_addStyle(`
  24. .down{margin:20px 0;}
  25. .down ul {
  26. -webkit-column-count: 3;
  27. -moz-column-count: 3;
  28. column-count: 3;
  29. }
  30. .down li{padding:10px}
  31. `);
  32. let link = document.getElementById('down1');
  33. link.hostname = location.hostname;
  34. link.protocol = location.protocol;
  35. let html = await fetch(link.href)
  36. .then(response => response.text());
  37. let downLinks = $($.parseHTML(html)).find('.down');
  38. downLinks.find('a').removeClass('btn');
  39. downLinks.find(".btn-warning").parent().remove();
  40. downLinks.find(".btn-success").parent().remove();
  41. $('.subinfo').after(downLinks);
  42. }
  43. addButton();
  44. fetchDLinks();
  45. })();