新火

用于谷歌首页左上角悬浮一个搜索框,一键去特定信息源搜索信息

  1. // ==UserScript==
  2. // @name 新火
  3. // @namespace http://tampermonkey.net/
  4. // @version 0.1.5
  5. // @description 用于谷歌首页左上角悬浮一个搜索框,一键去特定信息源搜索信息
  6. // @author 氦客船长<guangzhi_tan@qq.com>
  7. // @match https://*.google.com.hk/*
  8. // @match https://*.google.com/*
  9. // @grant none
  10. // @require https://code.jquery.com/jquery-3.6.0.min.js
  11. // @license MIT
  12. // ==/UserScript==
  13.  
  14. const urlList = [
  15. {
  16. _id: 1,
  17. tag: "future",
  18. name: "百度指数",
  19. url: "https://index.baidu.com/v2/main/index.html#/trend/{searchKW}?words={searchKW}",
  20. },
  21. {
  22. _id: 2,
  23. tag: "history",
  24. name: "WayBack Machine",
  25. url: "https://web.archive.org/*/{searchKW}",
  26. },
  27. {
  28. _id: 3,
  29. tag: "future",
  30. name: "谷歌趋势",
  31. url: "https://trends.google.com/trends/explore?geo=CN&q={searchKW}",
  32. },
  33. {
  34. _id: 4,
  35. name: "百度百科",
  36. tag: "universal",
  37. url: "https://cn.bing.com/search?q={searchKW} site:baike.baidu.com",
  38. },
  39.  
  40. {
  41. _id: 5,
  42. name: "维基百科",
  43. tag: "universal",
  44. url: "https://zh.wikipedia.org/wiki/{searchKW}",
  45. },
  46. {
  47. _id: 6,
  48. name: "Wikipedia",
  49. tag: "universal",
  50. url: "https://en.wikipedia.org/wiki/{searchKW}",
  51. },
  52. {
  53. _id: 7,
  54. name: "MBA智库",
  55. tag: "universal",
  56. url: "https://wiki.mbalib.com/wiki/Special:Search?search={searchKW}",
  57. },
  58. ];
  59.  
  60. // ## init
  61. const init = () => {
  62. setTimeout(function () {
  63. $("body").append(`
  64. <input
  65. id="myInput"
  66. style=' background:rgba(241, 243, 244,0.5);
  67. overflow: hidden;
  68. z-index: 9999;
  69. position: fixed;
  70. top: 0px;
  71. padding:5px;
  72. text-align:center;
  73. width: 175px;
  74. height: 22px;
  75. border:none;
  76. border-radius:10px'>
  77. `);
  78.  
  79. // 监听回车事件
  80. $("#myInput").keydown(function (e) {
  81. let userInput = e.target.value;
  82. if (e.keyCode == 13) {
  83. // 回车执行搜索
  84. search(userInput);
  85. }
  86. });
  87. }, 1000);
  88. };
  89.  
  90. init();
  91.  
  92. // ## main
  93. const search = async (value) => {
  94. for (let index = 0; index < urlList.length; index++) {
  95. const element = urlList[index];
  96. element.url = element.url.replaceAll("{searchKW}", value);
  97. await sleep(20);
  98. window.open(`${element.url}`);
  99. }
  100. };
  101.  
  102. // ## other
  103. const sleep = (time) => {
  104. return new Promise((resolve) => setTimeout(resolve, time));
  105. };

QingJ © 2025

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