GreasyFork Scripts by Google Search

To search scripts using Google Search

当前为 2023-06-12 提交的版本,查看 最新版本

  1. // ==UserScript==
  2. // @name GreasyFork Scripts by Google Search
  3. // @namespace http://tampermonkey.net/
  4. // @version 0.1.4
  5. // @description To search scripts using Google Search
  6. // @author CY Fung
  7. // @match https://gf.qytechs.cn/*
  8. // @icon https://www.google.com/s2/favicons?sz=64&domain=gf.qytechs.cn
  9. // @grant none
  10. // @license MIT
  11. // ==/UserScript==
  12.  
  13. (function () {
  14. 'use strict';
  15.  
  16. let input = document.querySelector('form input[name="q"]');
  17. if (!(input instanceof HTMLInputElement)) return;
  18. let form = input.closest('form');
  19. if (!(form instanceof HTMLFormElement)) return;
  20. form.addEventListener('submit', function (evt) {
  21.  
  22. let form = evt.target;
  23. if (!(form instanceof HTMLFormElement)) return;
  24. let input = form.querySelector('input[name="q"]');
  25. if (!(input instanceof HTMLInputElement)) return;
  26.  
  27. if (input.value) {
  28. evt.preventDefault();
  29.  
  30. let m = "-inurl%3A%22%2Fusers%2F%22+-inurl%3A%22%2Fdiscussions%22-inurl%3A%22%2Fstats%22+-inurl%3A%22%2Ffeedback%22+-inurl%3A%22%2Fcode%22+-inurl%3A%22q%3D%22+-inurl%3A%22%2Fby-site%2F%22+inurl%3A%22%2Fscripts%2F%22+site%3Agf.qytechs.cn";
  31.  
  32.  
  33. location.href = `https://www.google.com/search?q=${encodeURIComponent(input.value)}+${m}&lr=lang_${document.documentElement.lang}`
  34.  
  35. }
  36.  
  37. })
  38.  
  39. // Your code here...
  40. })();

QingJ © 2025

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