diff options
author | nea <romangraef@gmail.com> | 2022-08-28 16:08:50 +0200 |
---|---|---|
committer | nea <romangraef@gmail.com> | 2022-08-28 16:08:50 +0200 |
commit | 484bc7c89948d4c52a1f04fa97a06016fa0b5b4a (patch) | |
tree | f2874056fedf12b48c486260199ec8fe0efd67f4 /example/src/main/kotlin/moe | |
parent | 36374a03516517a89bbb74ce58053ac5ca44f752 (diff) | |
download | neamoe-484bc7c89948d4c52a1f04fa97a06016fa0b5b4a.tar.gz neamoe-484bc7c89948d4c52a1f04fa97a06016fa0b5b4a.tar.bz2 neamoe-484bc7c89948d4c52a1f04fa97a06016fa0b5b4a.zip |
add mobile support
Diffstat (limited to 'example/src/main/kotlin/moe')
-rw-r--r-- | example/src/main/kotlin/moe/nea89/website/test/index.kt | 22 |
1 files changed, 21 insertions, 1 deletions
diff --git a/example/src/main/kotlin/moe/nea89/website/test/index.kt b/example/src/main/kotlin/moe/nea89/website/test/index.kt index 846b0db..a613a94 100644 --- a/example/src/main/kotlin/moe/nea89/website/test/index.kt +++ b/example/src/main/kotlin/moe/nea89/website/test/index.kt @@ -2,6 +2,7 @@ package moe.nea89.website.test import kotlinext.js.require import kotlinx.browser.document +import kotlinx.browser.window import kotlinx.css.* import kotlinx.html.dom.append import kotlinx.html.js.div @@ -30,6 +31,25 @@ fun main() { val root = document.body!!.append.div() val console = KConsole.createFor(root, fileSystem = defaultFileSystem) console.text.id = "myconsole" + + val mobileNavigators = listOf( + "webos", + "android", + "iphone", + "ipad", + "ipod", + "blackberry", + "iemobile", + "opera mini" + ) + + fun isMobileBrowser() : Boolean{ + return js("'ontouchstart' in document.documentElement") as Boolean + } + + if (window.location.search == "mobile" || (window.location.search != "desktop" && isMobileBrowser())) { + console.openMobileKeyboardOnTap() + } console.fileAccessor!!.cd("home/nea") injectGlobal { body { @@ -37,6 +57,7 @@ fun main() { } ".${Styles.consoleClass}" { margin(LinearDimension.auto) + fontFamily = "\"Comic Mono\", monospace" width = 50.vw height = 50.vh marginTop = 25.vh @@ -44,7 +65,6 @@ fun main() { backgroundClip = BackgroundClip.contentBox overflowY = Overflow.scroll } - } console.addLine("Starting up terminal.") console.PS1 = { "${this.fileAccessor?.currentDir?.joinToString("/", "/") ?: ""} >" } |