UNPKG

cordova-mobile-app-template

Version:

Simple and fully customizable user interface template. Design for mobile app development on Apache Cordova framework or Ionic / Capacitor Native Runtime. Platforms: Android, iOS.

33 lines (18 loc) 27 kB
/* Bismillah */ /* (v1.7) Create interactive user interfaces with basic programming skills. - Project Site: https://bug7a.github.io/basic.js/ INFORMATION: Started Date: 25 October 2020 Developer: Bugra Ozden Email: bugra.ozden@gmail.com Personal Site: http://bugraozden.com LICENSE: You are free: to Share — to copy, distribute and transmit the work to Remix — to adapt the work to make commercial use of the work https://creativecommons.org/licenses/by/4.0/ Have Fun. */ "use strict";const basic={};basic.startTime=Date.now(),basic.ACTION_COLOR="#689BD2",basic.ACTION2_COLOR="cadetblue",basic.WARNING_COLOR="tomato",basic.ALERT_COLOR="gold",basic.CANCEL_COLOR="lightgray",basic.TEXT_COLOR="#4A4A4A",basic.BACKGROUND_COLOR="whitesmoke",basic.DARK_BACKGROUND_COLOR="#141414",basic.FONT_SIZE=20,basic.BUTTON_WIDTH=130,basic.BUTTON_HEIGHT=50,basic.BUTTON_COLOR=basic.ACTION_COLOR,basic.BUTTON_TEXT_COLOR="rgba(0, 0, 0, 0.65)",basic.TEXTBOX_WIDTH=270,basic.TEXTBOX_HEIGHT=50,basic.LABEL_WIDTH=270,basic.LABEL_HEIGHT="auto",basic.BOX_WIDTH=100,basic.BOX_HEIGHT=100,basic.IMAGE_WIDTH=50,basic.IMAGE_HEIGHT=50,basic.gunler=["Pazar","Pazartesi","Salı","\xc7arşamba","Perşembe","Cuma","Cumartesi"],basic.days=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],basic.aylar=["Ocak","Şubat","Mart","Nisan","Mayıs","Haziran","Temmuz","Ağustos","Eyl\xfcl","Ekim","Kasım","Aralık"],basic.months=["January","February","March","April","May","June","July","August","September","October","November","December"];let page,that="",previousThat="";basic.defaultContainerBox,basic.previousDefaultContainerBox,basic.loopTimer,basic.resizeDetection={},basic.resizeDetection.objectAndFunctionList=[],basic.motionController={},basic.motionController.WITH_MOTION_TIME=50,basic.motionController.DONT_MOTION_TIME=40,basic.start=function(){setDefaultContainerBox(page=new MainBox),page.bodyElement.style.margin="0px",page.bodyElement.style.overflow="hidden",page.mainBox=createBox(0,0,page.width,page.height),that.element.style.position="fixed",that.color="transparent",page.onResize(function(){"function"==typeof page.refreshSize&&page.refreshSize()}),"function"==typeof start&&(start(),basic.afterStart()),"function"!=typeof loop||basic.loopTimer||setLoopTimer(1e3)},basic.afterStart=function(){},basic.print=function(t){console.log(t)};var print=basic.print;basic.random=function(t,e){let i=0;return void 0!=e?e<t?console.log("basic.js: random(): The second parameter (number) must be greater than the first."):i=t+Math.round(Math.random()*(e-t)):console.log("basic.js: random(): Two parameters (numbers) must be sent."),i};var random=basic.random;basic.num=function(t,e="float"){return"float"==e?Math.round(100*parseFloat(t))/100:"integer"==e||"int"==e?parseInt(t):void 0};var num=basic.num;basic.str=function(t){return String(t)};var str=basic.str;basic.isMobile=function(){let t=0,e=navigator.userAgent||navigator.vendor||window.opera;return(/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino|android|ipad|playbook|silk/i.test(e)||/1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-/i.test(e.substr(0,4)))&&(t=1),t};var isMobile=basic.isMobile;basic.go=function(t,e="_self"){return window.open(t,e)};var go=basic.go;basic.twoDigitFormat=function(t){return t<=9&&(t="0"+t),t};var twoDigitFormat=basic.twoDigitFormat;basic.storage={save(t,e){window.localStorage.setItem(t,JSON.stringify(e))},load:t=>JSON.parse(window.localStorage.getItem(t)),remove(t){window.localStorage.removeItem(t)}};var storage=basic.storage;basic.clock={get hour(){return new Date().getHours()},get minute(){return new Date().getMinutes()},get second(){return new Date().getSeconds()},get milisecond(){return new Date().getMilliseconds()}};var clock=basic.clock;basic.date={get year(){return new Date().getFullYear()},get monthNumber(){let t=new Date().getMonth();return++t},get ayAdi(){return basic.aylar[this.monthNumber-1]},get monthName(){return basic.months[this.monthNumber-1]},get dayNumber(){return new Date().getDay()},get gunAdi(){return basic.gunler[this.dayNumber]},get dayName(){return basic.days[this.dayNumber]},get today(){return new Date().getDate()},get now(){return Date.now()}};var date=basic.date;class Basic_UIComponent{constructor(t){this._type=t,this._visible=1,this._displayType="block",this._opacity=1,this._rotate=0,this._motionString="none",this._clickable=0,this._eventFuncList=[]}get containerBox(){return this._containerBox}set containerBox(t){this._containerBox=t}get left(){return parseFloat(this.contElement.style.left)}set left(t){this.contElement.style.right="",this.contElement.style.left=parseFloat(t)+"px"}get top(){return parseFloat(this.contElement.style.top)}set top(t){this.contElement.style.bottom="",this.contElement.style.top=parseFloat(t)+"px"}get right(){return parseFloat(this.contElement.style.right)}set right(t){this.contElement.style.left="",this.contElement.style.right=parseFloat(t)+"px"}get bottom(){return parseFloat(this.contElement.style.bottom)}set bottom(t){this.contElement.style.top="",this.contElement.style.bottom=parseFloat(t)+"px"}get width(){var t=parseFloat(this.contElement.style.width);return isNaN(t)&&(t=parseFloat(this.contElement.offsetWidth)),t}set width(t){"auto"!=t?this.contElement.style.width=parseFloat(t)+"px":console.log("basic.js: .width: The 'auto' property is not supported for this object.")}get height(){var t=parseFloat(this.contElement.style.height);return isNaN(t)&&(t=parseFloat(this.contElement.offsetHeight)),t}set height(t){"auto"!=t?this.contElement.style.height=parseFloat(t)+"px":console.log("basic.js: .height: The 'auto' property is not supported for this object.")}get rotate(){return this._rotate}set rotate(t){this._rotate=parseInt(t),this.contElement.style.transform="rotate("+t+"deg)"}get visible(){return this._visible}set visible(t){this._visible=t,this.contElement.style.display&&"none"!=this.contElement.style.display&&(this._displayType=this.contElement.style.display),this.contElement.style.display=1==t?this._displayType:"none"}get clickable(){return this._clickable}set clickable(t){this._clickable=t,this.contElement.style.pointerEvents=1==t?"auto":"none"}get opacity(){return this._opacity}set opacity(t){this._opacity=t,this.contElement.style.opacity=t}get color(){return this._backgroundColor}set color(t){this._backgroundColor=t,this.contElement.style.backgroundColor=t}get border(){return this._border}set border(t){this._border=t,this.contElement.style.borderWidth=t+"px"}get borderColor(){return this._borderColor}set borderColor(t){this._borderColor=t,this.contElement.style.borderColor=t}get round(){return this._round}set round(t){this._round=t,this.contElement.style.borderRadius=t+"px"}get fontSize(){return this._fontSize}set fontSize(t){this._fontSize=t,this.element.style.fontSize=t+"px"}get textSize(){return this._fontSize}set textSize(t){this._fontSize=t,this.element.style.fontSize=t+"px"}get textColor(){return this._textColor}set textColor(t){this._textColor=t,this.element.style.color=t}get textAlign(){return this._textAlign}set textAlign(t){this._textAlign=t,this.element.style.textAlign=t}center(t){basic.moveToCenter(this,t)}aline(t,e,i=0,n){basic.moveToAline(this,t,e,i,n)}remove(){this.contElement.remove()}prop(t){basic.setProparties(this,t)}_addEventListener(t,e,i){let n=this;var o=function(t){e(n,t)};i.addEventListener(t,o);var s={};s.eventName=t,s.originalFunc=e,s.func=o,s.element=i,this._eventFuncList.push(s)}_removeEventListener(t,e,i){for(var n=null,o=0;o<this._eventFuncList.length;o++)if(this._eventFuncList[o].originalFunc==e){n=this._eventFuncList[o].func,this._eventFuncList.splice(o,1);break}n&&i.removeEventListener(t,n)}onResize(t){basic.resizeDetection.onResize(this,t)}remove_onResize(t){basic.resizeDetection.remove_onResize(this.element,t)}setMotion(t){var e=this;setTimeout(function(){e.setMotionNow(t)},basic.motionController.DONT_MOTION_TIME)}getMotion(){return this._motionString}setMotionNow(t){this._motionString=t,this.contElement.style.transition=t}withMotion(t){var e=this;setTimeout(function(){e.canMotionNow(),t(e)},basic.motionController.WITH_MOTION_TIME)}dontMotion(){this.contElement.style.transition="none";var t=this;setTimeout(function(){t.contElement.style.transition=t._motionString},basic.motionController.DONT_MOTION_TIME)}canMotionNow(){this.contElement.style.transition=this._motionString}}class MainBox{constructor(){this._bodyElement=document.getElementsByTagName("BODY")[0],this._element=this._bodyElement,this._backgroundColor="white",this._zoom=1}get element(){return this._element}get contElement(){return this._element}get bodyElement(){return this._bodyElement}get mainBox(){return this._box}set mainBox(t){this._box=t,this._element=this._box.element}get width(){let t;return t=window.innerWidth||document.documentElement.clientWidth||document.body.clientWidth,basic.withPageZoom(t)}get height(){let t;return t=window.innerHeight||document.documentElement.clientHeight||document.body.clientHeight,basic.withPageZoom(t)}get zoom(){return this._zoom}set zoom(t){this._zoom=t,this.bodyElement.style.transformOrigin="top left",this.bodyElement.style.transform="scale("+t+")",page.refreshSize()}get color(){return this._backgroundColor}set color(t){this._backgroundColor=t,this.bodyElement.style.backgroundColor=t}fit(t=document.body.clientWidth,e){page.zoom=1;let i=page.width;i>(e=e||t)?page.zoom=e/t:page.zoom=i/t}refreshSize(){page.mainBox.width=page.width,page.mainBox.height=page.height}onClick(t){this._box._addEventListener("click",t,window)}remove_onClick(t){this._box._removeEventListener("click",t,window)}onResize(t){this._box._addEventListener("resize",t,window)}remove_onResize(t){this._box._removeEventListener("resize",t,window)}add(t){t.containerBox!=this&&(t.containerBox=this,this.element.appendChild(t.contElement))}}class Box extends Basic_UIComponent{constructor(t=-1e3,e=-1e3,i=basic.BOX_WIDTH,n=basic.BOX_HEIGHT){super("box"),this._backgroundColor="whitesmoke",this._border=0,this._borderColor="gray",this._round=0,this._fontSize=16,this._textColor="#4A4A4A",this._textAlign="left";let o=document.createElement("DIV");o.classList.add("basic_box"),o.style.left=t+"px",o.style.top=e+"px",this._element=o,this._containerBox=basic.defaultContainerBox,basic.defaultContainerBox.element.appendChild(this._element),"auto"==i&&(i=basic.BOX_WIDTH),this.width=i,this.height=n,makeBasicObject(this)}get element(){return this._element}get contElement(){return this._element}get text(){return this.element.innerHTML}set text(t){this.element.innerHTML=t}get html(){return this.element.innerHTML}set html(t){this.element.innerHTML=t}get height(){return super.height}set height(t){"auto"!=t?this.contElement.style.height=parseFloat(t)+"px":this.contElement.style.height="auto"}get scrollX(){return"scroll"==this.contElement.style.overflowX?1:0}get scrollY(){return"scroll"==this.contElement.style.overflowY?1:0}set scrollX(t){this.contElement.style.overflowX="hidden",1==t&&(this.clickable=1,this.contElement.style.overflowX="scroll")}set scrollY(t){this.contElement.style.overflowY="hidden",1==t&&(this.clickable=1,this.contElement.style.overflowY="scroll")}get position(){return this.contElement.style.position?this.contElement.style.position:"absolute"}set position(t){this.contElement.style.position=t,"relative"==t&&(this.left=0,this.top=0)}onClick(t){this.clickable=1,this._addEventListener("click",t,this.contElement)}remove_onClick(t){this._removeEventListener("click",t,this.contElement)}add(t){t.containerBox!=this&&(t.containerBox=this,this.clickable=1,this.element.appendChild(t.contElement))}in(t){var e=getDefaultContainerBox();setDefaultContainerBox(this),t(this),setDefaultContainerBox(e)}}var createBox=function(t,e,i,n){return new Box(t,e,i,n)},cbox=function(t,e,i,n){return new Box(t,e,i,n)};class Button extends Basic_UIComponent{constructor(t=-1e3,e=-1e3,i=basic.BUTTON_WIDTH,n=basic.BUTTON_HEIGHT){super("button"),this._backgroundColor=basic.BUTTON_COLOR,this._border=1,this._borderColor="rgba(0, 0, 0, 0.40)",this._round=4,this._fontSize=20,this._textColor=basic.BUTTON_TEXT_COLOR,this._textAlign="center",this._clickable=1;let o=document.createElement("BUTTON");o.innerHTML="Button",o.classList.add("basic_button"),o.setAttribute("type","button"),o.style.left=t+"px",o.style.top=e+"px",this._element=o,this._containerBox=basic.defaultContainerBox,basic.defaultContainerBox.element.appendChild(this._element),"auto"==n&&(n=basic.BUTTON_HEIGHT),this.width=i,this.height=n,makeBasicObject(this)}get element(){return this._element}get contElement(){return this._element}get buttonElement(){return this._element}get text(){return this.buttonElement.innerHTML}set text(t){this.buttonElement.innerHTML=t}get width(){return super.width}set width(t){"auto"!=t?this.contElement.style.width=parseFloat(t)+"px":this.contElement.style.width="auto"}get value(){return this.buttonElement.value}set value(t){this.buttonElement.value=t}get enabled(){return this.buttonElement.disabled?0:1}set enabled(t){this.buttonElement.disabled=t?0:1}get minimal(){return this.buttonElement.classList.contains("minimal")?1:0}set minimal(t){t?this.buttonElement.classList.add("minimal"):this.buttonElement.classList.remove("minimal")}get spaceX(){return parseInt(this.contElement.style.paddingLeft)||0}set spaceX(t){this.contElement.style.paddingLeft=t+"px",this.contElement.style.paddingRight=t+"px"}onClick(t){this.clickable=1,this._addEventListener("click",t,this.buttonElement)}remove_onClick(t){this._removeEventListener("click",t,this.buttonElement)}add(t){console.log("basic.js: add(): Insertion cannot be made inside the Button object.")}}var createButton=function(t,e,i,n){return new Button(t,e,i,n)},cbtn=function(t,e,i,n){return new Button(t,e,i,n)};class TextBox extends Basic_UIComponent{constructor(t=-1e3,e=-1e3,i=basic.TEXTBOX_WIDTH,n=basic.TEXTBOX_HEIGHT){super("textbox"),this._backgroundColor="white",this._border=1,this._borderColor="#4A4A4A",this._round=4,this._fontSize=20,this._textColor="#4A4A4A",this._textAlign="left",this._clickable=1;let o=document.createElement("DIV");o.classList.add("basic_textbox-main"),this._mainElement=o;let s=document.createElement("DIV");s.classList.add("basic_textbox-title"),s.innerHTML="",this._titleElement=s;let r=document.createElement("INPUT");r.value="",r.classList.add("basic_textbox"),r.setAttribute("type","text"),r.style.width="100%",r.style.height="100%",this._element=r,o.style.left=t+"px",o.style.top=e+"px",o.style.width=i+"px",o.style.height=n+"px",o.appendChild(this._titleElement),o.appendChild(this._element),this._containerBox=basic.defaultContainerBox,basic.defaultContainerBox.element.appendChild(this._mainElement),makeBasicObject(this)}get element(){return this._mainElement}get inputElement(){return this._element}get contElement(){return this._mainElement}get titleElement(){return this._titleElement}get text(){return this.inputElement.value}set text(t){this.inputElement.value=t.toString()}get color(){return super.color}set color(t){this._backgroundColor=t,this.inputElement.style.backgroundColor=t}get title(){return this.titleElement.innerHTML}set title(t){this.titleElement.innerHTML=t}get enabled(){return this.inputElement.disabled?0:1}set enabled(t){this.inputElement.disabled=t?0:1}set border(t){this._border=t,this.inputElement.style.borderWidth=t+"px"}get border(){return super.border}get borderColor(){return super.borderColor}set borderColor(t){this._borderColor=t,this.inputElement.style.borderColor=t}set round(t){this._round=t,this.inputElement.style.borderRadius=t+"px"}get round(){return super.round}get fontSize(){return super.fontSize}set fontSize(t){this._fontSize=t,this.inputElement.style.fontSize=t+"px"}get textSize(){return super.textSize}set textSize(t){this._fontSize=t,this.inputElement.style.fontSize=t+"px"}get textColor(){return super.textColor}set textColor(t){this._textColor=t,this.inputElement.style.color=t}get textAlign(){return super.textAlign}set textAlign(t){this._textAlign=t,this.inputElement.style.textAlign=t}get minimal(){return this.inputElement.classList.contains("minimal")?1:0}set minimal(t){t?this.inputElement.classList.add("minimal"):this.inputElement.classList.remove("minimal")}onChange(t){this._addEventListener("change",t,this.inputElement)}remove_onChange(t){this._removeEventListener("change",t,this.inputElement)}add(t){console.log("basic.js: add(): Insertion cannot be made inside the TextBox object.")}}var createTextBox=function(t,e,i,n){return new TextBox(t,e,i,n)},ctxt=function(t,e,i,n){return new TextBox(t,e,i,n)};class Label extends Basic_UIComponent{constructor(t=-1e3,e=-1e3,i=basic.LABEL_WIDTH,n=basic.LABEL_HEIGHT){super("label"),this._backgroundColor="transparent",this._border=0,this._borderColor="#4A4A4A",this._round=0,this._fontSize=20,this._textColor="#4A4A4A",this._textAlign="left";let o=document.createElement("DIV");o.innerHTML="Label Text",o.classList.add("basic_label"),o.style.left=t+"px",o.style.top=e+"px",this._element=o,this._containerBox=basic.defaultContainerBox,basic.defaultContainerBox.element.appendChild(this._element),this.width=i,this.height=n,makeBasicObject(this)}get element(){return this._element}get contElement(){return this._element}get text(){return this.element.innerHTML}set text(t){this.element.innerHTML=t}get width(){return super.width}set width(t){"auto"!=t?this.contElement.style.width=parseFloat(t)+"px":this.contElement.style.width="auto"}get height(){return super.height}set height(t){"auto"!=t?this.contElement.style.height=parseFloat(t)+"px":this.contElement.style.height="auto"}get space(){return parseInt(this.contElement.style.padding)||0}set space(t){this.contElement.style.padding=t+"px"}get spaceX(){return parseInt(this.contElement.style.paddingLeft)||0}set spaceX(t){this.contElement.style.paddingLeft=t+"px",this.contElement.style.paddingRight=t+"px"}get spaceY(){return parseInt(this.contElement.style.paddingTop)||0}set spaceY(t){this.contElement.style.paddingTop=t+"px",this.contElement.style.paddingBottom=t+"px"}onClick(t){this.clickable=1,this._addEventListener("click",t,this.contElement)}remove_onClick(t){this.clickable=0,this._removeEventListener("click",t,this.contElement)}add(t){console.log("basic.js: add(): Insertion cannot be made inside the Label object.")}}var createLabel=function(t,e,i,n){return new Label(t,e,i,n)},clbl=function(t,e,i,n){return new Label(t,e,i,n)};class Image extends Basic_UIComponent{constructor(t=-1e3,e=-1e3,i=0,n=0){super("image"),this._autoSize=1,this._space=0,this._backgroundColor="transparent",this._border=0,this._borderColor="#4A4A4A",this._round=0;let o=document.createElement("IMG");o.classList.add("basic_image"),o.style.left=t+"px",o.style.top=e+"px",(i||n)&&(this.autoSize=0),o.style.width=i+"px",o.style.height=n+"px";var s=this;o.addEventListener("load",function(){s.autoSize>0&&(o.style.width=parseInt(s.naturalWidth/s.autoSize)+"px",o.style.height=parseInt(s.naturalHeight/s.autoSize)+"px",s.autoSize=0)}),this._element=o,this._containerBox=basic.defaultContainerBox,basic.defaultContainerBox.element.appendChild(this._element),makeBasicObject(this)}get element(){return this._element}get imageElement(){return this._element}get contElement(){return this._element}get width(){return super.width}set width(t){this.autoSize=0,super.width=t}get height(){return super.height}set height(t){this.autoSize=0,super.height=t}get naturalWidth(){return this.imageElement.naturalWidth}get naturalHeight(){return this.imageElement.naturalHeight}get autoSize(){return this._autoSize}set autoSize(t){this._autoSize=t}get space(){return this._space}set space(t){t>50&&(t=50),t<0&&(t=0),this._space=t;var e=parseInt(this.width/100*t),i=parseInt(this.height/100*t);this.contElement.style.paddingLeft=e+"px",this.contElement.style.paddingRight=e+"px",this.contElement.style.paddingTop=i+"px",this.contElement.style.paddingBottom=i+"px"}onClick(t){this.clickable=1,this._addEventListener("click",t,this.contElement)}remove_onClick(t){this.clickable=0,this._removeEventListener("click",t,this.contElement)}onLoad(t){this._addEventListener("load",t,this.imageElement)}remove_onLoad(t){this._removeEventListener("load",t,this.imageElement)}load(t){this.imageElement.setAttribute("src",t)}add(t){console.log("basic.js: add(): Insertion cannot be made inside the Image object.")}}var createImage=function(t,e,i,n){return new Image(t,e,i,n)},cimg=function(t,e,i,n){return new Image(t,e,i,n)};class Sound{constructor(){let t=document.createElement("AUDIO"),e=document.createElement("SOURCE");t.appendChild(e),this._element=t,document.body.appendChild(this._element),makeBasicObject(this)}get element(){return this._element}get soundElement(){return this._element}get contElement(){return this._element}get time(){return this.element.timr}get timeLeft(){return this.element.timeLeft}get currentTime(){return this.element.currentTime}get paused(){return this.element.paused}get playing(){return!this.element.paused}get loop(){return"loop"==this.element.getAttribute("loop")?1:0}set loop(t){1==t?this.element.setAttribute("loop","loop"):this.element.setAttribute("loop","")}play(){this.paused&&this.element.play()}pause(t){this.paused||this.element.pause()}stop(){this.paused||(this.element.pause(),this.element.currentTime=0)}onLoad(t){let e=this;this.element.addEventListener("canplaythrough",function(){t(e)})}load(t){let e="audio/wav";"mp3"==t.substr(-3).toLowerCase()&&(e="audio/mpeg"),this.element.children[0].setAttribute("src",t),this.element.children[0].setAttribute("type",e)}remove(){this.contElement.remove()}}basic.setProparties=function(t,e=[]){for(var i in e)t[i]=e[i]},basic.moveToCenter=function(t,e){if("left"==e||!e){let i=t.containerBox.width-2*(t.containerBox.border||0);t.left=parseInt((i-t.width)/2)}if("top"==e||!e){let n=t.containerBox.height-2*(t.containerBox.border||0);t.top=parseInt((n-t.height)/2)}},basic.moveToAline=function(t,e,i,n,o){if("left"==i?(isNaN(e.left)?isNaN(e.right)||(t.right=parseInt(e.right+e.width+n)):t.left=parseInt(e.left-t.width-n),isNaN(e.top)?t.bottom=parseInt(e.bottom):t.top=parseInt(e.top)):"top"==i?(isNaN(e.top)?isNaN(e.bottom)||(t.bottom=parseInt(e.bottom+e.height+n)):t.top=parseInt(e.top-t.height-n),isNaN(e.left)?t.right=parseInt(e.right):t.left=parseInt(e.left)):"right"==i?(isNaN(e.left)?isNaN(e.right)||(t.right=parseInt(e.right-t.width-n)):t.left=parseInt(e.left+e.width+n),isNaN(e.top)?t.bottom=parseInt(e.bottom):t.top=parseInt(e.top)):"bottom"==i?(isNaN(e.top)?isNaN(e.bottom)||(t.bottom=parseInt(e.bottom-t.height-n)):t.top=parseInt(e.top+e.height+n),isNaN(e.left)?t.right=parseInt(e.right):t.left=parseInt(e.left)):(isNaN(e.top)?isNaN(e.bottom)||(t.bottom=parseInt(e.bottom)):t.top=parseInt(e.top),isNaN(e.left)?isNaN(e.right)||(t.right=parseInt(e.right)):t.left=parseInt(e.left)),"left"==i||"right"==i){var s=e.height-t.height;switch(o){case"top":isNaN(e.top)&&(isNaN(e.bottom)||(t.bottom+=parseInt(s)));break;case"bottom":isNaN(e.top)?isNaN(e.bottom):t.top+=parseInt(s);break;case"center":isNaN(e.top)?isNaN(e.bottom)||(t.bottom+=parseInt(s/2)):t.top+=parseInt(s/2)}}else if("top"==i||"bottom"==i){var s=e.width-t.width;switch(o){case"left":isNaN(e.left)&&(isNaN(e.right)||(t.right=parseInt(e.right+s)));break;case"right":isNaN(e.left)?isNaN(e.right):t.left+=parseInt(s);break;case"center":isNaN(e.left)?isNaN(e.right)||(t.right+=parseInt(s/2)):t.left+=parseInt(s/2)}}},basic.withPageZoom=function(t){return parseInt(t*(1/page.zoom))};var withPageZoom=basic.withPageZoom;basic.setLoopTimer=function(t){"function"==typeof loop&&(basic.loopTimer&&(basic.loopTimer=clearInterval(basic.loopTimer)),0==t||(basic.loopTimer=setInterval(loop,t)))};var setLoopTimer=basic.setLoopTimer;basic.setDefaultContainerBox=function(t){basic.previousDefaultContainerBox=basic.defaultContainerBox||page,basic.defaultContainerBox=t};var setDefaultContainerBox=basic.setDefaultContainerBox;basic.restoreDefaultContainerBox=function(){basic.defaultContainerBox=basic.previousDefaultContainerBox||page};var restoreDefaultContainerBox=basic.restoreDefaultContainerBox;basic.getDefaultContainerBox=function(){return basic.defaultContainerBox};var getDefaultContainerBox=basic.getDefaultContainerBox;basic.makeBasicObject=function(t){previousThat=that,that=t};var makeBasicObject=basic.makeBasicObject;basic.resizeDetection.onResize=function(t,e){var i={};i.obj=t,i.elem=t.element,i.func=e,basic.resizeDetection.objectAndFunctionList.push(i),basic.resizeDetection.whenDetected.observe(t.element)},basic.resizeDetection.remove_onResize=function(t,e){for(var i=basic.resizeDetection.objectAndFunctionList.length-1;i>=0;i--)basic.resizeDetection.objectAndFunctionList[i].elem==t&&basic.resizeDetection.objectAndFunctionList[i].func==e&&basic.resizeDetection.objectAndFunctionList.splice(i,1);basic.resizeDetection.whenDetected.unobserve(t)},basic.resizeDetection.whenDetected=new ResizeObserver(function(t){for(var e=basic.resizeDetection,i=0;i<t.length;i++)for(var n=0;n<e.objectAndFunctionList.length;n++)t[i].target==e.objectAndFunctionList[n].elem&&e.objectAndFunctionList[n].func(e.objectAndFunctionList[n].obj)}),window.addEventListener("load",function(){basic.start()});