🏠 Home 

Google 伪装成 百度

##人就用百度搜索


安装此脚本?
  1. // ==UserScript==
  2. // @name Google 伪装成 百度
  3. // @namespace https://github.com/userElaina/this-is-the-#####-website
  4. // @version 2024.04.01.01
  5. // @description ##人就用百度搜索
  6. // @author somereason userElaina
  7. // @license MIT
  8. // @match *://*.google.com/
  9. // @match *://*.google.com/webhp*
  10. // @match *://*.google.com/search*
  11. // @match *://*.google.com/imghp*
  12. // @match *://scholar.google.com/*
  13. // @match *://*.google.com.hk/
  14. // @match *://*.google.com.hk/webhp*
  15. // @match *://*.google.com.hk/search*
  16. // @match *://*.google.com.hk/imghp*
  17. // @match *://scholar.google.com.hk/*
  18. // @match *://*.google.com.tw/
  19. // @match *://*.google.com.tw/webhp*
  20. // @match *://*.google.com.tw/search*
  21. // @match *://*.google.com.tw/imghp*
  22. // @match *://scholar.google.com.tw/*
  23. // @match *://*.google.co.jp/
  24. // @match *://*.google.co.jp/webhp*
  25. // @match *://*.google.co.jp/search*
  26. // @match *://*.google.co.jp/imghp*
  27. // @match *://scholar.google.co.jp/*
  28. // @grant none
  29. // ==/UserScript==
  30. function sleep(time) {
  31. return new Promise((resolve) => setTimeout(resolve, time));
  32. }
  33. async function f_succ(f, msSleep = 500, maxCount = 10) {
  34. let count = 0;
  35. while (true) {
  36. if (f()) {
  37. return true;
  38. }
  39. count++;
  40. if (count > maxCount) {
  41. return false;
  42. }
  43. await sleep(msSleep);
  44. }
  45. }
  46. (async function () {
  47. // change icon
  48. let link = document.querySelector("link[rel*='icon']") || document.createElement('link');
  49. link.type = 'image/x-icon';
  50. link.rel = 'shortcut icon';
  51. link.href = 'https://raw.githubusercontent.com/userElaina/this-is-the-#####-website/main/google/baidu.ico';
  52. document.getElementsByTagName('head')[0].appendChild(link);
  53. // change search style
  54. f_succ(() => {
  55. let RNNXgb = document.getElementsByClassName('RNNXgb');
  56. if (RNNXgb.length <= 0) {
  57. RNNXgb = document.getElementsByClassName('o6juZc');
  58. }
  59. if (RNNXgb.length <= 0) {
  60. return false;
  61. }
  62. let searchStyle = RNNXgb[0].style;
  63. searchStyle.boxShadow = "0 0 0 0";
  64. searchStyle.border = 0;
  65. searchStyle.borderRadius = 0;
  66. searchStyle.background = '#4e6ef21f';
  67. return true;
  68. });
  69. // func: change search button
  70. async function SearchButton(s0) {
  71. await f_succ(() => {
  72. let Tg7LZd = document.getElementsByClassName('Tg7LZd');
  73. if (Tg7LZd.length <= 0) {
  74. Tg7LZd = document.getElementsByClassName('rCGXm');
  75. }
  76. if (Tg7LZd.length <= 0) {
  77. return false;
  78. }
  79. let height = Tg7LZd[0].clientHeight;
  80. Tg7LZd[0].innerHTML = '<img height=' + height + ' src="https://raw.githubusercontent.com/userElaina/this-is-the-#####-website/main/google/' + s0 + '.png">';
  81. return true;
  82. });
  83. }
  84. // func: change big logo
  85. async function BigLogo(str) {
  86. await f_succ(() => {
  87. let bannerLogo = document.querySelector("[alt='" + str + "']");
  88. if (bannerLogo === null) {
  89. return false;
  90. }
  91. bannerLogo.src = "https://raw.githubusercontent.com/userElaina/this-is-the-#####-website/main/google/baidu_big.png";
  92. bannerLogo.removeAttribute("srcset");
  93. bannerLogo.width = 117 * 2;
  94. bannerLogo.height = 38 * 2;
  95. /*
  96. let paddingTop = bannerLogo.style.paddingTop.replace("px", "");
  97. let paddingTopInt = parseInt(paddingTop);
  98. bannerLogo.style.paddingTop = (paddingTopInt - 20) + "px";
  99. */
  100. return true;
  101. });
  102. }
  103. if (window.location.href.indexOf("/search") > -1) {
  104. // search page
  105. // change search logo
  106. f_succ(() => {
  107. let logo = document.getElementById("logo");
  108. let logoArr;
  109. if (logo === null) {
  110. logoArr = document.getElementsByClassName("logo");
  111. if (logoArr.length <= 0) {
  112. logoArr = document.getElementsByClassName("logocont");
  113. if (logoArr.length <= 0) {
  114. logoArr = document.getElementsByClassName("qlS7ne");
  115. }
  116. }
  117. if (logoArr.length > 0) {
  118. logo = logoArr[0];
  119. }
  120. }
  121. if (logo === null) {
  122. return false;
  123. }
  124. let img = logo.querySelector("img");
  125. if (img === null) {
  126. if (logo.childElementCount <= 0) {
  127. return false;
  128. }
  129. logo.childNodes[0].innerHTML = '<img src="https://raw.githubusercontent.com/userElaina/this-is-the-#####-website/main/google/baidu_big.png" style="background:none" height="30" width="92" data-atf="1" data-frt="0"></img>';
  130. } else {
  131. img.src = 'https://raw.githubusercontent.com/userElaina/this-is-the-#####-website/main/google/baidu_big.png';
  132. }
  133. return true;
  134. });
  135. document.title = document.title.replace(/\s-[\s\S]*/g, " - 百度搜索");
  136. SearchButton('search');
  137. let naviImageUrl = "https://raw.githubusercontent.com/userElaina/this-is-the-#####-website/main/google/icons.png";
  138. let navTabSpans = document.getElementsByClassName("SJajHc");
  139. for (let i = 0; i < navTabSpans.length; i++) {
  140. navTabSpans[i].style.width = "22px";
  141. if (i === 0) {
  142. navTabSpans[i].style.background = 'url("' + naviImageUrl + '") no-repeat 0px 0px';
  143. } else if (i == navTabSpans.length - 1) {
  144. navTabSpans[i].style.background = 'url("' + naviImageUrl + '") no-repeat 0px 0px';
  145. } else if (navTabSpans[i].classList.contains("NVbCr")) {
  146. navTabSpans[i].style.background = i % 2 == 1 ? 'url("' + naviImageUrl + '") no-repeat -144px -288px' : 'url("' + naviImageUrl + '") no-repeat -144px -282px';
  147. } else {
  148. navTabSpans[i].style.background = 'url("' + naviImageUrl + '") no-repeat -96px -288px';
  149. }
  150. }
  151. } else if (window.location.href.indexOf("/imghp") > -1) {
  152. // Google Images
  153. BigLogo('Google Images');
  154. document.title = "百度图片, 发现多彩世界";
  155. SearchButton('imghp');
  156. f_succ(() => {
  157. let T8VaVe = document.getElementsByClassName("T8VaVe");
  158. if (T8VaVe.length <= 0) {
  159. return false;
  160. }
  161. T8VaVe[0].innerHTML = '';
  162. return true;
  163. });
  164. } else if (window.location.href.indexOf("scholar") > -1) {
  165. if (window.location.href.indexOf("/scholar?") > -1) {
  166. document.title = document.title.replace(/\s-[\s\S]*/g, " - 百度学术");
  167. f_succ(() => {
  168. let gs_hdr_lgo = document.getElementById("gs_hdr_lgo");
  169. if (gs_hdr_lgo === null) {
  170. return false;
  171. }
  172. gs_hdr_lgo.remove();
  173. return true;
  174. });
  175. } else {
  176. document.title = "百度学术 - 保持学习的态度";
  177. f_succ(() => {
  178. let gs_hdr_hp_lgo = document.getElementById("gs_hdr_hp_lgo");
  179. if (gs_hdr_hp_lgo === null) {
  180. return false;
  181. }
  182. gs_hdr_hp_lgo.srcset = "https://raw.githubusercontent.com/userElaina/this-is-the-#####-website/main/google/scholar.png";
  183. return true;
  184. });
  185. }
  186. // } else if (window.location.href.indexOf("/webhp") > -1) {
  187. // same as main page, reached by clicking on the logo
  188. } else {
  189. // main page
  190. BigLogo('Google');
  191. document.title = "百度一下, 你就知道";
  192. document.querySelectorAll('a.gb_d, a.gb_p, a.gb_q, a.gb_F, a.gb_H').forEach(v => {
  193. if (v.dataset.pid === '2') {
  194. v.innerText = '百度识图';
  195. if (v.href.indexOf("google.cn") > -1) {
  196. v.href = 'https://images.google.com/imghp';
  197. }
  198. } else if (v.dataset.pid === '23') {
  199. v.innerHTML = '百度邮箱';
  200. }
  201. });
  202. document.querySelectorAll('span.gb_Id').forEach(v => {
  203. v.innerHTML = '登录';
  204. });
  205. // 关于百度 广告 商务 百度搜索的运作方式 隐私权 条款 设置
  206. document.querySelectorAll("a.pHiOh").forEach(v => {
  207. v.innerHTML = v.innerHTML.replace(/\s?Google\s?/, "百度");
  208. });
  209. /*
  210. document.getElementsByClassName("Fx4vi").forEach(v =>{
  211. v.innerHTML = v.innerHTML.replace(/Google\s?/, "百度");
  212. });
  213. */
  214. f_succ(() => {
  215. let btnK = document.getElementsByName("btnK")
  216. if (btnK.length <= 0) {
  217. return false;
  218. }
  219. btnK.forEach(v => {
  220. v.value = "百度搜索";
  221. });
  222. return true;
  223. });
  224. f_succ(() => {
  225. let btnI = document.getElementsByName("btnI")
  226. if (btnI.length <= 0) {
  227. return false;
  228. }
  229. btnI.forEach(v => {
  230. v.value = "今日运势";
  231. });
  232. return true;
  233. });
  234. f_succ(() => {
  235. let footnote = document.getElementById("SIvCob");
  236. if (footnote === null) {
  237. return false;
  238. }
  239. footnote.innerHTML = '百度提供: ' + footnote.innerHTML.slice(footnote.innerHTML.indexOf('<'));
  240. return true;
  241. });
  242. // Google 区域改为# ICP 备
  243. document.querySelectorAll("div.uU7dJb").forEach(v => {
  244. v.innerHTML = v.innerHTML.replace(/.*/, "广公网信备11011101111101号 广IPC证01048576号");
  245. });
  246. }
  247. })();