const { LitElement, html, css } = require('lit') const { commonCss, displayScreen } = require('./components/common') class PlayScreen extends LitElement { static get styles () { return css` ${commonCss} .title { top: 12px; } .edit-boxes { position: absolute; top: 59px; left: 50%; display: flex; flex-direction: column; gap: 14px 0; transform: translate(-50%); width: 310px; } .wrapper { width: 100%; display: flex; flex-direction: row; gap: 0 4px; } .button-wrapper { display: flex; flex-direction: row; gap: 0 4px; position: absolute; bottom: 9px; left: 50%; transform: translate(-50%); width: 310px; } .extra-info-bv { font-size: 10px; color: rgb(206, 206, 206); text-shadow: 1px 1px black; position: absolute; left: calc(50% + 2px); bottom: -34px; } ` } static get properties () { return { server: { type: String }, serverport: { type: Number }, proxy: { type: String }, proxyport: { type: Number }, username: { type: String }, password: { type: String }, version: { type: String } } } constructor () { super() this.server = '' this.serverport = 25565 this.proxy = '' this.proxyport = '' this.username = window.localStorage.getItem('username') ?? 'pviewer' + (Math.floor(Math.random() * 1000)) this.password = '' this.version = '' window.fetch('config.json').then(res => res.json()).then(config => { this.server = config.defaultHost this.serverport = config.defaultHostPort ?? 25565 this.proxy = config.defaultProxy this.proxyport = !config.defaultProxy && !config.defaultProxyPort ? '' : config.defaultProxyPort ?? 443 this.version = config.defaultVersion }) } render () { return html`

Join a Server

{ this.server = e.target.value }} > { this.serverport = e.target.value }} >
{ this.proxy = e.target.value }} > { this.proxyport = e.target.value }} >
{ this.username = e.target.value }} > { this.version = e.target.value }} >

Leave blank and it will be chosen automatically

displayScreen(this, document.getElementById('title-screen'))}>
` } onConnectPress () { window.localStorage.setItem('username', this.username) this.dispatchEvent(new window.CustomEvent('connect', { detail: { server: `${this.server}:${this.serverport}`, proxy: `${this.proxy}${this.proxy !== '' ? `:${this.proxyport}` : ''}`, username: this.username, password: this.password, botVersion: this.version } })) } } window.customElements.define('pmui-playscreen', PlayScreen)