mirror of
https://github.com/caojiezi2003/live2d-widget.git
synced 2024-11-10 04:49:47 +00:00
Optimize cdnPath
check
This commit is contained in:
parent
53c1299b4d
commit
7a2f806695
@ -9,8 +9,12 @@ function loadWidget(config) {
|
|||||||
if (typeof cdnPath === "string") {
|
if (typeof cdnPath === "string") {
|
||||||
useCDN = true;
|
useCDN = true;
|
||||||
if (!cdnPath.endsWith("/")) cdnPath += "/";
|
if (!cdnPath.endsWith("/")) cdnPath += "/";
|
||||||
}
|
} else if (typeof apiPath === "string") {
|
||||||
if (!apiPath.endsWith("/")) apiPath += "/";
|
if (!apiPath.endsWith("/")) apiPath += "/";
|
||||||
|
} else {
|
||||||
|
console.error("Invalid initWidget argument!");
|
||||||
|
return;
|
||||||
|
}
|
||||||
localStorage.removeItem("waifu-display");
|
localStorage.removeItem("waifu-display");
|
||||||
sessionStorage.removeItem("waifu-text");
|
sessionStorage.removeItem("waifu-text");
|
||||||
document.body.insertAdjacentHTML("beforeend", `<div id="waifu">
|
document.body.insertAdjacentHTML("beforeend", `<div id="waifu">
|
||||||
@ -252,7 +256,7 @@ function loadWidget(config) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function initWidget(config, apiPath = "/") {
|
function initWidget(config, apiPath) {
|
||||||
if (typeof config === "string") {
|
if (typeof config === "string") {
|
||||||
config = {
|
config = {
|
||||||
waifuPath: config,
|
waifuPath: config,
|
||||||
|
Loading…
Reference in New Issue
Block a user