// ==UserScript==
// @name claude-markdown-exporter
// @namespace https://claude.ai/
// @version 2.12
// @description 一个用于导出 Claude AI 对话内容的增强版脚本。支持完整的对话导出,包括文本附件和图片附件
// @author sansan
// @match https://claude.ai/*
// @icon https://www.google.com/s2/favicons?sz=64&domain=claude.ai
// @grant unsafeWindow
// @run-at document-start
// @license GPL-3.0 License
// @downloadURL https://update.greasyfork.icu/scripts/535978/claude-markdown-exporter.user.js
// @updateURL https://update.greasyfork.icu/scripts/535978/claude-markdown-exporter.meta.js
// ==/UserScript==
(function () {
"use strict";
function showNotification(textCount, imageCount) {
if (textCount === 0 && imageCount === 0) return;
const notification = document.createElement("div");
notification.classList.add("custom-notification");
notification.innerHTML = `
附件统计:
文本附件:${textCount} 个
图像附件:${imageCount} 个
`;
const notificationStyle = document.createElement("style");
notificationStyle.textContent = `
.custom-notification {
position: fixed;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
background-color: rgba(0, 0, 0, 0.8);
color: white;
padding: 20px;
border-radius: 10px;
font-family: Arial, sans-serif;
z-index: 100000;
max-width: 90%;
box-sizing: border-box;
}
.custom-notification-content {
margin: 0;
}
.custom-notification-title {
margin: 0;
font-size: 16px;
}
.custom-notification-stats {
margin: 10px 0;
font-size: 14px;
}
`;
document.head.appendChild(notificationStyle);
document.body.appendChild(notification);
setTimeout(() => {
document.body.removeChild(notification);
document.head.removeChild(notificationStyle);
}, 5000);
document.addEventListener("dblclick", function removeNotification(e) {
if (!notification.contains(e.target)) {
document.body.removeChild(notification);
document.head.removeChild(notificationStyle);
document.removeEventListener("click", removeNotification);
}
});
}
/**
* 提取对话内容并转换为 Markdown 格式
* @returns {Promise