您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
Adds a confirmation dialog when clicking the Cancel button when editing messages
- // ==UserScript==
- // @name ChatGPT Edit Cancel Confirmation
- // @namespace https://github.com/GooglyBlox
- // @version 1.0
- // @description Adds a confirmation dialog when clicking the Cancel button when editing messages
- // @author GooglyBlox
- // @match https://chatgpt.com/*
- // @grant none
- // @license MIT
- // ==/UserScript==
- (function() {
- 'use strict';
- function handleCancelClick(event) {
- const target = event.target.closest('button');
- if (target &&
- target.classList.contains('btn-secondary') &&
- target.textContent.trim() === 'Cancel') {
- event.stopPropagation();
- event.preventDefault();
- if (confirm('Are you sure you want to cancel?')) {
- document.removeEventListener('click', handleCancelClick, true);
- target.click();
- setTimeout(() => {
- document.addEventListener('click', handleCancelClick, true);
- }, 0);
- }
- }
- }
- document.addEventListener('click', handleCancelClick, true);
- })();