🎉 欢迎访问GreasyFork.Org 镜像站!本镜像站由公众号【爱吃馍】搭建,用于分享脚本。联系邮箱📮

Greasy fork 爱吃馍镜像

OpenAI Chat Copy Code Hotkey

Binds the "Alt+C" hotkey to find and click the HTML element with the text "Copy code" on chat.openai.com.

您需要先安裝使用者腳本管理器擴展,如 TampermonkeyGreasemonkeyViolentmonkey 之後才能安裝該腳本。

You will need to install an extension such as Tampermonkey to install this script.

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyUserscripts 後才能安裝該腳本。

你需要先安裝一款使用者腳本管理器擴展,比如 Tampermonkey,才能安裝此腳本

您需要先安裝使用者腳本管理器擴充功能後才能安裝該腳本。

(我已經安裝了使用者腳本管理器,讓我安裝!)

🚀 安装遇到问题?关注公众号获取帮助

公众号二维码

扫码关注【爱吃馍】

回复【脚本】获取最新教程和防失联地址

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

(我已經安裝了使用者樣式管理器,讓我安裝!)

🚀 安装遇到问题?关注公众号获取帮助

公众号二维码

扫码关注【爱吃馍】

回复【脚本】获取最新教程和防失联地址

// ==UserScript==
// @name             OpenAI Chat Copy Code Hotkey
// @namespace        https://userscript.snomiao.com/
// @version          0.0.1
// @description      Binds the "Alt+C" hotkey to find and click the HTML element with the text "Copy code" on chat.openai.com.
// @author           [email protected]
// @match            https://chat.openai.com/*
// @grant            none
// @license          GPL-3.0+
// @contributionURL  https://snomiao.com/donate
// @supportURL       https://github.com/snomiao/userscript.js/issues
// @copyright        2017 - 2023, @snomiao <snomiao.com>
// ==/UserScript==

(function () {
  "use strict";

  document.addEventListener("keydown", function (event) {
    // Check if the pressed key is 'C' and the 'Alt' key is held down
    if (event.key === "c" && event.altKey) {
      // Prevent default action (if any)
      event.preventDefault();

      // Find the HTML element with the text "Copy code"
      const elements = [...document.getElementsByTagName("*")].reverse();
      for (let i = 0; i < elements.length; i++) {
        const element = elements[i];
        if (element.textContent === "Copy code") {
          // Simulate a click event on the element
          element.click();
          break;
        }
      }
    }
  });
})();