Greasy Fork

Greasy Fork is available in English.

Always Hi-Res c.ai Avatars

Always request high-res (400px) user/character avatars all the time instead of mixing in low-res (80px) avatars in some places.

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

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

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

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

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

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

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

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

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

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

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

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

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

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

// ==UserScript==
// @name         Always Hi-Res c.ai Avatars
// @namespace    logan.usw
// @version      1.0.1
// @description  Always request high-res (400px) user/character avatars all the time instead of mixing in low-res (80px) avatars in some places.
// @author       astrov0id
// @match        https://beta.character.ai/*
// @match        https://old.character.ai/*
// @match        https://plus.character.ai/*
// @icon         https://characterai.io/static/favicon_v2.ico
// @run-at       document-idle
// @license      Unlicense
// @grant        none
// ==/UserScript==

(function() {
    'use strict';

    const observer = new MutationObserver(mList => { // set up a mutationobserver to process every new element
        mList.forEach(m => {
            const allimgs = m.target.querySelectorAll("img[src^=\"https://characterai.io/i/80\"]"); // retrieve every low-res avatar image in a new element
            allimgs.forEach(i => { // make every low-res avatar high-res by replacing /i/80 in the img's src with /i/400
                i.src = "https://characterai.io/i/400/" + i.src.slice(28);
                // console.debug(window.location.pathname + ": https://characterai.io/i/80/" + i.src.slice(29) + ' => ' + i.src); // debugging code, disabled in production
            });
        });
    });

    observer.observe(document.body, {attributes: false, childList: true, characterData: false, subtree: true}); // start the mutationobserver
})();