summaryrefslogtreecommitdiff
path: root/example/src/main/kotlin/moe/nea89/website/test/index.kt
diff options
context:
space:
mode:
Diffstat (limited to 'example/src/main/kotlin/moe/nea89/website/test/index.kt')
-rw-r--r--example/src/main/kotlin/moe/nea89/website/test/index.kt22
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("/", "/") ?: ""} >" }