UNPKG

web2app-spa

Version:

This template is primarily designed to easily convert HTML pages and URLs into a Capacitor/Cordova based iOS/Android app that can be used as Single-page application (SPA).

1 lines 3.05 kB
const topBar={backButton:{},menuButton:{}};topBar.backButton.onClickFunc=function(){},topBar.menuButton.onClickFunc=function(){},topBar.default={},topBar.resetDefault=function(){topBar.default.width="container-width",topBar.default.height=105,topBar.default.showWithMotion=0},topBar.resetDefault(),topBar.create=function(t={}){topBar.box=createBox();for(let o in topBar.default)topBar.default[o]=null!=t[o]?t[o]:topBar.default[o];"container-width"==topBar.default.width&&(topBar.default.width=getDefaultContainerBox().width),that.width=topBar.default.width,that.height=topBar.default.height,that.border=0,that.color="white",that.borderColor="rgba(0, 0, 0, 0)",that.element.style.borderBottomWidth="2px",that.visible=0,that.opacity=0,that.top=-1*that.height,that.left=0,that.setMotion("top 0.2s, opacity 0.2s"),topBar.box.btnBack=createImage(20,32,34,34),topBar.box.add(that),that.load("assets/ui-top-bar/back.svg"),that.space=0,that.visible=0,that.opacity=.8,that.bottom=24,that.onClick((function(){topBar.backButton.onClickFunc()})),topBar.box.lblTitle=createLabel(0,37,400),topBar.box.add(that),that.textAlign="center",that.element.style.fontFamily="opensans-bold",that.fontSize=28,that.textColor="rgba(0, 0, 0, 0.8)",that.bottom=24,that.center("left"),topBar.box.btnMenu=createImage(0,0,40,40),topBar.box.add(that),that.load("assets/ui-top-bar/menu6.svg"),that.border=0,that.borderColor="lightgray",that.space=8,that.round=8,that.right=20,that.bottom=24,that.opacity=.8,that.visible=0,that.onClick((function(){topBar.menuButton.onClickFunc()}))},topBar.setTitle=function(t){topBar.box.lblTitle.text=t},topBar.setTitleAlign=function(t){"center"==t?(topBar.box.lblTitle.center("left"),topBar.box.lblTitle.textAlign="center"):"left"==t&&(topBar.box.lblTitle.left=20,topBar.box.lblTitle.textAlign="left")},topBar.setSubTitle=function(t){},topBar.setVisible=function(t){t!=topBar.box.visibleValue&&(topBar.box.visibleValue=t,topBar.default.showWithMotion?t?(clearTimeout(topBar.box.visibleTimeout),topBar.box.top=-1*topBar.box.height,topBar.box.opacity=0,topBar.box.visible=1,topBar.box.withMotion((function(t){t.top=0,t.opacity=1}))):topBar.box.withMotion((function(t){t.top=-1*t.height,t.opacity=0,topBar.box.visibleTimeout=setTimeout((function(){topBar.box.visible=0}),250)})):(t?(topBar.box.top=-1*topBar.box.height,topBar.box.top=0,topBar.box.opacity=1):(topBar.box.top=-1*self.height,topBar.box.opacity=0),topBar.box.visible=t))},topBar.getVisible=function(){return topBar.box.visible},topBar.backButton.setVisible=function(t){topBar.box.btnBack.visible=t},topBar.menuButton.setVisible=function(t){topBar.box.btnMenu.visible=t},topBar.backButton.onClick=function(t){topBar.backButton.onClickFunc=t},topBar.menuButton.onClick=function(t){topBar.menuButton.onClickFunc=t},topBar.getHeight=function(){return topBar.box.height},topBar.setBorderLine=function(t){topBar.box.borderColor=t?"rgba(0, 0, 0, 0.1)":"rgba(0, 0, 0, 0)"},topBar.setBackgroundColor=function(t){topBar.box.color=t},topBar.setTitleColor=function(t){topBar.box.lblTitle.textColor=t};