在百度百科中添加灰机Wiki中文维基MBA智库等按钮

在百度百科中添加相同式样的Magi搜索(暂停服务,替换成灰机Wiki)、中文维基、MBA智库按钮。

  1. // ==UserScript==
  2. // @name 在百度百科中添加灰机Wiki中文维基MBA智库等按钮
  3. // @name:en Add Buttons to MBA Zhiku|WikipediaCN|HuijiWiki in Baidupedia
  4. // @namespace Black Rabbit
  5. // @version 1.1.6
  6. // @description 在百度百科中添加相同式样的Magi搜索(暂停服务,替换成灰机Wiki)、中文维基、MBA智库按钮。
  7. // @description:en Add same looks' buttons in Baidupedia, that jump to MBA Zhiku, WikipediaCN, HuijiWiki.
  8. // @match http://baike.baidu.com/*
  9. // @match https://baike.baidu.com/*
  10. // @author Black Rabbit
  11. // @run-at document-end
  12. // @icon https://baike.baidu.com/favicon.ico
  13. // @require https://code.jquery.com/jquery-3.7.1.min.js
  14. // ==/UserScript==
  15.  
  16. var timeout = 100; // you could increase this value by 100 per step, according your Network status
  17. // Edit the search site as you like
  18. var name1 = "中文维基";
  19. var url1 = "https://zh.wikipedia.org/wiki/";
  20. var name2 = "MBA智库";
  21. var url2 = "https://wiki.mbalib.com/wiki/Special:Search?search=";
  22. var name3 = "灰机Wiki";
  23. var url3 = "https://www.huijiwiki.com/index.php?title=%E7%89%B9%E6%AE%8A:%E5%85%A8%E5%B1%80%E6%90%9C%E7%B4%A2&key=";
  24.  
  25. function nn_method(){
  26. var headwidth = document.getElementsByClassName('index-module_lemmaSearchBar__5xejA');
  27. headwidth = headwidth[0];
  28. headwidth.style.width = "1300px";
  29. var query = $('div.index-module_inputWrapper__d-MvE > input.index-module_searchInput__Q0ER3');
  30. //Huiji
  31. $('div.index-module_rightWrapper__gKXFG > button.index-module_lemmaBtn__uEM7b').after('<button class="hjwiki my_button" style="margin-left: 4px">' + name3 + '</button>');
  32. $('.hjwiki').on({
  33. click: function () {
  34. window.open(url3 + query.val());
  35. return false;
  36. }
  37. });
  38. //mba
  39. $('div.index-module_rightWrapper__gKXFG > button.index-module_lemmaBtn__uEM7b').after('<button class="mbazk my_button" style="margin-left: 4px">' + name2 + '</button>');
  40. $('.mbazk').on({
  41. click: function () {
  42. window.open(url2 + query.val());
  43. return false;
  44. }
  45. });
  46.  
  47. //wiki
  48. $('div.index-module_rightWrapper__gKXFG > button.index-module_lemmaBtn__uEM7b').after('<button class="wikizn my_button" style="margin-left: 4px">' + name1 + '</button>');
  49. $('.wikizn').on({
  50. click: function () {
  51. window.open(url1 + query.val());
  52. return false;
  53. }
  54. });
  55.  
  56. $(".my_button").css({
  57. "-webkit-appearance": "none",
  58. "background": "#38f",
  59. "border": "1px solid",
  60. "border-color": "#38f #38f #2d78f4",
  61. "border-radius": "0",
  62. "color": "#fff",
  63. "cursor": "pointer",
  64. "display": "inline-block",
  65. "float": "left",
  66. "font-family": "arial",
  67. "font-size": "16px",
  68. "height": "40px",
  69. "letter-spacing": "1px",
  70. "outline": "medium",
  71. "width": "104px"
  72. });
  73.  
  74. $(".my_button").hover(function(){$(this).css({"background": "#317ef3", "border-color": "#317ef3"})},
  75. function(){ $(this).css({"background": "#38f", "border-color": "#38f #38f #2d78f4"}) } );
  76.  
  77. $('div.index-module_searchBar__L5IRU.clearfix.index-module_top-search__blbxv > div.index-module_rightWrapper__gKXFG > button').css({
  78. "font-size": "13px",
  79. "height": "34px",
  80. "width": "72px"
  81. });
  82. }
  83.  
  84. // function ori_method() {
  85. // var headwidth = document.getElementsByClassName('wgt-searchbar wgt-searchbar-new wgt-searchbar-main cmn-clearfix wgt-searchbar-large');
  86. // headwidth = headwidth[0];
  87. // headwidth.style.width = "1300px";
  88.  
  89. // //Huiji
  90. // $('#searchForm > #search').after('<button class="hjwiki" type="button">' + name3 + '</button>');
  91. // $('.hjwiki').on({
  92. // click: function () {
  93. // window.open(url3 + $('#query').val());
  94. // return false;
  95. // }
  96. // });
  97.  
  98. // //mba
  99. // $('#searchForm > #search').after('<button class="mbazk" type="button">' + name2 + '</button>');
  100. // $('.mbazk').on({
  101. // click: function () {
  102. // window.open(url2 + $('#query').val());
  103. // return false;
  104. // }
  105. // });
  106. // //wiki
  107. // $('#searchForm > #search').after('<button class="wikizn" type="button">' + name1 + '</button>');
  108. // $('.wikizn').on({
  109. // click: function () {
  110. // window.open(url1 + $('#query').val());
  111. // return false;
  112. // }
  113. // });
  114.  
  115. // $('.wgt-searchbar.wgt-searchbar-new.wgt-searchbar-simple.cmn-clearfix > .search > .form > form > button').css({
  116. // "font-size": "13px",
  117. // "height": "34px",
  118. // "width": "72px"
  119. // });
  120.  
  121. // console.log("Run old method");
  122. // }
  123.  
  124. // function new_method() {
  125. // var headwidth = document.getElementsByClassName('lemmaSearchBar_iqVhO');
  126. // headwidth = headwidth[0];
  127. // headwidth.style.width = "1300px";
  128. // var query = $('div.lemmaSearchBarWrapper_uK_i6 > div.lemmaSearchBar_iqVhO > div.searchBar_y3cFr.clearfix > div.rightWrapper_MV_63 > div.inputWrapper_pg1f_ > input.searchInput_qiZhW');
  129.  
  130. // //Huiji
  131. // $('div.rightWrapper_MV_63 > button.lemmaBtn_F27pH').after('<button class="hjwiki my_button" style="margin-left: 4px">' + name3 + '</button>');
  132. // $('.hjwiki').on({
  133. // click: function () {
  134. // window.open(url3 + query.val());
  135. // return false;
  136. // }
  137. // });
  138.  
  139. // //mba
  140. // $('div.rightWrapper_MV_63 > button.lemmaBtn_F27pH').after('<button class="mbazk my_button" style="margin-left: 4px">' + name2 + '</button>');
  141. // $('.mbazk').on({
  142. // click: function () {
  143. // window.open(url2 + query.val());
  144. // return false;
  145. // }
  146. // });
  147.  
  148. // //wiki
  149. // $('div.rightWrapper_MV_63 > button.lemmaBtn_F27pH').after('<button class="wikizn my_button" style="margin-left: 4px">' + name1 + '</button>');
  150. // $('.wikizn').on({
  151. // click: function () {
  152. // window.open(url1 + query.val() );
  153. // return false;
  154. // }
  155. // });
  156.  
  157. // $(".my_button").css({
  158. // "-webkit-appearance": "none",
  159. // "background": "#38f",
  160. // "border": "1px solid",
  161. // "border-color": "#38f #38f #2d78f4",
  162. // "border-radius": "0",
  163. // "color": "#fff",
  164. // "cursor": "pointer",
  165. // "display": "inline-block",
  166. // "float": "left",
  167. // "font-family": "arial",
  168. // "font-size": "16px",
  169. // "height": "40px",
  170. // "letter-spacing": "1px",
  171. // "outline": "medium",
  172. // "width": "104px"
  173. // });
  174.  
  175. // $(".my_button").hover(function(){$(this).css({"background": "#317ef3", "border-color": "#317ef3"})},
  176. // function(){ $(this).css({"background": "#38f", "border-color": "#38f #38f #2d78f4"}) } );
  177.  
  178. // $('.searchBar_y3cFr.clearfix.top-search_mjMaD > .rightWrapper_MV_63 > button').css({
  179. // "font-size": "13px",
  180. // "height": "34px",
  181. // "width": "72px"
  182. // });
  183.  
  184. // console.log("Run new method");
  185. // }
  186.  
  187. function detect() {
  188. // console.log("detecting . . . .");
  189. // var body = document.body;
  190. // if (body.getAttribute("class")) {
  191. // console.log("ori DOM");
  192. // ori_method();
  193. // } else {
  194. // console.log("new DOM");
  195. // new_method();
  196. // }
  197. nn_method();
  198. }
  199.  
  200. setTimeout(detect,timeout);

QingJ © 2025

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