gaoqingFM

gaoqingFM 添加關聯豆瓣按鈕

  1. // ==UserScript==
  2. // @name gaoqingFM
  3. // @namespace http://tampermonkey.net/
  4. // @version 1.01
  5. // @description gaoqingFM 添加關聯豆瓣按鈕
  6. // @author backrock12
  7. // @match https://gaoqing.fm/
  8. // @match https://gaoqing.fm/view/*
  9. // @icon https://www.google.com/s2/favicons?sz=64&domain=gaoqing.fm
  10. // @require http://libs.baidu.com/jquery/2.0.0/jquery.min.js
  11. // @grant GM_addStyle
  12. // @license MIT
  13. // ==/UserScript==
  14.  
  15. (function () {
  16. "use strict";
  17.  
  18. let isrun = false;
  19. function sethomepage() {
  20. if (isrun) return;
  21. isrun = true;
  22. console.log("1");
  23. // const i = $('.pg-items');
  24. // if (i.attr('gaoqingFM')) return;
  25. // i.attr('gaoqingFM', true)
  26. const list = $("#result1 > li > div:nth-child(1) > div:nth-child(2) > p ");
  27. console.log(list);
  28. $.each(list, function (index, element) {
  29. if ($(element).attr("gaoqingFM")) return;
  30. $(element).attr("gaoqingFM", true);
  31. const name = $(element).find("a").text();
  32. console.log(name);
  33. const aurl =
  34. "<a href='https://www.douban.com/search?cat=1002&q=" +
  35. name +
  36. "#autoselect' target='_blank' > <img src='https://www.douban.com/favicon.ico' style='width:24px;' alt='豆瓣' /> </a>";
  37. $(element).append(aurl);
  38. });
  39. isrun = false;
  40. }
  41.  
  42. function subnoad() {
  43. const adlist = [
  44. "#notice",
  45. "ul.navbar-nav:nth-child(2)",
  46. "#cililian > a:nth-child(3)",
  47. "#sidebar",
  48. ];
  49.  
  50. GM_addStyle(adlist.join(",") + " { display:none !important; }");
  51. }
  52.  
  53. function setitempage() {
  54. const ent = $(".col-md-12 > h2");
  55. console.log(ent);
  56. const name = $(ent).find("a").text();
  57. console.log(name);
  58. const aurl =
  59. "<a href='https://www.douban.com/search?cat=1002&q=" +
  60. name +
  61. "#autoselect' target='_blank' > <img src='https://www.douban.com/favicon.ico' style='width:32px;' alt='豆瓣' /> </a>";
  62. $(ent).append(aurl);
  63. }
  64.  
  65. function run() {
  66. subnoad();
  67. if (/view/.test(location.href)) {
  68. setitempage();
  69. } else {
  70. sethomepage();
  71.  
  72. const config = {
  73. //attributes: true,
  74. childList: true,
  75. //subtree: true
  76. };
  77. const observer = new MutationObserver(sethomepage);
  78. observer.observe($("#result1")[0], config);
  79. }
  80. }
  81.  
  82. run();
  83. })();

QingJ © 2025

镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址