diff --git a/game/game.js b/game/game.js index 1c3795ede..df4c0ae2c 100644 --- a/game/game.js +++ b/game/game.js @@ -428,7 +428,7 @@ else{ map.round_menu_func.show(); } - if(lib.device=='ios'||lib.device=='android'){ + if(!lib.node&&lib.device!='ios'){ map.confirm_exit.show(); } else{ @@ -3760,6 +3760,415 @@ } }, init:{ + bind:function(){ + HTMLDivElement.prototype.animate=function(name,time){ + var that; + if(lib.isMobileMe(this)&&name=='target'){ + that=ui.mebg; + } + else{ + that=this; + } + that.classList.add(name); + setTimeout(function(){ + that.classList.remove(name); + },time||1000); + return this; + }; + HTMLDivElement.prototype.hide=function(){ + this.classList.add('hidden'); + return this; + }; + HTMLDivElement.prototype.unfocus=function(){ + this.classList.add('transparent'); + return this; + }; + HTMLDivElement.prototype.refocus=function(){ + this.classList.remove('transparent'); + return this; + }; + HTMLDivElement.prototype.show=function(){ + this.classList.remove('hidden'); + return this; + }; + HTMLDivElement.prototype.delete=function(time,callback){ + if(this.timeout){ + clearTimeout(this.timeout); + delete this.timeout; + } + if(!this._listeningEnd||this._transitionEnded){ + if(typeof time!='number') time=500; + this.classList.add('removing'); + var that=this; + this.timeout=setTimeout(function(){ + that.remove(); + that.classList.remove('removing'); + if(typeof callback=='function'){ + callback(); + } + },time); + } + else{ + this._onEndDelete=true; + } + return this; + }; + HTMLDivElement.prototype.goto=function(position,time){ + if(this.timeout){ + clearTimeout(this.timeout); + delete this.timeout; + } + + if(typeof time!='number') time=500; + this.classList.add('removing'); + + var that=this; + this.timeout=setTimeout(function(){ + position.appendChild(that); + that.classList.remove('removing'); + delete that.destiny; + },time); + this.destiny=position; + return this; + }; + HTMLDivElement.prototype.fix=function(){ + clearTimeout(this.timeout); + delete this.timeout; + delete this.destiny; + this.classList.remove('removing'); + return this; + }; + HTMLDivElement.prototype.setBackground=function(name,type,ext,subfolder){ + var src; + ext=ext||'.jpg'; + subfolder=subfolder||'default' + if(type){ + var dbimage=null,extimage=null,modeimage=null; + var nameinfo; + var mode=get.mode(); + if(type=='character'){ + if(lib.characterPack['mode_'+mode]&&lib.characterPack['mode_'+mode][name]){ + modeimage=mode; + } + else if(lib.character[name]){ + nameinfo=lib.character[name]; + } + } + if(!modeimage&&nameinfo&&nameinfo[4]){ + for(var i=0;i0) top+='+ '+position[1]+'px)'; + else top+='- '+Math.abs(position[1])+'px)'; + var left='calc('+position[2]+'% '; + if(position[3]>0) left+='+ '+position[3]+'px)'; + else left+='- '+Math.abs(position[3])+'px)'; + this.style.top=top; + this.style.left=left; + return this; + }; + HTMLDivElement.prototype.css=function(style){ + for(var i in style){ + if(i=='innerHTML'){ + this.innerHTML=style[i]; + } + else{ + this.style[i]=style[i]; + } + } + return this; + }; + HTMLDivElement.prototype.transform=function(transform){ + var str=''; + for(var i in transform){ + switch(i){ + case 'scale':str+='scale('+transform[i]+') ';break; + case 'rotate':str+='rotate('+transform[i]+'deg) ';break; + } + } + if(typeof transform=='object'){ + if(transform.left&&transform.top){ + str+='translate('+parseInt(transform.left)+'px,'+parseInt(transform.top)+'px) '; + } + else if(transform.left){ + str+='translate('+parseInt(transform.left)+'px) '; + } + else if(transform.top){ + str+='translate(0,'+parseInt(transform.top)+'px) '; + } + } + this.style.transform=str; + return this; + }; + HTMLTableElement.prototype.get=function(row,col){ + if(rowthis.length){ + num=this.length; + } + var arr=this.slice(0); + var list=[]; + for(var i=0;i.dialog.popped:not(.static)'); + for(var i=0;i0) top+='+ '+position[1]+'px)'; - else top+='- '+Math.abs(position[1])+'px)'; - var left='calc('+position[2]+'% '; - if(position[3]>0) left+='+ '+position[3]+'px)'; - else left+='- '+Math.abs(position[3])+'px)'; - this.style.top=top; - this.style.left=left; - return this; - }; - HTMLDivElement.prototype.css=function(style){ - for(var i in style){ - if(i=='innerHTML'){ - this.innerHTML=style[i]; - } - else{ - this.style[i]=style[i]; - } - } - return this; - }; - HTMLDivElement.prototype.transform=function(transform){ - var str=''; - for(var i in transform){ - switch(i){ - case 'scale':str+='scale('+transform[i]+') ';break; - case 'rotate':str+='rotate('+transform[i]+'deg) ';break; - } - } - if(typeof transform=='object'){ - if(transform.left&&transform.top){ - str+='translate('+parseInt(transform.left)+'px,'+parseInt(transform.top)+'px) '; - } - else if(transform.left){ - str+='translate('+parseInt(transform.left)+'px) '; - } - else if(transform.top){ - str+='translate(0,'+parseInt(transform.top)+'px) '; - } - } - this.style.transform=str; - return this; - }; - HTMLTableElement.prototype.get=function(row,col){ - if(rowthis.length){ - num=this.length; - } - var arr=this.slice(0); - var list=[]; - for(var i=0;i.dialog.popped:not(.static)'); - for(var i=0;i