Greasy Fork 还支持 简体中文。

NitterCorpusEnv

拾荒小猫控制矩阵 - 基础环境、卡槽状态与本地沙箱固化中枢

Tento skript by neměl být instalován přímo. Jedná se o knihovnu, kterou by měly jiné skripty využívat pomocí meta příkazu // @require https://update.https://greasyfork.l8221706.indevs.in/scripts/579924/1835587/NitterCorpusEnv.js

K instalaci tototo skriptu si budete muset nainstalovat rozšíření jako Tampermonkey, Greasemonkey nebo Violentmonkey.

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

K instalaci tohoto skriptu si budete muset nainstalovat rozšíření jako Tampermonkey nebo Violentmonkey.

K instalaci tohoto skriptu si budete muset nainstalovat rozšíření jako Tampermonkey nebo Userscripts.

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

K instalaci tohoto skriptu si budete muset nainstalovat manažer uživatelských skriptů.

(Už mám manažer uživatelských skriptů, nechte mě ho nainstalovat!)

Advertisement:

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

(Už mám manažer uživatelských stylů, nechte mě ho nainstalovat!)

Advertisement:

// ==UserScript==
// @name         NitterCorpusEnv
// @version      1.2.6_Env
// @description  拾荒小猫控制矩阵 - 基础环境、卡槽状态与本地沙箱固化中枢
// @author       Gemini Collaborator
// @grant        none
// ==/UserScript==

(function(window) {
    'use strict';

    window.NitterEnv = {
        DB_KEY: '',
        HISTORY_KEY: 'rp_asset_history_pool',
        localStore: null,
        assetHistory: [],
        snapshottedBackup: null,
        defaultSlots: [
            { id: 'slot_1', name: '🎭 赛博拾荒者', content: '你是一个专业的推文分析师...' },
            { id: 'slot_2', name: '🎭 语料解构师', content: '提取并精炼以下推文的技术内核...' },
            { id: 'slot_3', name: '🎭 仿生复刻机', content: '克隆以下目标用户的发帖逻辑与语气...' }
        ],

        setup(host, username, metaText, tweets) {
            this.DB_KEY = `rp_corpus_${host}_${username}`;
            let rawStore = localStorage.getItem(this.DB_KEY);
            
            if (!rawStore) {
                this.localStore = {
                    currentPage: 1, lastUrl: "", tweets: [], metaText: metaText, activeSlotId: 'slot_1',
                    slots: JSON.parse(JSON.stringify(this.defaultSlots)),
                    config: { img: true, video: true, stamp: true, hot: true, level: 2, customPrompt: '你是一个专业的推文分析师...' }
                };
            } else {
                this.localStore = JSON.parse(rawStore);
                if (!this.localStore.slots || this.localStore.slots.length === 0) this.localStore.slots = JSON.parse(JSON.stringify(this.defaultSlots));
                if (!this.localStore.config) this.localStore.config = { img: true, video: true, stamp: true, hot: true, level: 2, customPrompt: this.localStore.slots[0].content };
            }

            tweets.forEach(t => {
                let existIndex = this.localStore.tweets.findIndex(old => old.includes(`[BASETEXT]${t.baseText}[/BASETEXT]`) || old.includes(t.baseText));
                if (existIndex !== -1) {
                    let oldBlock = this.localStore.tweets[existIndex];
                    if ((oldBlock.includes('💬评论: 0 | 🔄转推: 0') || !oldBlock.includes('[HOTMETRIC]')) && (t.replyCount !== "0" || t.retweetCount !== "0")) {
                        this.localStore.tweets[existIndex] = t.rawContentBlock;
                    }
                } else { this.localStore.tweets.push(t.rawContentBlock); }
            });
            
            this.localStore.metaText = metaText || this.localStore.metaText;
            this.save();

            try { this.assetHistory = JSON.parse(localStorage.getItem(this.HISTORY_KEY)) || []; } catch(e) { this.assetHistory = []; }
        },

        save() {
            localStorage.setItem(this.DB_KEY, JSON.stringify(this.localStore));
        },

        showToast(title, desc, isErr = false) {
            const container = document.getElementById('rp-toast-container');
            if (!container) return;
            const toast = document.createElement('div');
            toast.className = 'rp-toast';
            if (isErr) toast.style.borderLeftColor = '#f38ba8';
            toast.innerHTML = `<div style="font-weight:bold;margin-bottom:2px;">${title}</div><div style="color:#a6adc8;font-size:10px;">${desc}</div>`;
            container.appendChild(toast);
            setTimeout(() => toast.classList.add('show'), 50);
            setTimeout(() => { toast.classList.remove('show'); setTimeout(() => toast.remove(), 300); }, 3500);
        }
    };
})(window);