Load Claude-chan onto any page把 Claude-chan 加载到任意网页

Full version = sprites (default). Every method below loads the real sprite art: 21 hand-drawn poses and 15 motions, fetched from the base URL (or embedded in the inline build). Simplified version = a code-drawn stand-in that appears only if the sprites cannot be loaded, or when you ask for it with simplified:true. It has fewer expressions/poses and no real art.

完整版 = 精灵图(默认)。下面每种方式都会加载真正的精灵图:21 个手绘姿势和 15 个动作,从基础地址获取(内嵌版则直接内置)。简化版 = 代码绘制的替身,只有在精灵图无法加载时才会出现,或当你用 simplified:true 主动要求时。它的表情和姿势更少,也没有真正的美术。

  • The simplified version lacks: the 21 hand-drawn poses (idea, giggle, cheer, typing, explain, away, ...), the real anime art (it is a plain code-drawn figure), and the sprite cross-fades. It only tilts, blinks, moves brows, mouth and arms.简化版缺少:21 个手绘姿势(灵感、咯咯笑、欢呼、打字、讲解、离开等)、真正的动漫美术(只是简单的代码绘制人物)以及精灵图的淡入淡出。它只会倾斜、眨眼、动眉毛、嘴和手臂。
  • How to tell: after loading, claudeChan.renderer is "sprites" (full) or "simplified", claudeChan.isSimplified is true/false, and claudeChan.help() prints it. If the sprites fail, the console shows claude-chan: sprites could not be loaded from …; showing the SIMPLIFIED code-drawn version.如何判断:加载后 claudeChan.renderer 为 "sprites"(完整)或 "simplified"(简化),claudeChan.isSimplified 为 true/false,claudeChan.help() 也会打印。精灵图加载失败时,控制台会显示 claude-chan: sprites could not be loaded from …; showing the SIMPLIFIED code-drawn version。
  • Live2D (optional): set window.claudeChanConfig = { renderer: "live2d", model: "https://…/claude-chan.model3.json" } before loading. Only then are the Cubism Core (official Live2D CDN) and the Live2D runtime fetched; if anything fails she shows the sprites. See docs/LIVE2D.md.Live2D(可选):加载前设置 window.claudeChanConfig = { renderer: "live2d", model: "https://…/claude-chan.model3.json" }。只有这样才会获取 Cubism Core(Live2D 官方 CDN)和 Live2D 运行库;任何部分失败都会显示精灵图。见 docs/LIVE2D.md。

Pick one way below: a console line, a bookmark, or a userscript. Every snippet already uses the base URL from the field, so it is ready to copy.

下面任选一种方式:控制台一行代码、书签或用户脚本。每段代码都已经填好了上方输入框里的基础地址,可以直接复制。

1. Console (script hot-load)1. 控制台(脚本热加载)

Open the page where you want her, press F12 (or Ctrl+Shift+J / Cmd+Option+J), open the Console tab, paste this line and press Enter:

打开要放她的网页,按 F12(或 Ctrl+Shift+J / Cmd+Option+J),切到 Console(控制台) 标签,粘贴下面这行并回车:

document.head.append(Object.assign(document.createElement('script'),{src:'https://kmaj1st.github.io/claude-chan/hotload/loader.js'}))

Or as a module import (also works where document.head is missing):

或者用模块导入(在没有 document.head 的页面也能用):

import('https://kmaj1st.github.io/claude-chan/hotload/loader.js')

2. Bookmarklet2. 书签

Drag this button to your bookmarks bar (show it with Ctrl+Shift+B). Click the bookmark on any page to add Claude-chan; click it again to remove her.

把这个按钮拖到书签栏(Ctrl+Shift+B 显示书签栏)。在任意网页点击该书签即可加入 Claude-chan,再点一次移除。

Claude-chan

If dragging does not work: create a new bookmark and paste this code into its URL field.

如果拖不动:新建一个书签,把下面的代码粘贴到网址栏。

javascript:(()=>{const c=window.claudeChan;if(window.__claudeChanLoader&&c&&c.unload){c.unload();return}const s=document.createElement("script");s.src="https://kmaj1st.github.io/claude-chan/hotload/loader.js";s.onerror=()=>alert("claude-chan: could not load "+s.src+" (blocked by this site's Content-Security-Policy? See docs/HOT-LOAD.md)");(document.head||document.documentElement).appendChild(s)})()

3. Userscript (every page, automatically)3. 用户脚本(每个网页自动加载)

Install Tampermonkey or Violentmonkey, then open one of these links; the manager offers to install it:

先安装 Tampermonkey 或 Violentmonkey 扩展,再打开下面的链接,扩展会弹出安装页面:

4. Sites with a strict Content-Security-Policy4. 内容安全策略(CSP)严格的网站

Some sites (for example GitHub) only allow their own scripts. Symptom: nothing appears, the console shows Refused to load the script … because it violates the following Content Security Policy directive, and the bookmarklet shows an alert.

有些网站(例如 GitHub)只允许自己的脚本。现象:什么都没出现,控制台显示 Refused to load the script … Content Security Policy,书签会弹出提示。

5. Options and console commands5. 选项与控制台命令

Set options before loading, as window.claudeChanConfig or as data-* attributes on the script tag:

在加载前设置选项:用 window.claudeChanConfig,或在 script 标签上写 data-* 属性:

window.claudeChanConfig = { position: 'bottom-right', dock: 'free', size: 180, zIndex: 2147483000, simplified: false };
document.head.append(Object.assign(document.createElement('script'),{src:'https://kmaj1st.github.io/claude-chan/hotload/loader.js'}))
<script src="https://kmaj1st.github.io/claude-chan/hotload/loader.js" data-position="bottom-right" data-size="180"></script>

Console commands once she is loaded:

加载后可在控制台使用:

claudeChan.help()                  // list of commands
claudeChan.hide()                  // hide for this page load
claudeChan.hide({ persist: true }) // stay hidden after reloads (until show())
claudeChan.show()                  // show again
claudeChan.toggle()                // hide/show, returns true when visible
claudeChan.setPosition(0.8, 0.9)   // fractions 0..1 of the window (numbers > 1 are px)
claudeChan.resetPosition()         // back to the home corner
claudeChan.unload()                // remove her completely
claudeChan.unload({ forget: true }) // also forget the stored position
claudeChan.renderer                // "sprites" (full version), "live2d" (Cubism model) or "simplified"

6. Troubleshooting6. 故障排查

More: docs/HOT-LOAD.md.

更多内容:docs/HOT-LOAD.md。