将数字等级变为下标。修复无法修改角色的错误。
This commit is contained in:
parent
6c170d6100
commit
4e01c08b5e
|
@ -20,7 +20,7 @@
|
|||
{name: "CSS selector: :not() / CSS选择器: :not()", version:{firefox:84,chrome:88,safari:9}, url: "https://caniuse.com/css-not-sel-list", test: ()=>supportsPseudoClass(":not(html)")},
|
||||
//{name: "CSS selector: :has() / CSS选择器: :has()", version:{firefox:121,chrome:105,safari:15.4}, url: "https://caniuse.com/css-has", test: ()=>supportsPseudoClass(":has(html)")},
|
||||
{name: "Private class fields (#name) / 类私有域(#name)", version:{firefox:90,chrome:74,safari:14.5}, url: "https://caniuse.com/mdn-javascript_classes_private_class_fields", test: ()=>Boolean(runCodeWithFunction("class test {#v = 0;}, true"))},
|
||||
{name: "Dialog element / Dialog 元素", version:{firefox:98,chrome:37,safari:15.4}, url: "https://caniuse.com/dialog", test: ()=>Boolean(eval("HTMLDialogElement"))},
|
||||
{name: "Dialog element / Dialog 元素", version:{firefox:98,chrome:37,safari:15.4}, url: "https://caniuse.com/dialog", test: ()=>Boolean(window.HTMLDialogElement)},
|
||||
// {name: "Class static initialization blocks / 静态初始化块", version:{firefox:93,chrome:94,safari:16.4}, url: "https://caniuse.com/mdn-javascript_classes_static_initialization_blocks", test: ()=>supportsPseudoClass(":not(html)")},
|
||||
]
|
||||
return features.filter(feature=>{
|
||||
|
|
|
@ -192,7 +192,7 @@ function BigNumberToStringLocalise(separators, splitDigits = 3 ) {
|
|||
const grouping = 10 ** splitDigits;
|
||||
separators = separators.map(s=>s.toString());
|
||||
|
||||
return function(){
|
||||
return function(options = {}){
|
||||
const thisValue = this.valueOf();
|
||||
if (thisValue === 0 ||
|
||||
thisValue === Infinity ||
|
||||
|
@ -213,13 +213,25 @@ function BigNumberToStringLocalise(separators, splitDigits = 3 ) {
|
|||
numLevels.push(numTemp);
|
||||
}
|
||||
|
||||
let outStr = thisValue < 0 ? '-' : '';
|
||||
for (let i = numLevels.length; i--; ) {
|
||||
if (numLevels[i] > 0)
|
||||
outStr += numLevels[i].toString(10) + separators[i];
|
||||
if (options?.sub) {
|
||||
let outFragment = document.createDocumentFragment();
|
||||
if (thisValue < 0) outFragment.append('-');
|
||||
for (let i = numLevels.length; i--; ) {
|
||||
if (numLevels[i] > 0) {
|
||||
const separator = document.createElement("sub");
|
||||
separator.textContent = separators[i];
|
||||
outFragment.append(numLevels[i].toString(10), separator);
|
||||
}
|
||||
}
|
||||
return outFragment;
|
||||
} else {
|
||||
let outStr = thisValue < 0 ? '-' : '';
|
||||
for (let i = numLevels.length; i--; ) {
|
||||
if (numLevels[i] > 0)
|
||||
outStr += numLevels[i].toString(10) + separators[i];
|
||||
}
|
||||
return outStr;
|
||||
}
|
||||
|
||||
return outStr;
|
||||
}
|
||||
}
|
||||
Number.prototype.bigNumberToString = BigNumberToStringLocalise(['', 'K ', 'M ', 'G ', 'T ', 'P ', 'E ', 'Z ', 'Y ', 'R ', 'Q '], 3);
|
||||
|
|
25
script.js
25
script.js
|
@ -5431,7 +5431,8 @@ function initialize() {
|
|||
level: level
|
||||
};
|
||||
const needExpArr = calculateExp(tempMon);
|
||||
monLvExp.textContent = needExpArr ? needExpArr.map(exp=>exp.bigNumberToString()).join(" + ") : "";
|
||||
monLvExp.innerHTML = '';
|
||||
if (needExpArr) monLvExp.append(needExpArr.map(exp=>exp.bigNumberToString({sub: true})).nodeJoin(" + "));
|
||||
}
|
||||
editBox.reCalculateExp = reCalculateExp;
|
||||
//三维
|
||||
|
@ -5682,7 +5683,7 @@ function initialize() {
|
|||
if (teamTotalInfoDom) refreshTeamTotalHP(teamTotalInfoDom, teamData, editBox.memberIdx[0]);
|
||||
|
||||
const teamTotalInfoCountDom = teamBigBox.querySelector(".team-total-info-count"); //队伍星级、属性、类型合计
|
||||
if (teamTotalInfoCountDom) refreshTeamTotalCount(teamTotalInfoCountDom, teamData, teamNum);
|
||||
if (teamTotalInfoCountDom) refreshTeamTotalCount(teamTotalInfoCountDom, teamData, editBox.memberIdx[0]);
|
||||
|
||||
const formationTotalInfoDom = formationBox.querySelector(".formation-total-info"); //所有队伍能力值合计
|
||||
if (formationTotalInfoDom) refreshFormationTotalHP(formationTotalInfoDom, formation.teams);
|
||||
|
@ -7225,11 +7226,17 @@ function refreshMemberAwoken(memberAwokenDom, assistAwokenDom, team, idx) {
|
|||
});
|
||||
}
|
||||
|
||||
function setTextContentAndAttribute(dom,str)
|
||||
function setTextContentAndAttribute(dom, str, number)
|
||||
{
|
||||
if (!dom) return;
|
||||
dom.textContent = str;
|
||||
dom.setAttribute(dataAttrName, str);
|
||||
if (typeof str == "string") {
|
||||
dom.textContent = str;
|
||||
}
|
||||
else {
|
||||
dom.innerHTML = '';
|
||||
dom.append(str);
|
||||
}
|
||||
dom.setAttribute(dataAttrName, number ?? str);
|
||||
}
|
||||
|
||||
function drawHpInfo(hpBarDom, reduceAttrRanges)
|
||||
|
@ -7354,12 +7361,12 @@ function refreshTeamTotalHP(totalDom, team, teamIdx) {
|
|||
const tHpDom_noAwoken = tHpDom.querySelector(".awoken-bind");
|
||||
const tHpDom_reduce = tHpDom.querySelector(".reduce");
|
||||
|
||||
setTextContentAndAttribute(tHpDom_general, tHP.bigNumberToString());
|
||||
setTextContentAndAttribute(tHpDom_noAwoken, tHPNoAwoken.bigNumberToString());
|
||||
setTextContentAndAttribute(tHpDom_general, tHP.bigNumberToString({sub: true}));
|
||||
setTextContentAndAttribute(tHpDom_noAwoken, tHPNoAwoken.bigNumberToString({sub: true}));
|
||||
tHpDom_reduce.classList.toggle("no-reduce", totalReduce == 0);
|
||||
setTextContentAndAttribute(tHpDom_reduce.querySelector(".reduce-scale"), (totalReduce * 100).toFixed(2));
|
||||
setTextContentAndAttribute(tHpDom_reduce.querySelector(".general"), tReduceHP.bigNumberToString());
|
||||
setTextContentAndAttribute(tHpDom_reduce.querySelector(".awoken-bind"), tReduceHPNoAwoken.bigNumberToString());
|
||||
setTextContentAndAttribute(tHpDom_reduce.querySelector(".general"), tReduceHP.bigNumberToString({sub: true}));
|
||||
setTextContentAndAttribute(tHpDom_reduce.querySelector(".awoken-bind"), tReduceHPNoAwoken.bigNumberToString({sub: true}));
|
||||
}
|
||||
|
||||
if (tSBDom) {
|
||||
|
|
Loading…
Reference in New Issue