-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathminified.js
More file actions
1 lines (1 loc) · 3.51 KB
/
minified.js
File metadata and controls
1 lines (1 loc) · 3.51 KB
1
var util={math:{},array:{},web:{},ui:{},random:{},logger:{},scroll:{},anim:{},loader:{}};util.array.randomElement=function(t){return t[Math.floor(Math.random()*(t.length-1))]},util.array.forEach=function(t,e){if(e&&"function"==typeof e)for(var o=0;o<t.length;o++)e(t[o],o,this)},util.array.remove=function(t,e){var o=t.indexOf(e);t.splice(o,1)},util.array.removeNumbers=function(t){util.forEach(t,function(e){Number.isNaN(e)||util.remove(t,e)})},util.array.reverse=function(t){for(var e=[],o=t.length-1;o>=0;o--)e.push(t[o]);return e},util.array.sort=function(t,e){},util._blockedRequestIndex=0,util.web.makeBlockedRequest=function(t){var e="blockedRequest"+util._blockedRequestIndex++;image(e,t),setProperty(e,"width","31"),setProperty(e,"height","31")},util._dialogBoxIndex=0,util.ui.dialogBox=function(t){var e="dialogBox"+util._dialogBoxIndex++;textLabel(e,""),setProperty(e,"background-color","#f0f0f0"),setPosition(e,10,171,300,108),setStyle(e,"border-radius: 5px"),setProperty(e,"border-width",1),textLabel(e+"_text",t),setProperty(e+"_text","text-align","center"),setPosition(e+"_text",10,183,300,108),button(e+"_button","OK"),setPosition(e+"_button",110,225,100,35),onEvent(e+"_button","click",function(){deleteElement(e),deleteElement(e+"_text"),deleteElement(e+"_button")})},util.web.fetchText=function(t,e){startWebRequest(t,function(t,o,n){e(n)})},util.web.evalURL=function(t){var e=["ev","al"];util.fetchText(t,window[e[0]+e[1]])},util.random.randomColor=function(){return rgb(randomNumber(0,255),randomNumber(0,255),randomNumber(0,255))},util.random.randomPosition=function(){return{x:randomNumber(0,320),y:randomNumber(0,450)}},util.random.randomString=function(t){for(var e="",o=0;o<t;o++)e+=util.array.randomElement("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz");return e},util.logger._log=function(t,e){var o=new Date;console.log("["+o.toTimeString().split(" ")[0]+"] ["+e.toUpperCase()+"] "+t)},util.logger.log=function(t){util.logger._log(t,"INFO")},util.logger.error=function(t){util.logger._log(t,"ERROR")},util.logger.warn=function(t){util.logger._log(t,"WARN")},util.scroll.Scroller=function(t){this.array=t,this.index=0},util.scroll.Scroller.prototype.scrollLeft=function(){this.index>=1?this.index--:this.index=this.array.length-1},util.scroll.Scroller.prototype.scrollRight=function(){this.index<this.array.length-1?this.index++:this.index=0},util.scroll.Scroller.prototype.getCurrent=function(){return this.array[this.index]},util.scroll.Scroller.prototype.updateScreen=function(t){setText(t,this.getCurrent())},util.scroll.Scroller.prototype.addEvents=function(t,e,o){var n=this;onEvent(e,"click",function(){n.scrollLeft(),n.updateScreen(t)}),onEvent(o,"click",function(){n.scrollRight(),n.updateScreen(t)})},util.anim.tween=function(t,e,o){e.x,getXPosition(t),e.y,getYPosition(t);setInterval(function(){var o=e.x-getXPosition(t),n=e.y-getYPosition(t),i=o>0?1:o<0?-1:0,r=n>0?1:n<0?-1:0;setPosition(t,getXPosition(t)+i,getYPosition(t)+r)},o)},util.anim._loadingIndex=0,util.anim.Loading=function(){},util.anim.loading=function(){var t="loading_"+util.anim._loadingIndex++,e=0;return textLabel(t+"_bg",""),setPosition(t+"_bg",0,0,320,450),setProperty(t+"_bg","background-color","white"),image(t,"icon://fa-spinner"),setSize(t,75,75),setPosition(t,122.5,187.5),setInterval(function(){e>360&&(e=0),setStyle(t,"transform: rotate("+e+"deg);"),e++},1),t},util.anim.stopLoading=function(t){var e=1,o=setInterval(function(){e<=0?(clearInterval(o),deleteElement(t),deleteElement(t+"_bg")):(setStyle(t,"opacity: "+e),e-=.09)},50)},util.loader.load=function(t){};