DeepSeek Retry Clicker

Automatically clicks retry icon when server is busy on chat.deepseek.com

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Greasemonkey 油猴子Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Userscripts ,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展后才能安装此脚本。

(我已经安装了用户脚本管理器,让我安装!)

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

(我已经安装了用户样式管理器,让我安装!)

// ==UserScript==
// @name         DeepSeek Retry Clicker
// @description  Automatically clicks retry icon when server is busy on chat.deepseek.com
// @match        https://chat.deepseek.com/*
// @version 0.0.1.20250714125247
// @namespace https://greasyfork.org/users/1435046
// ==/UserScript==

(function () {
  'use strict';

function hasServerBusyMessage() {
    return Array.from(document.querySelectorAll('span')).some(span =>
      span.textContent.trim() === 'Server busy, please try again later.' ||
      span.textContent.trim() === 'Check network and retry.'
    );
  }

  function searchAndClickIconButton() {
    for (const div of document.querySelectorAll('div')) {
      const svgPath = div.querySelector('svg path[d^="M12 .5C18.351.5"]');
      if (svgPath) {
        const btn = div.closest('.ds-icon-button');
        if (btn) {
          btn.click();
          break;
        }
      }
    }
  }

  function init() {
    // Run once immediately
    if (hasServerBusyMessage()) {
      searchAndClickIconButton();
    }
    // Then observe all future changes
    new MutationObserver(() => {
      if (hasServerBusyMessage()) {
        searchAndClickIconButton();
      }
    }).observe(document.body, { childList: true, subtree: true });
  }

  document.addEventListener('DOMContentLoaded', init);
})();