更多搜索引擎

自动将URL中的key参数填入界面

// ==UserScript==
// @name         更多搜索引擎
// @namespace    https://sbtool.us.kg
// @license MIT
// @version      1.0
// @description  自动将URL中的key参数填入界面
// @author       🍟
// @match        https://duckduckgo.com/*
// @match        https://chat.deepseek.com/*
// @grant        none
// ==/UserScript==

const configs = {
  'duckduckgo.com': {
    input: '.JRDRiEf5NPKWK43sArdC',
    button: '.aCZEC_jysXHQfHp97pov',
    inputMethod: 'event',
    clickDelay: 400
  },
  'chat.deepseek.com': {
    input: '#chat-input',
    button: '.f286936b',
    inputMethod: 'execCommand',
    clickDelay: 0             
  }
};

(function() {
  'use strict';
  const config = configs[location.host];
  const key = new URLSearchParams(location.search).get('key');
  if (!key) return;
  const input = document.querySelector(config.input);
  const button = document.querySelector(config.button);
      if (config.inputMethod === 'event') {
        input.value = key;
        input.dispatchEvent(new Event('input', { bubbles: true }));
      } else {
        input.focus();
        document.execCommand('insertText', false, key);
      }
      setTimeout(() => button.click(), config.clickDelay);
})();

QingJ © 2025

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