Greasy Fork镜像 支持简体中文。

Google 伪装成 百度

中国人就用百度搜索

目前為 2022-10-17 提交的版本,檢視 最新版本

  1. // ==UserScript==
  2. // @name Google 伪装成 百度
  3. // @namespace userElaina
  4. // @version 2022.10.16.20
  5. // @description 中国人就用百度搜索
  6. // @author somereason userElaina
  7. // @license MIT
  8. // @match *.google.com/search*
  9. // @match *.google.com.*/search*
  10. // @match *.google.com/
  11. // @match *.google.com.*/
  12. // @grant none
  13. // ==/UserScript==
  14.  
  15. (function () {
  16. var link = document.querySelector("link[rel*='icon']") || document.createElement('link');
  17. link.type = 'image/x-icon';
  18. link.rel = 'shortcut icon';
  19. link.href = 'https://raw.githubusercontent.com/userElaina/this-is-the-China-website/main/google/baidu.ico';
  20. document.getElementsByTagName('head')[0].appendChild(link);
  21.  
  22. if (window.location.href.indexOf("/search") > -1) {
  23. var logo = document.getElementById("logo");
  24. var logoArr;
  25. if (logo === null) {
  26. logoArr = document.getElementsByClassName("logo");
  27. if (logoArr.length > 0) {
  28. logo = logoArr[0];
  29. }
  30. }
  31. if (logo === null) {
  32. logoArr = document.getElementsByClassName("logocont");
  33. if (logoArr.length > 0) {
  34. logo = logoArr[0];
  35. }
  36. }
  37. if (logo === null) {
  38. console.log("oops, pls wait for update");
  39. } else {
  40. var imgSize = getImgSize(logo);
  41. logo.innerHTML = '<a href="/" data-hveid="7"><img src="https://raw.githubusercontent.com/userElaina/this-is-the-China-website/main/google/baidu_big.png" alt="Baidu" data-atf="3" height="' + imgSize.height + 'px" width="' + imgSize.width + 'px"></a>';
  42.  
  43. document.title = document.title.replace(/\s-[\s\S]*/g, " - 百度搜索");
  44. }
  45. document.querySelectorAll("a h3").forEach(a => a.style.color = "#0000cc");
  46. document.querySelectorAll("span.st").forEach(a => a.style.color = "#333333")
  47. document.querySelectorAll("em, .rbt b, .c b, .fl b").forEach(a => a.style.color = "#CC0000")
  48.  
  49. var Tg7LZd = document.getElementsByClassName('Tg7LZd')[0];
  50. var height = Tg7LZd.clientHeight;
  51. Tg7LZd.innerHTML = '<img height=' + height + ' src="https://raw.githubusercontent.com/userElaina/this-is-the-China-website/main/google/search.png">';
  52.  
  53. var searchStyle=document.getElementsByClassName('RNNXgb')[0].style;
  54. searchStyle.boxShadow="0 0 0 0";
  55. searchStyle.border=0;
  56. searchStyle.borderRadius=0;
  57. searchStyle.background='#4e6ef21f';
  58.  
  59. var navTabSpans = document.getElementsByClassName("SJajHc");
  60. for (var i = 0; i < navTabSpans.length; i++) {
  61. var naviImageUrl = "https://raw.githubusercontent.com/userElaina/this-is-the-China-website/main/google/icons.png";
  62. navTabSpans[i].style.width = "22px";
  63. if (i === 0) {
  64. navTabSpans[i].style.background = 'url("' + naviImageUrl + '") no-repeat 0px 0px';
  65. } else if (i == navTabSpans.length - 1) {
  66. navTabSpans[i].style.background = 'url("' + naviImageUrl + '") no-repeat 0px 0px';
  67. } else if (navTabSpans[i].classList.contains("NVbCr")) {
  68. navTabSpans[i].style.background = i % 2 == 1 ? 'url("' + naviImageUrl + '") no-repeat -144px -288px' : 'url("' + naviImageUrl + '") no-repeat -144px -282px'; //让页面底部的百度脚丫子错落有致,感谢Raka-loah
  69. } else {
  70. navTabSpans[i].style.background = 'url("' + naviImageUrl + '") no-repeat -96px -288px';
  71. }
  72. }
  73. } else {
  74. let bannerLogo = document.querySelector("[alt=Google]")
  75. bannerLogo.src = "https://raw.githubusercontent.com/userElaina/this-is-the-China-website/main/google/bd_logo1.png";
  76. bannerLogo.removeAttribute("srcset");
  77. bannerLogo.width = 270;
  78. bannerLogo.height = 129;
  79. let paddingTop = bannerLogo.style.paddingTop.replace("px", "");
  80. let paddingTopInt = parseInt(paddingTop);
  81. bannerLogo.style.paddingTop = (paddingTopInt - 20) + "px";
  82.  
  83. var searchBtns = document.getElementsByName("btnK");
  84. for (var x = 0; x < searchBtns.length; x++) {
  85. searchBtns[x].value = searchBtns[x].value.replace(/Google\s?/, "百度");
  86. }
  87.  
  88. document.title = document.title.replace(/Google/g, "百度一下,你就知道");
  89. var footnote = document.getElementById("SIvCob");
  90. if (footnote !== null) {
  91. footnote.innerHTML = footnote.innerHTML.replace(/Google\s?/, "百度");
  92. }
  93. var footElements = document.getElementsByClassName("Fx4vi");
  94. for (var u = 0; u < footElements.length; u++) {
  95. footElements[u].innerHTML = footElements[u].innerHTML.replace(/Google\s?/, "百度");
  96. }
  97. }
  98.  
  99. function getImgSize(elLogo) {
  100. var elImg = elLogo.querySelector("img");
  101. if (elImg === null) {
  102. return { height: 30, width: 92 }
  103. } else {
  104. return { height: elImg.height, width: elImg.width }
  105. }
  106. }
  107. })();

QingJ © 2025

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