javdb优化

javdb优化方便跳转不同网站

  1. // ==UserScript==
  2. // @name javdb优化
  3. // @namespace http://tampermonkey.net/
  4. // @version 1.0
  5. // @description javdb优化方便跳转不同网站
  6. // @author gl
  7. // @match https://javdb.com/*
  8. // @icon data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==
  9. // @license MIT
  10. // @grant GM_addStyle
  11. // @grant GM_xmlhttpRequest
  12. // ==/UserScript==
  13.  
  14. (function () {
  15. "use strict";
  16. const javlibrary = "https://www.javlibrary.com/cn/vl_searchbyid.php?keyword=";
  17. const wuq = "https://wuqianyu.top/search?keyword=";
  18. const jable = "https://jable.tv/search/";
  19. const missav = "https://missav.com/cn/search/";
  20. const websites = [
  21. {
  22. name: "javlibrary",
  23. link: javlibrary,
  24. class: "is-link",
  25. },
  26. {
  27. name: "吴签",
  28. link: wuq,
  29. class: "is-info",
  30. },
  31.  
  32. {
  33. name: "jable",
  34. link: jable,
  35. class: "is-success",
  36. },
  37. {
  38. name: "missav",
  39. link: missav,
  40. class: "is-danger",
  41. },
  42. ];
  43.  
  44. let css = `
  45. .jav-container{
  46. max-width: 100% !important;
  47. }
  48. .jav-small{
  49. font-size: .7rem !important;
  50. color: #fff !important;
  51. }
  52. `;
  53. // workaround for various GreaseMonkey engines
  54. if (typeof GM_addStyle != "undefined") {
  55. GM_addStyle(css);
  56. } else if (typeof PRO_addStyle != "undefined") {
  57. PRO_addStyle(css);
  58. } else if (typeof addStyle != "undefined") {
  59. addStyle(css);
  60. } else {
  61. var node = document.createElement("style");
  62. node.type = "text/css";
  63. node.appendChild(document.createTextNode(css));
  64. var heads = document.getElementsByTagName("head");
  65. if (heads.length > 0) {
  66. heads[0].appendChild(node);
  67. } else {
  68. // no head yet, stick it whereever
  69. document.documentElement.appendChild(node);
  70. }
  71. }
  72. // 100% 宽度
  73. const container = document.querySelector(".section .container");
  74. container.classList.add("jav-container");
  75.  
  76. const movieListItem = document.querySelectorAll("div.movie-list div.item a");
  77. const movieInfo = document.querySelector(".movie-panel-info");
  78. if (movieListItem.length) {
  79. movieListItem.forEach((el) => {
  80. el.setAttribute("target", "_blank");
  81. const title = el.querySelector("div.video-title strong").textContent;
  82. let newAddons = document.createElement("div");
  83. newAddons.setAttribute("class", "tags has-addons jav-btn");
  84.  
  85. websites.forEach((item) => {
  86. let href = document.createElement("a");
  87. href.textContent = item.name;
  88. href.setAttribute("class", `tag ${item.class} jav-small`);
  89. // href.setAttribute('class', 'is-links')
  90. href.setAttribute("target", "_blank");
  91. href.setAttribute("href", item.link + title + "/");
  92. newAddons.append(href);
  93. });
  94.  
  95. el.append(newAddons);
  96. });
  97. } else if (movieInfo) {
  98. const title = movieInfo.querySelector(".copy-to-clipboard").getAttribute('data-clipboard-text');
  99. const panelList = movieInfo.querySelectorAll(".panel-block");
  100. let panelLast = panelList[panelList.length - 1];
  101.  
  102. websites.forEach((item) => {
  103. let href = document.createElement("a");
  104. href.textContent = item.name;
  105. href.setAttribute("class", `tag ${item.class} jav-small`);
  106. // href.setAttribute('class', 'is-links')
  107. href.setAttribute("target", "_blank");
  108. href.setAttribute("href", item.link + title + "/");
  109.  
  110. panelLast.append(href)
  111. });
  112. } else {
  113. return;
  114. }
  115.  
  116. ///////////////////////////////////////////////////////////
  117.  
  118. // Your code here...
  119. })();