Reddit search on Google 2

Adds a button to search Reddit posts with Google

当前为 2023-03-11 提交的版本,查看 最新版本

  1. // ==UserScript==
  2. // @name Reddit search on Google 2
  3. // @version 1.0.1.2
  4. // @license MIT
  5. // @description Adds a button to search Reddit posts with Google
  6. // @author JZ
  7. // @namespace https://github.com/IcyBearLovesSleep/reddit-search-on-google-2
  8. // @match https://*.google.com/search*
  9. // @match https://*.google.ad/search*
  10. // @match https://*.google.ae/search*
  11. // @match https://*.google.com.af/search*
  12. // @match https://*.google.com.ag/search*
  13. // @match https://*.google.com.ai/search*
  14. // @match https://*.google.al/search*
  15. // @match https://*.google.am/search*
  16. // @match https://*.google.co.ao/search*
  17. // @match https://*.google.com.ar/search*
  18. // @match https://*.google.as/search*
  19. // @match https://*.google.at/search*
  20. // @match https://*.google.com.au/search*
  21. // @match https://*.google.az/search*
  22. // @match https://*.google.ba/search*
  23. // @match https://*.google.com.bd/search*
  24. // @match https://*.google.be/search*
  25. // @match https://*.google.bf/search*
  26. // @match https://*.google.bg/search*
  27. // @match https://*.google.com.bh/search*
  28. // @match https://*.google.bi/search*
  29. // @match https://*.google.bj/search*
  30. // @match https://*.google.com.bn/search*
  31. // @match https://*.google.com.bo/search*
  32. // @match https://*.google.com.br/search*
  33. // @match https://*.google.bs/search*
  34. // @match https://*.google.bt/search*
  35. // @match https://*.google.co.bw/search*
  36. // @match https://*.google.by/search*
  37. // @match https://*.google.com.bz/search*
  38. // @match https://*.google.ca/search*
  39. // @match https://*.google.cd/search*
  40. // @match https://*.google.cf/search*
  41. // @match https://*.google.cg/search*
  42. // @match https://*.google.ch/search*
  43. // @match https://*.google.ci/search*
  44. // @match https://*.google.co.ck/search*
  45. // @match https://*.google.cl/search*
  46. // @match https://*.google.cm/search*
  47. // @match https://*.google.cn/search*
  48. // @match https://*.google.com.co/search*
  49. // @match https://*.google.co.cr/search*
  50. // @match https://*.google.com.cu/search*
  51. // @match https://*.google.cv/search*
  52. // @match https://*.google.com.cy/search*
  53. // @match https://*.google.cz/search*
  54. // @match https://*.google.de/search*
  55. // @match https://*.google.dj/search*
  56. // @match https://*.google.dk/search*
  57. // @match https://*.google.dm/search*
  58. // @match https://*.google.com.do/search*
  59. // @match https://*.google.dz/search*
  60. // @match https://*.google.com.ec/search*
  61. // @match https://*.google.ee/search*
  62. // @match https://*.google.com.eg/search*
  63. // @match https://*.google.es/search*
  64. // @match https://*.google.com.et/search*
  65. // @match https://*.google.fi/search*
  66. // @match https://*.google.com.fj/search*
  67. // @match https://*.google.fm/search*
  68. // @match https://*.google.fr/search*
  69. // @match https://*.google.ga/search*
  70. // @match https://*.google.ge/search*
  71. // @match https://*.google.gg/search*
  72. // @match https://*.google.com.gh/search*
  73. // @match https://*.google.com.gi/search*
  74. // @match https://*.google.gl/search*
  75. // @match https://*.google.gm/search*
  76. // @match https://*.google.gr/search*
  77. // @match https://*.google.com.gt/search*
  78. // @match https://*.google.gy/search*
  79. // @match https://*.google.com.hk/search*
  80. // @match https://*.google.hn/search*
  81. // @match https://*.google.hr/search*
  82. // @match https://*.google.ht/search*
  83. // @match https://*.google.hu/search*
  84. // @match https://*.google.co.id/search*
  85. // @match https://*.google.ie/search*
  86. // @match https://*.google.co.il/search*
  87. // @match https://*.google.im/search*
  88. // @match https://*.google.co.in/search*
  89. // @match https://*.google.iq/search*
  90. // @match https://*.google.is/search*
  91. // @match https://*.google.it/search*
  92. // @match https://*.google.je/search*
  93. // @match https://*.google.com.jm/search*
  94. // @match https://*.google.jo/search*
  95. // @match https://*.google.co.jp/search*
  96. // @match https://*.google.co.ke/search*
  97. // @match https://*.google.com.kh/search*
  98. // @match https://*.google.ki/search*
  99. // @match https://*.google.kg/search*
  100. // @match https://*.google.co.kr/search*
  101. // @match https://*.google.com.kw/search*
  102. // @match https://*.google.kz/search*
  103. // @match https://*.google.la/search*
  104. // @match https://*.google.com.lb/search*
  105. // @match https://*.google.li/search*
  106. // @match https://*.google.lk/search*
  107. // @match https://*.google.co.ls/search*
  108. // @match https://*.google.lt/search*
  109. // @match https://*.google.lu/search*
  110. // @match https://*.google.lv/search*
  111. // @match https://*.google.com.ly/search*
  112. // @match https://*.google.co.ma/search*
  113. // @match https://*.google.md/search*
  114. // @match https://*.google.me/search*
  115. // @match https://*.google.mg/search*
  116. // @match https://*.google.mk/search*
  117. // @match https://*.google.ml/search*
  118. // @match https://*.google.com.mm/search*
  119. // @match https://*.google.mn/search*
  120. // @match https://*.google.ms/search*
  121. // @match https://*.google.com.mt/search*
  122. // @match https://*.google.mu/search*
  123. // @match https://*.google.mv/search*
  124. // @match https://*.google.mw/search*
  125. // @match https://*.google.com.mx/search*
  126. // @match https://*.google.com.my/search*
  127. // @match https://*.google.co.mz/search*
  128. // @match https://*.google.com.na/search*
  129. // @match https://*.google.com.ng/search*
  130. // @match https://*.google.com.ni/search*
  131. // @match https://*.google.ne/search*
  132. // @match https://*.google.nl/search*
  133. // @match https://*.google.no/search*
  134. // @match https://*.google.com.np/search*
  135. // @match https://*.google.nr/search*
  136. // @match https://*.google.nu/search*
  137. // @match https://*.google.co.nz/search*
  138. // @match https://*.google.com.om/search*
  139. // @match https://*.google.com.pa/search*
  140. // @match https://*.google.com.pe/search*
  141. // @match https://*.google.com.pg/search*
  142. // @match https://*.google.com.ph/search*
  143. // @match https://*.google.com.pk/search*
  144. // @match https://*.google.pl/search*
  145. // @match https://*.google.pn/search*
  146. // @match https://*.google.com.pr/search*
  147. // @match https://*.google.ps/search*
  148. // @match https://*.google.pt/search*
  149. // @match https://*.google.com.py/search*
  150. // @match https://*.google.com.qa/search*
  151. // @match https://*.google.ro/search*
  152. // @match https://*.google.ru/search*
  153. // @match https://*.google.rw/search*
  154. // @match https://*.google.com.sa/search*
  155. // @match https://*.google.com.sb/search*
  156. // @match https://*.google.sc/search*
  157. // @match https://*.google.se/search*
  158. // @match https://*.google.com.sg/search*
  159. // @match https://*.google.sh/search*
  160. // @match https://*.google.si/search*
  161. // @match https://*.google.sk/search*
  162. // @match https://*.google.com.sl/search*
  163. // @match https://*.google.sn/search*
  164. // @match https://*.google.so/search*
  165. // @match https://*.google.sm/search*
  166. // @match https://*.google.sr/search*
  167. // @match https://*.google.st/search*
  168. // @match https://*.google.com.sv/search*
  169. // @match https://*.google.td/search*
  170. // @match https://*.google.tg/search*
  171. // @match https://*.google.co.th/search*
  172. // @match https://*.google.com.tj/search*
  173. // @match https://*.google.tl/search*
  174. // @match https://*.google.tm/search*
  175. // @match https://*.google.tn/search*
  176. // @match https://*.google.to/search*
  177. // @match https://*.google.com.tr/search*
  178. // @match https://*.google.tt/search*
  179. // @match https://*.google.com.tw/search*
  180. // @match https://*.google.co.tz/search*
  181. // @match https://*.google.com.ua/search*
  182. // @match https://*.google.co.ug/search*
  183. // @match https://*.google.co.uk/search*
  184. // @match https://*.google.com.uy/search*
  185. // @match https://*.google.co.uz/search*
  186. // @match https://*.google.com.vc/search*
  187. // @match https://*.google.co.ve/search*
  188. // @match https://*.google.vg/search*
  189. // @match https://*.google.co.vi/search*
  190. // @match https://*.google.com.vn/search*
  191. // @match https://*.google.vu/search*
  192. // @match https://*.google.ws/search*
  193. // @match https://*.google.rs/search*
  194. // @match https://*.google.co.za/search*
  195. // @match https://*.google.co.zm/search*
  196. // @match https://*.google.co.zw/search*
  197. // @match https://*.google.cat/search*
  198. // @run-at document-end
  199. // ==/UserScript==
  200.  
  201. // put in desire site search filter
  202. const site = 'reddit.com';
  203. const Name = "Reddit";
  204.  
  205. const queryRegex = /q=[^&]+/g;
  206. const siteRegex = /\+site(?:%3A|\:).+\.[^&+]+/g;
  207. const Url = '+site%3A'+site;
  208.  
  209. (function () {
  210. 'use strict';
  211. window.addEventListener("load", function () {
  212. const menu = document.querySelector('.nfdoRb')
  213. // creates reddit button
  214. let button = document.createElement('a')
  215. button.className = 'zItAnd FOU1zf'
  216. button.href = window.location.href.replace(queryRegex, (match) => {
  217. // Replaces the existing `site` flags
  218. return match.search(siteRegex) >= 0 ? match.replace(siteRegex, Url) : match + Url;
  219. });
  220.  
  221. button.innerText = Name
  222. document.querySelector('.nfdoRb').append(button)
  223. }, false)
  224.  
  225. })();

QingJ © 2025

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