add basic css-string-like methods.

This commit is contained in:
Rintim 2023-09-07 19:00:34 +08:00
parent a372091dac
commit 5e4d323615
1 changed files with 10 additions and 2 deletions

View File

@ -32166,10 +32166,18 @@
that._cache.rules=[]; that._cache.rules=[];
that._cache.style=document.createElement("style"); that._cache.style=document.createElement("style");
document.head.append(that._cache.style); document.head.append(that._cache.style);
that._cache.sheet = this.#style.sheet; that._cache.sheet = that._cache.style.sheet;
delete game.dynamicStyle.init; delete game.dynamicStyle.init;
return true; return true;
} },
translate:style=>{
let result=[];
for(const name in style){
result.push(`${name.replace(/([A-Z])/g, match => `-${match.toLowerCase()}`)}: ${style[name]};`);
}
return result.join(" ");
},
generate:(name, style)=>[`${name} {`, game.dynamicStyle.translate(style), "}"].join(" ")
}, },
//Add a background music to the config option //Add a background music to the config option
//在设置选项中添加一首背景音乐 //在设置选项中添加一首背景音乐