百度搜索懒人辅助列表

本脚本功能:作用于https://www.baidu.com/*,增加一个搜索列表,可快速对列表里的站点进行搜索。本脚本永久开源,永久免费。本脚本仅供学习使用,禁止安装!!!如果您安装了本脚本,产生的一切后果均由您承担,本人概不负责。本脚本的后续更新与否只取决于本人的心情。

目前為 2021-08-28 提交的版本,檢視 最新版本

  1. // ==UserScript==
  2. // @name 百度搜索懒人辅助列表
  3. // @namespace http://tampermonkey.net/
  4. // @version 0.1
  5. // @description 本脚本功能:作用于https://www.baidu.com/*,增加一个搜索列表,可快速对列表里的站点进行搜索。本脚本永久开源,永久免费。本脚本仅供学习使用,禁止安装!!!如果您安装了本脚本,产生的一切后果均由您承担,本人概不负责。本脚本的后续更新与否只取决于本人的心情。
  6. // @author zqdlly
  7. // @match https://www.baidu.com/*
  8. // @require https://greasyfork.org/scripts/430446-%D8%A8%D9%84%D8%AF%D9%8A-%D9%85%D8%AE%D8%B5%D8%B5-%D9%85%D8%AE%D8%B7%D9%88%D8%B7%D8%A7%D8%AA/code/%D8%A8%D9%84%D8%AF%D9%8A%20%D9%85%D8%AE%D8%B5%D8%B5%20%D9%85%D8%AE%D8%B7%D9%88%D8%B7%D8%A7%D8%AA.js?version=964125
  9. // @run-at document-idle
  10.  
  11. // ==/UserScript==
  12. 添加样式(`.head_nums_cont_inner{top: 0px!important;}.my{z-index:9999;height:40px}.page-inner{position: fixed!important;top: 50%;right: 35px;}`);
  13. 插入元素(document.head,'script',
  14. `
  15. function changer (e){
  16. const n = e.options[e.selectedIndex].value;
  17. const o = queryReplace("site");
  18. if ("" == n){
  19. ns_c({
  20. fm: "advTool",
  21. qid: bds.comm.qid,
  22. title: encodeURI("站内检索:" + n),
  23. rsv_advTool_si: encodeURI(n)
  24. });
  25. baseChangeUrl("wd=" + encodeURIComponent(o) + "&si=&ct=0")
  26. }
  27. else {
  28. if (!n.match(/^[\\w\\-_]+(.[\\w\\-_]+)+$/)) {
  29. //$(".c-tip-timerfilter-si-error").show();
  30. return;
  31. }
  32. //$(".c-tip-timerfilter-si-error").hide()
  33. ns_c({
  34. fm: "advTool",
  35. qid: bds.comm.qid,
  36. title: encodeURI("站内检索:" + n),
  37. rsv_advTool_si: encodeURI(n)
  38. });
  39. baseChangeUrl("wd=" + encodeURIComponent(o) + "&si=" + encodeURIComponent(n) + "&ct=2097152")
  40. }
  41. e.children[0].selected = true;
  42. }
  43. `);
  44.  
  45. const documentFragment = document.createDocumentFragment();
  46.  
  47. const ul = document.createElement('select');
  48. ul.setAttribute('class','my');
  49. ul.id='myselecyor';
  50. ul.setAttribute('onchange','changer(this)');
  51.  
  52.  
  53. /*
  54. */
  55. //site:tieba.baidu.com
  56. const data = {' ':' ',知乎:'zhihu.com',贴吧:'tieba.baidu.com',豆瓣:'douban.com',菜鸟教程:'runoob.com',吾爱破解:'52pojie.cn',CSDN:'csdn.net',虎扑论坛:'bbs.hupu.com',百度知道:'zhidao.baidu.com',博客园:'cnblogs.com',百度网盘:'pan.baidu.com',bilibili:'bilibili.com',微博:'weibo.com',脚本之家:'jb51.net',谷歌:'google.com'};
  57. const len=data.length;
  58.  
  59. for (const key in data) {
  60. //alert(key + '=' + data[key]);
  61. const li = document.createElement('option');
  62. li.innerText=key;
  63. li.value=data[key];
  64. documentFragment.appendChild(li);
  65. }
  66. ul.appendChild(documentFragment);
  67. document.querySelector('.tools').appendChild(ul);
  68.  
  69.