ACT.谷歌.DM.NCR

谷歌地区锁定,没有国家重定向。

当前为 2022-04-03 提交的版本,查看 最新版本

  1. // ==UserScript==
  2. // @name ACT.Google.DM.NCR
  3. // @name:zh-CN ACT.谷歌.DM.NCR
  4. // @description Google region locked, no country redirect.
  5. // @description:zh-CN 谷歌地区锁定,没有国家重定向。
  6. // @author ACTCD
  7. // @version 20220403.1
  8. // @license GPL-3.0-or-later
  9. // @namespace ACTCD/Userscripts
  10. // @supportURL https://github.com/ACTCD/Userscripts#contact
  11. // @homepageURL https://github.com/ACTCD/Userscripts
  12. // @match *://www.google.com/*
  13. // @match *://www.google.ad/*
  14. // @match *://www.google.ae/*
  15. // @match *://www.google.com.af/*
  16. // @match *://www.google.com.ag/*
  17. // @match *://www.google.com.ai/*
  18. // @match *://www.google.al/*
  19. // @match *://www.google.am/*
  20. // @match *://www.google.co.ao/*
  21. // @match *://www.google.com.ar/*
  22. // @match *://www.google.as/*
  23. // @match *://www.google.at/*
  24. // @match *://www.google.com.au/*
  25. // @match *://www.google.az/*
  26. // @match *://www.google.ba/*
  27. // @match *://www.google.com.bd/*
  28. // @match *://www.google.be/*
  29. // @match *://www.google.bf/*
  30. // @match *://www.google.bg/*
  31. // @match *://www.google.com.bh/*
  32. // @match *://www.google.bi/*
  33. // @match *://www.google.bj/*
  34. // @match *://www.google.com.bn/*
  35. // @match *://www.google.com.bo/*
  36. // @match *://www.google.com.br/*
  37. // @match *://www.google.bs/*
  38. // @match *://www.google.bt/*
  39. // @match *://www.google.co.bw/*
  40. // @match *://www.google.by/*
  41. // @match *://www.google.com.bz/*
  42. // @match *://www.google.ca/*
  43. // @match *://www.google.cd/*
  44. // @match *://www.google.cf/*
  45. // @match *://www.google.cg/*
  46. // @match *://www.google.ch/*
  47. // @match *://www.google.ci/*
  48. // @match *://www.google.co.ck/*
  49. // @match *://www.google.cl/*
  50. // @match *://www.google.cm/*
  51. // @match *://www.google.cn/*
  52. // @match *://www.google.com.co/*
  53. // @match *://www.google.co.cr/*
  54. // @match *://www.google.com.cu/*
  55. // @match *://www.google.cv/*
  56. // @match *://www.google.com.cy/*
  57. // @match *://www.google.cz/*
  58. // @match *://www.google.de/*
  59. // @match *://www.google.dj/*
  60. // @match *://www.google.dk/*
  61. // @match *://www.google.dm/*
  62. // @match *://www.google.com.do/*
  63. // @match *://www.google.dz/*
  64. // @match *://www.google.com.ec/*
  65. // @match *://www.google.ee/*
  66. // @match *://www.google.com.eg/*
  67. // @match *://www.google.es/*
  68. // @match *://www.google.com.et/*
  69. // @match *://www.google.fi/*
  70. // @match *://www.google.com.fj/*
  71. // @match *://www.google.fm/*
  72. // @match *://www.google.fr/*
  73. // @match *://www.google.ga/*
  74. // @match *://www.google.ge/*
  75. // @match *://www.google.gg/*
  76. // @match *://www.google.com.gh/*
  77. // @match *://www.google.com.gi/*
  78. // @match *://www.google.gl/*
  79. // @match *://www.google.gm/*
  80. // @match *://www.google.gr/*
  81. // @match *://www.google.com.gt/*
  82. // @match *://www.google.gy/*
  83. // @match *://www.google.com.hk/*
  84. // @match *://www.google.hn/*
  85. // @match *://www.google.hr/*
  86. // @match *://www.google.ht/*
  87. // @match *://www.google.hu/*
  88. // @match *://www.google.co.id/*
  89. // @match *://www.google.ie/*
  90. // @match *://www.google.co.il/*
  91. // @match *://www.google.im/*
  92. // @match *://www.google.co.in/*
  93. // @match *://www.google.iq/*
  94. // @match *://www.google.is/*
  95. // @match *://www.google.it/*
  96. // @match *://www.google.je/*
  97. // @match *://www.google.com.jm/*
  98. // @match *://www.google.jo/*
  99. // @match *://www.google.co.jp/*
  100. // @match *://www.google.co.ke/*
  101. // @match *://www.google.com.kh/*
  102. // @match *://www.google.ki/*
  103. // @match *://www.google.kg/*
  104. // @match *://www.google.co.kr/*
  105. // @match *://www.google.com.kw/*
  106. // @match *://www.google.kz/*
  107. // @match *://www.google.la/*
  108. // @match *://www.google.com.lb/*
  109. // @match *://www.google.li/*
  110. // @match *://www.google.lk/*
  111. // @match *://www.google.co.ls/*
  112. // @match *://www.google.lt/*
  113. // @match *://www.google.lu/*
  114. // @match *://www.google.lv/*
  115. // @match *://www.google.com.ly/*
  116. // @match *://www.google.co.ma/*
  117. // @match *://www.google.md/*
  118. // @match *://www.google.me/*
  119. // @match *://www.google.mg/*
  120. // @match *://www.google.mk/*
  121. // @match *://www.google.ml/*
  122. // @match *://www.google.com.mm/*
  123. // @match *://www.google.mn/*
  124. // @match *://www.google.ms/*
  125. // @match *://www.google.com.mt/*
  126. // @match *://www.google.mu/*
  127. // @match *://www.google.mv/*
  128. // @match *://www.google.mw/*
  129. // @match *://www.google.com.mx/*
  130. // @match *://www.google.com.my/*
  131. // @match *://www.google.co.mz/*
  132. // @match *://www.google.com.na/*
  133. // @match *://www.google.com.ng/*
  134. // @match *://www.google.com.ni/*
  135. // @match *://www.google.ne/*
  136. // @match *://www.google.nl/*
  137. // @match *://www.google.no/*
  138. // @match *://www.google.com.np/*
  139. // @match *://www.google.nr/*
  140. // @match *://www.google.nu/*
  141. // @match *://www.google.co.nz/*
  142. // @match *://www.google.com.om/*
  143. // @match *://www.google.com.pa/*
  144. // @match *://www.google.com.pe/*
  145. // @match *://www.google.com.pg/*
  146. // @match *://www.google.com.ph/*
  147. // @match *://www.google.com.pk/*
  148. // @match *://www.google.pl/*
  149. // @match *://www.google.pn/*
  150. // @match *://www.google.com.pr/*
  151. // @match *://www.google.ps/*
  152. // @match *://www.google.pt/*
  153. // @match *://www.google.com.py/*
  154. // @match *://www.google.com.qa/*
  155. // @match *://www.google.ro/*
  156. // @match *://www.google.ru/*
  157. // @match *://www.google.rw/*
  158. // @match *://www.google.com.sa/*
  159. // @match *://www.google.com.sb/*
  160. // @match *://www.google.sc/*
  161. // @match *://www.google.se/*
  162. // @match *://www.google.com.sg/*
  163. // @match *://www.google.sh/*
  164. // @match *://www.google.si/*
  165. // @match *://www.google.sk/*
  166. // @match *://www.google.com.sl/*
  167. // @match *://www.google.sn/*
  168. // @match *://www.google.so/*
  169. // @match *://www.google.sm/*
  170. // @match *://www.google.sr/*
  171. // @match *://www.google.st/*
  172. // @match *://www.google.com.sv/*
  173. // @match *://www.google.td/*
  174. // @match *://www.google.tg/*
  175. // @match *://www.google.co.th/*
  176. // @match *://www.google.com.tj/*
  177. // @match *://www.google.tl/*
  178. // @match *://www.google.tm/*
  179. // @match *://www.google.tn/*
  180. // @match *://www.google.to/*
  181. // @match *://www.google.com.tr/*
  182. // @match *://www.google.tt/*
  183. // @match *://www.google.com.tw/*
  184. // @match *://www.google.co.tz/*
  185. // @match *://www.google.com.ua/*
  186. // @match *://www.google.co.ug/*
  187. // @match *://www.google.co.uk/*
  188. // @match *://www.google.com.uy/*
  189. // @match *://www.google.co.uz/*
  190. // @match *://www.google.com.vc/*
  191. // @match *://www.google.co.ve/*
  192. // @match *://www.google.vg/*
  193. // @match *://www.google.co.vi/*
  194. // @match *://www.google.com.vn/*
  195. // @match *://www.google.vu/*
  196. // @match *://www.google.ws/*
  197. // @match *://www.google.rs/*
  198. // @match *://www.google.co.za/*
  199. // @match *://www.google.co.zm/*
  200. // @match *://www.google.co.zw/*
  201. // @match *://www.google.cat/*
  202. // @grant none
  203. // @run-at document-start
  204. // ==/UserScript==
  205. // https://www.google.com/supported_domains
  206.  
  207. (function () {
  208. 'use strict';
  209.  
  210. const lang = navigator.language || 'zh-CN';
  211. const url = new URL(location);
  212. url.hostname = 'www.google.com';
  213. if (url.hostname != location.hostname) {
  214. window.stop();
  215. location.replace('https://www.google.com/ncr#ncr:' + encodeURIComponent(url));
  216. } else {
  217. if (url.hash.slice(0, 5) == '#ncr:') {
  218. url.href = decodeURIComponent(url.hash.slice(5));
  219. url.hash = location.hash = '';
  220. url.searchParams.set("gl", 'ZZ');
  221. }
  222. if (url.searchParams.get("gl") != lang.slice(-2)) {
  223. url.searchParams.set("gl", lang.slice(-2));
  224. url.searchParams.set("hl", lang);
  225. window.stop();
  226. location.replace(url.href);
  227. }
  228. }
  229.  
  230. })();