居中谷歌搜索页面

居中谷歌搜索页面布局。

  1. // ==UserScript==
  2. // @name Center Google Search Page
  3. // @name:zh-CN 居中谷歌搜索页面
  4. // @name:zh-TW 居中谷歌搜索頁面
  5. // @namespace http://tampermonkey.net/
  6. // @version 0.1
  7. // @description Centers the layout of Google search page.
  8. // @description:zh-CN 居中谷歌搜索页面布局。
  9. // @description:zh-TW 居中谷歌搜索頁面佈局。
  10. // @author ChatGPT 3.5
  11. // @match https://www.google.com/search?*
  12. // @grant none
  13. // @license MIT
  14. // ==/UserScript==
  15.  
  16. // 参考:https://salmon853.substack.com/p/32f,为了不影响在笔记本屏幕上的体验,可以自行更改 min-width 参数。
  17.  
  18. (function() {
  19. 'use strict';
  20.  
  21. // Function to add custom CSS styles // 添加自定义 CSS 样式的函数
  22. function addStyle(css) {
  23. const style = document.createElement('style');
  24. style.textContent = css;
  25. document.head.appendChild(style);
  26. }
  27.  
  28. // Custom CSS styles // 自定义 CSS 样式
  29. const customStyles = `
  30. @media (min-width: 1537px) {
  31. /* AI 搜索 */
  32. .GcKpu {
  33. display: flex
  34. justify-content: center;
  35. }
  36.  
  37. body {
  38. max-width: max-content;
  39. margin-left: auto;
  40. margin-right: auto;
  41. }
  42. }
  43. `;
  44.  
  45. // Apply custom styles // 应用自定义样式
  46. addStyle(customStyles);
  47. })();

QingJ © 2025

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