webxoss-client/ImageAndDetail.min.js

1 line
6.5 KiB
JavaScript
Raw Normal View History

2016-10-23 07:28:51 +02:00
"use strict";window.ImageManager=function(){function e(e){var t=new Image;return t.src=e,t}function t(t){this.dir=t||"./",this.black=e(this.dir+"images/WIXOSS_BLACK.jpg"),this.white=e(this.dir+"images/WIXOSS_WHITE.jpg"),this.noimage=e(this.dir+"images/noimage.jpg"),this.imageCache={},this.stateImageMap={frozen:e(this.dir+"background/frozen.png"),charm:e(this.dir+"background/charm.png"),lancer:e(this.dir+"background/lancer.png"),doubleCrash:e(this.dir+"background/doubleCrash.png"),locked:e(this.dir+"background/locked.png"),assassin:e(this.dir+"background/assassin.png")}}return t.prototype.getUrlByPid=function(e){var t=window.ImageFileCache.getUrlByPid(e);return t?t:(t=this.dir+"images/"+("0000"+e).slice(-4)+".jpg",window.ImageFileCache.fetchAndCache(e,t),t)},t.prototype.getImageByPid=function(t){if(!t)return this.noimage;if(t in this.imageCache)return this.imageCache[t];var i=this.getUrlByPid(t),a=e(i);return this.imageCache[t]=a,a},t.prototype.getBackImage=function(e){return e?this.white:this.black},t.prototype.getStateImage=function(e){return this.stateImageMap[e]},t}(),window.CardDetail=function(){function e(e){return document.getElementById(e)}function t(e){for(var t=document.createElement(e),i=1;i<arguments.length;i++)t.classList.add(arguments[i]);return t}function i(e,i){this.prop=e,this.keyHidden=i,this.value="",this.eKey=t("td","key",e),this.eKey.textContent=Localize.propToKey(e),this.eValue=t("td","value",e)}function a(t){this.imageManager=t,this.eDetail=e("detail"),this.eImage=e("detail-card-image"),this.eWxid=e("detail-card-wxid"),this.eName=e("detail-card-name"),this.eLimiting=e("detail-card-limiting"),this.eTable=e("detail-table"),this.eTableBody=e("detail-table-body"),this.kvCardType=new i("cardType"),this.kvColor=new i("color"),this.kvLevel=new i("level"),this.kvClasses=new i("classes"),this.kvLimit=new i("limit"),this.kvPower=new i("power"),this.kvLimting=new i("limting"),this.kvGuard=new i("guard"),this.kvCost=new i("cost"),this.kvTimmings=new i("timmings"),this.kvEffects=new i("effects",!0),this.kvBurst=new i("burst",!0),this._pid=0}return a.prototype.show=function(e){if(e&&this._pid!==e){this._pid=e,this.eTable.setAttribute("lang",Localize.getLanguage()),this.eTableBody.innerHTML="";var i=CardInfo[e];this.eWxid.textContent=i.wxid,this.eName.innerHTML="";var a=t("a");a.target="_blank",a.href="http://www.takaratomy.co.jp/products/wixoss/card/card_list.php?card=card_detail&card_no="+i.wxid,a.textContent=Localize.cardName(i),this.eName.appendChild(a),this.eLimiting.textContent=Localize.limiting(i),this.eImage.src=this.imageManager.getUrlByPid(e),this.kvColor.value=i.color.split("/").map(Localize.color).join("/"),this.kvCardType.value=Localize.cardType(i),this.kvEffects.value=Localize.effectTexts(i),inArr(i.cardType,["LRIG","SIGNI","RESONA"])&&(this.kvClasses.value=Localize.classes(i),this.kvLevel.value=i.level),inArr(i.cardType,["LRIG","SPELL","ARTS"])&&(this.kvCost.value=Localize.cost(i)),inArr(i.cardType,["SIGNI","SPELL"])&&(this.kvBurst.value=Localize.burstEffectTexts(i)),"LRIG"===i.cardType?(i.limit>=1024?this.kvLimit.value="∞":this.kvLimit.value=i.limit,this.addKeyValue([this.kvCardType,this.kvColor],[this.kvLevel,this.kvClasses],[this.kvLimit,this.kvCost],[this.kvEffects])):"SIGNI"===i.cardType?(this.kvPower.value=i.power,this.kvGuard.value=Localize.guard(i),this.addKeyValue([this.kvCardType,this.kvColor],[this.kvLevel,this.kvClasses],[this.kvPower,this.kvGuard],[this.kvEffects],[this.kvBurst])):"RESONA"===i.cardType?(this.kvPower.value=i.power,this.kvGuard.value=Localize.guard(i),this.addKeyValue([this.kvCardType,this.kvColor],[this.kvLevel,this.kvClasses],[this.kvPower,this.kvGuard],[this.kvEffects])):"SPELL"===i.cardType?this.addKeyValue([this.kvCardType,this.kvColor],[this.kvCost],[this.kvEffects],[this.kvBurst]):"ARTS"===i.cardType&&(this.kvTimmings.value=Localize.timmings(i),this.addKeyValue([this.kvCardType,this.kvColor],[this.kvCost],[this.kvTimmings],[this.kvEffects]))}},a.prototype.addKeyValue=function(){for(var e=0;e<arguments.length;e++){var i=arguments[e],a=t("tr");if(i.forEach(functio