🏠 返回首頁 

Greasy Fork is available in English.

百度搜索结果两栏多栏显示

搜索结果支持两栏三栏四栏

  1. // ==UserScript==
  2. // @name 百度搜索结果两栏多栏显示
  3. // @namespace http://tampermonkey.net/
  4. // @version 0.3.1
  5. // @description 搜索结果支持两栏三栏四栏
  6. // @author LGJ
  7. // @run-at document-start
  8. // @connect www.baidu.com
  9. // @include *://ipv6.baidu.com/*
  10. // @include *://www.baidu.com/*
  11. // @include *://www1.baidu.com/*
  12. // @include *://www.baidu.com/s?*
  13. // @include *://ipv6.baidu.com/s?*
  14. // @include *://www.baidu.com/baidu?*
  15. // @include *://ipv6.baidu.com/baidu?*
  16. // @include *://www.baidu.com/
  17. // @include *://www.baidu.com/?*
  18. // @include *://ipv6.baidu.com/
  19. // @grant none
  20. // @note 2020.07-30-V0.2 搜索结果分栏显示
  21. // @create 2020.07-29
  22. // ==/UserScript==
  23. /**
  24. 建议将搜索结果显示条数显示为20条体验更佳
  25. 建议配合AdblockPlus使用,去广告效果极佳
  26. **/
  27. const style = `
  28. /**隐藏不必要的模块 **/
  29. #u,
  30. #content_right,
  31. #help,
  32. #rs {
  33. display: none;
  34. }
  35. /**隐藏新闻搜索结果 **/
  36. .c-group-wrapper .c-group {
  37. display: none;
  38. }
  39. /**
  40. 搜索栏中置
  41. BUG:网页放大后无法居中
  42. **/
  43. .wrapper_l .s_form {
  44. width: 800px !important;
  45. margin: 0 auto !important;
  46. padding-left:0px !important;
  47. }
  48. /**网页视频资讯栏中置 **/
  49. .wrapper_new #s_tab {
  50. padding-left: 0px !important;
  51. text-align: center !important;
  52. }
  53. /**搜索工具中置**/
  54. .search_tool_conter,
  55. .nums
  56. {
  57. margin: 0 auto !important;
  58. }
  59. /***********************/
  60. #container {
  61. width: 100%!important;
  62. }
  63. .wrapper_new #content_left{
  64. float: none!important;
  65. width: 100%!important;
  66. padding-left: 0px!important;
  67. }
  68. #container.sam_newgrid {
  69. margin-left:0px !important;
  70. }
  71. @media (min-width: 500px) and (max-width: 1200px) {
  72. #content_left {
  73. column-count: 2;
  74. -moz-column-count: 2;
  75. -webkit-column-count: 2;
  76. }
  77. }
  78. @media (min-width: 1201px) and (max-width: 1800px) {
  79. #content_left {
  80. padding-left: 3%;
  81. column-count: 3;
  82. -moz-column-count: 3;
  83. -webkit-column-count: 3;
  84. }
  85. }
  86. @media (min-width: 1801px) {
  87. #content_left {
  88. padding-left: 4%;
  89. column-count: 4;
  90. -moz-column-count: 4;
  91. -webkit-column-count: 4;
  92. }
  93. }
  94. #content_left>div[class^="r###lt"] {
  95. display: inline-block;
  96. width: 91%;
  97. padding: 15px 15px;
  98. margin: 1em;
  99. word-break: normal;
  100. word-wrap: normal;
  101. position: relative;
  102. z-index: 1;
  103. box-shadow: 0 2px 5px 0 rgba(0, 0, 0, 0.16), 0 2px 10px 0 rgba(0, 0, 0, 0.12);
  104. border-radius: 2px;
  105. background-color: white;
  106. overflow: hidden;
  107. }
  108. #content_left>div[class^="r###lt"]:before {
  109. /*counter-increment: r###lts;
  110. content: counter(r###lts);*/
  111. z-index: -10;
  112. color: #eee;
  113. font-size: 4.5em;
  114. position: absolute;
  115. text-align: right;
  116. width: 96%;
  117. line-height: 1em;
  118. top: 6px;
  119. }
  120. #content_left>div[class^="r###lt"] .sitelink {
  121. word-wrap: break-word;
  122. }
  123. `;
  124. // 嵌入css
  125. loadStyleString(style);
  126. function loadStyleString(css){
  127. var style = document.createElement("style");
  128. style.type = "text/css";
  129. try{
  130. style.appendChild(document.createTextNode(css));
  131. } catch (ex){
  132. style.styleSheet.cssText = css;
  133. }
  134. document.head.appendChild(style);
  135. //直接在搜索新关键词点击搜索按钮时,直接刷新
  136. //const btnSearch = document.getElementById('su');
  137. //btnSearch.addEventListener('click', () => location.reload());
  138. //const form = document.getElementById('form');
  139. // form.target = '_self';
  140. }