diff --git a/game/game.js b/game/game.js index 7a110467a..d980edf6a 100644 --- a/game/game.js +++ b/game/game.js @@ -37424,18 +37424,17 @@ var cardname=get.name(cards[i]); var cardnature=get.nature(cards[i]); if(cards[i].name!=cardname||((cardnature||cards[i].nature)&&cards[i].nature!=cardnature)){ - if(!cards[i]._tempName) cards[i]._tempName=ui.create.div('.tempname',cards[i]); var tempname=get.translation(cardname); - cards[i]._tempName.classList[lib.config.cardtempname=='default'?'add':'remove']('vertical'); - cards[i]._tempName.dataset.nature='fire'; + var datasetNature='fire'; if(cardname=='sha'){ if(cardnature) tempname=get.translation(cardnature)+tempname; - if(cardnature=='thunder') cards[i]._tempName.dataset.nature='thunder'; - if(cardnature=='kami') cards[i]._tempName.dataset.nature='kami'; - if(cardnature=='ice') cards[i]._tempName.dataset.nature='ice'; + if(cardnature=='thunder') datasetNature='thunder'; + if(cardnature=='kami') datasetNature='kami'; + if(cardnature=='ice') datasetNature='ice'; } - cards[i]._tempName.innerHTML=lib.config.cardtempname=='default'?get.verticalStr(tempname):tempname; - cards[i]._tempName.tempname=tempname; + var node=ui.create.cardTempName(cards[i],tempname,datasetNature); + var cardtempnameConfig=lib.config.cardtempname; + if(cardtempnameConfig!=='default') node.classList.remove('vertical'); } } var nochess=true; @@ -39749,6 +39748,16 @@ void window.getComputedStyle(node, null).getPropertyValue("opacity"); }, create:{ + cardTempName:function(card,tempName,nature){ + const node=card._tempName||ui.create.div('.tempname',card); + card._tempName=node; + const tempname=get.translation(tempName); + if(lib.config.cardtempname=='default') card._tempName.classList.add('vertical'); + card._tempName.dataset.nature=nature||'wood'; + card._tempName.innerHTML=lib.config.cardtempname=='default'?get.verticalStr(tempname):tempname; + card._tempName.tempname=tempname; + return node; + }, connectRooms:function(list){ ui.rooms=[]; ui.roombase=ui.create.dialog(); @@ -49047,12 +49056,7 @@ lib.setIntro(node); } if(get.position(item)=='j'&&item.viewAs&&item.viewAs!=item.name&&lib.config.cardtempname!='off'){ - node._tempName=ui.create.div('.tempname',node); - var tempname=get.translation(item.viewAs); - if(lib.config.cardtempname=='default') node._tempName.classList.add('vertical'); - node._tempName.dataset.nature='wood'; - node._tempName.innerHTML=lib.config.cardtempname=='default'?get.verticalStr(tempname):tempname; - node._tempName.tempname=tempname; + ui.create.cardTempName(node,item.viewAs,'wood'); } break;