PageSourceSearch

https://mandeleyev.github.io/live2d-widget/autoload.js

js mandeleyev.github.io collected 2026-10-03 09:33:35 UTC 2,015 bytes, 62 lines download raw bytes

1// live2d_path 参数建议使用绝对路径
2//const live2d_path = "https://fastly.jsdelivr.net/gh/stevenjoezhang/live2d-widget@latest/";
3const live2d_path = "/live2d-widget/";
4
5// 封装异步加载资源的方法
6function loadExternalResource(url, type) {
7	return new Promise((resolve, reject) => {
8		let tag;
9
10		if (type === "css") {
11			tag = document.createElement("link");
12			tag.rel = "stylesheet";
13			tag.href = url;
14		}
15		else if (type === "js") {
16			tag = document.createElement("script");
17			tag.src = url;
18		}
19		if (tag) {
20			tag.onload = () => resolve(url);
21			tag.onerror = () => reject(url);
22			document.head.appendChild(tag);
23		}
24	});
25}
26
27// 加载 waifu.css live2d.min.js waifu-tips.js
28if (screen.width >= 768) {
29	Promise.all([
30		loadExternalResource(live2d_path + "waifu.css", "css"),
31		loadExternalResource(live2d_path + "live2d.min.js", "js"),
32		loadExternalResource(live2d_path + "waifu-tips.js", "js")
33	]).then(() => {
34		// 配置选项的具体用法见 README.md
35		initWidget({
36			waifuPath: live2d_path + "waifu-tips.json",
37			apiPath: "https://live2d.fghrsh.net/api/",
38			//cdnPath: "https://fastly.jsdelivr.net/gh/fghrsh/live2d_api/",
39			tools: ["hitokoto", "asteroids", "switch-model", "switch-texture", "photo", "info", "quit"]
40		});
41	});
42}
43
44console.log(`
45  く__,.ヘヽ.        /  ,ー、 〉
46           \ ', !-─‐-i  /  /´
47           /`ー'       L//`ヽ、
48         /   /,   /|   ,   ,       ',
49       イ   / /-‐/  i  L_ ハ ヽ!   i
50        レ ヘ 7イ`ト   レ'ァ-ト、!ハ|   |
51          !,/7 '0'     ´0iソ|    |
52          |.从"    _     ,,,, / |./    |
53          レ'| i>.、,,__  _,.イ /   .i   |
54            レ'| | / k_7_/レ'ヽ,  ハ.  |
55              | |/i 〈|/   i  ,.ヘ |  i  |
56             .|/ /  i:    ヘ!    \  |
57              kヽ>、ハ    _,.ヘ、    /、!
58              !'〈//`T´', \ `'7'ーr'
59              レ'ヽL__|___i,___,ンレ|ノ
60                  ト-,/  |___./
61                  'ï½°'    !_,.:
62`);

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.