Greasy Fork

Greasy Fork is available in English.

Export Claude.Ai v1.1-miniaturized

Download the conversation with Claude; works now on small screens.

当前为 2023-11-01 提交的版本,查看 最新版本

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

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

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

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

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

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

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

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

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

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

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

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

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

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

// ==UserScript==
// @name     Export Claude.Ai v1.1-miniaturized
// @description Download the conversation with Claude; works now on small screens. 
// @version  1.1-mini
// @author   TheAlanK & SAPIENT
// @grant    none
// @match    *://claude.ai/*
// @namespace https://github.com/TheAlanK
// @license MIT
// ==/UserScript==

function getTextByClass(className) {
    var elements = document.getElementsByClassName(className);
    var result = [];

    for (var i = 0; i < elements.length; i++) {
        // Clone the node to not affect the original element
        var clone = elements[i].cloneNode(true);

        // Remove all SVG and button elements
        var unwantedElements = clone.querySelectorAll('svg, button');
        for (var j = 0; j < unwantedElements.length; j++) {
            unwantedElements[j].remove();
        }

        // Add cleaned text to the result
        result.push(clone.innerText.trim());
    }

    return result.join("\n");
}


function addButton() {
    var button = document.createElement("button");
    button.innerHTML = `Export`;
    button.style.cssText = `
        position: fixed;
        bottom: 10px;
        right: 10px;
        padding: 2px 4px;
        background-color: #4CAF50; /* Green */
        border: none;
        color: white;
        text-align: center;
        text-decoration: none;
        display: inline-block;
        font-size: 11px;
        cursor: pointer;
        border-radius: 4px;
        z-index: 999;
    `;

    button.addEventListener ("click", function() {
        var text = getTextByClass('col-start-2');
        var blob = new Blob([text], {type: "text/plain;charset=utf-8"});
        var url = URL.createObjectURL(blob);

        var link = document.createElement("a");
        link.download = 'extracted.txt';
        link.href = url;
        link.click();
    });

    document.body.appendChild(button);
}

addButton();