aboutsummaryrefslogtreecommitdiff
path: root/src/main/kotlin/pl
diff options
context:
space:
mode:
authorRobert Jaros <rjaros@finn.pl>2018-03-10 19:04:29 +0100
committerRobert Jaros <rjaros@finn.pl>2018-03-10 19:04:29 +0100
commit3577c10b5c3839a06f64cb19e72788401bd7406d (patch)
treebbb8f2531b547b3074806b2661abc10c183cfb9c /src/main/kotlin/pl
parent9e7c88917461e5941ed742fe8ed855b7c07cf8fa (diff)
downloadkvision-3577c10b5c3839a06f64cb19e72788401bd7406d.tar.gz
kvision-3577c10b5c3839a06f64cb19e72788401bd7406d.tar.bz2
kvision-3577c10b5c3839a06f64cb19e72788401bd7406d.zip
Support for Bootswatch and other css themes.
Diffstat (limited to 'src/main/kotlin/pl')
-rw-r--r--src/main/kotlin/pl/treksoft/kvision/KVManager.kt12
1 files changed, 11 insertions, 1 deletions
diff --git a/src/main/kotlin/pl/treksoft/kvision/KVManager.kt b/src/main/kotlin/pl/treksoft/kvision/KVManager.kt
index 0030cf9d..e1c169c0 100644
--- a/src/main/kotlin/pl/treksoft/kvision/KVManager.kt
+++ b/src/main/kotlin/pl/treksoft/kvision/KVManager.kt
@@ -29,6 +29,7 @@ import com.github.snabbdom.datasetModule
import com.github.snabbdom.eventListenersModule
import com.github.snabbdom.propsModule
import com.github.snabbdom.styleModule
+import org.w3c.dom.asList
import pl.treksoft.kvision.core.Component
import pl.treksoft.kvision.utils.isIE11
import kotlin.browser.document
@@ -48,8 +49,17 @@ internal object KVManager {
internal const val AJAX_REQUEST_DELAY = 300
internal const val KVNULL = "#kvnull"
+ private val links = document.getElementsByTagName("link")
private val bootstrapWebpack = try {
- require("bootstrap-webpack")
+ val bootswatch = links.asList().find { it.getAttribute("href")?.contains("bootstrap.min.css") ?: false }
+ if (bootswatch != null) {
+ if (bootswatch.getAttribute("href")?.contains("/paper/") ?: false) {
+ require("./css/paper.css")
+ }
+ require("bootstrap-webpack!./js/bootstrap.config.js")
+ } else {
+ require("bootstrap-webpack")
+ }
} catch (e: Throwable) {
}
private val fontAwesomeWebpack = try {