1
This commit is contained in:
@@ -0,0 +1,61 @@
|
||||
export {XRUN_START_LOGO_OPTS} from "../interface"
|
||||
import {hexToRgb} from "../libs/color"
|
||||
let xRunStartBoxDiv:null|HTMLElement = null;
|
||||
// @ts-ignore
|
||||
export function showRunLogo(opts:XRUN_START_LOGO_OPTS){
|
||||
let appwidth = '100vw';
|
||||
let appheight = '100vh';
|
||||
let _bgcolor = hexToRgb(opts.bgColor);
|
||||
let bgColor = _bgcolor?`rgba(${_bgcolor.r},${_bgcolor.g},${_bgcolor.b},${_bgcolor.a})`:'#f7f7f7'
|
||||
let _LogoBgColor = hexToRgb(opts.logoBgColor);
|
||||
let LogoBgColor = _LogoBgColor?`rgba(${_LogoBgColor.r},${_LogoBgColor.g},${_LogoBgColor.b},${_LogoBgColor.a})`:'#ffffff'
|
||||
let _fontColor = hexToRgb(opts.fontColor);
|
||||
let fontColor = _fontColor?`rgba(${_fontColor.r},${_fontColor.g},${_fontColor.b},${_fontColor.a})`:'#888888'
|
||||
|
||||
let box = document.createElement("div")
|
||||
box.style.position = 'fixed'
|
||||
box.style.left = '0px'
|
||||
box.style.top = '0px'
|
||||
box.style.zIndex = '300'
|
||||
box.style.width = appwidth
|
||||
box.style.height = appheight
|
||||
box.style.background = bgColor
|
||||
box.style.display = 'flex'
|
||||
box.style.flexDirection = 'column'
|
||||
box.style.justifyContent = 'flex-end'
|
||||
box.style.alignItems = 'center'
|
||||
|
||||
let rightText = document.createElement('span')
|
||||
rightText.style.fontSize = opts.fontSize+'px'
|
||||
rightText.style.color = fontColor
|
||||
rightText.style.marginBottom = '80px'
|
||||
rightText.style.marginTop = '12px'
|
||||
rightText.innerText = opts.rightText
|
||||
|
||||
let logoBox = document.createElement('div')
|
||||
logoBox.style.width = opts.width+'px'
|
||||
logoBox.style.height = opts.height+'px'
|
||||
logoBox.style.background = LogoBgColor
|
||||
logoBox.style.borderRadius = opts.round+'px'
|
||||
logoBox.style.padding = opts.logoPadding+'px'
|
||||
|
||||
let logo = document.createElement("img")
|
||||
logo.src = "/static/tmui4xLibs/static/"+opts.logo
|
||||
logo.style.width = opts.width+'px'
|
||||
logo.style.height = opts.height+'px'
|
||||
logo.style.borderRadius = opts.round+'px'
|
||||
|
||||
logoBox.append(logo)
|
||||
box.append(logoBox)
|
||||
box.append(rightText)
|
||||
document.body.append(box)
|
||||
|
||||
xRunStartBoxDiv = box;
|
||||
}
|
||||
|
||||
|
||||
export function hideRunLogo() {
|
||||
if(xRunStartBoxDiv){
|
||||
document.body.removeChild(xRunStartBoxDiv)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user