1// Note: the LIVE_2D_PATH parameter should use absolute path 2// const LIVE_2D_PATH = "https://cdn.jsdelivr.net/gh/stevenjoezhang/live2d-widget@latest/"; 3// change this path to Michael's path 4const LIVE_2D_PATH = "https://michael18811380328.github.io/resource/waifu/"; 5const API_PAH = "https://live2d.fghrsh.net/api/"; 6const CDN_PATH = "https://cdn.jsdelivr.net/gh/fghrsh/live2d_api/"; 7 8/** 9 * Load external resources asynchronously 10 * @param {resource url} url 11 * @param {file type} type 12 * @returns null 13 */ 14function loadExternalResource(url, type) { 15 return new Promise((resolve, reject) => { 16 let tag; 17 if (type === "css") { 18 tag = document.createElement("link"); 19 tag.rel = "stylesheet"; 20 tag.href = url; 21 } 22 if (type === "js") { 23 tag = document.createElement("script"); 24 tag.src = url; 25 } 26 if (tag) { 27 tag.onload = () => resolve(url); 28 tag.onerror = () => reject(url); 29 document.head.appendChild(tag); 30 } 31 }); 32} 33 34// In desktop, load resource and init live_2d (çæ¿å¨) 35if (screen.width >= 768) { 36 Promise.all([ 37 loadExternalResource(LIVE_2D_PATH + "waifu.css", "css"), 38 loadExternalResource(LIVE_2D_PATH + "live2d.min.js", "js"), 39 loadExternalResource(LIVE_2D_PATH + "waifu-tips.js", "js") 40 ]).then(() => { 41 // note: in recent waifu-tips, initWidget parameters is changed to 42 // initWidget(config, apiPath) 43 initWidget({ 44 waifuPath: LIVE_2D_PATH + "waifu-tips.json", 45 //apiPath: API_PAH, 46 cdnPath: CDN_PATH, 47 }); 48 }); 49}
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.