diff options
author | Allan Wang <me@allanwang.ca> | 2017-12-11 17:52:24 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-12-11 17:52:24 -0500 |
commit | db262e95779e0a17275bdb94be2b0ac12819178e (patch) | |
tree | 42b89edf8796e85e362ca86dead1170cb38f6434 /app/src/main/kotlin/com/pitchedapps/frost/injectors/JsAssets.kt | |
parent | 1d4380cee77fc049a54d280a27dcefa3fa6ff1fd (diff) | |
download | frost-db262e95779e0a17275bdb94be2b0ac12819178e.tar.gz frost-db262e95779e0a17275bdb94be2b0ac12819178e.tar.bz2 frost-db262e95779e0a17275bdb94be2b0ac12819178e.zip |
Feature/tab customization (#522)
* Add initial tab customizing view
* Add rest of content for now
* Delete project file backups
* Stash
* Support full tab customization
* Test activity animations
* Update kau and fix sound uri
* Try catch download, resolves #523
Diffstat (limited to 'app/src/main/kotlin/com/pitchedapps/frost/injectors/JsAssets.kt')
-rw-r--r-- | app/src/main/kotlin/com/pitchedapps/frost/injectors/JsAssets.kt | 10 |
1 files changed, 1 insertions, 9 deletions
diff --git a/app/src/main/kotlin/com/pitchedapps/frost/injectors/JsAssets.kt b/app/src/main/kotlin/com/pitchedapps/frost/injectors/JsAssets.kt index 0e46225c..beb60293 100644 --- a/app/src/main/kotlin/com/pitchedapps/frost/injectors/JsAssets.kt +++ b/app/src/main/kotlin/com/pitchedapps/frost/injectors/JsAssets.kt @@ -19,7 +19,7 @@ enum class JsAssets : InjectorContract { var injector = lazyContext { try { val content = it.assets.open("js/$file").bufferedReader().use { it.readText() } - JsBuilder().js(singleInjector(content)).build() + JsBuilder().js(content).single(name).build() } catch (e: FileNotFoundException) { L.e(e, "JsAssets file not found") JsInjector(JsActions.EMPTY.function) @@ -30,12 +30,4 @@ enum class JsAssets : InjectorContract { injector(webView.context).inject(webView, callback) } - private fun singleInjector(content: String) = StringBuilder().apply { - val name = "_frost_$name" - append("if (!window.hasOwnProperty(\"$name\")) {") - append("console.log(\"Registering $name\");") - append("window.$name = true;") - append(content) - append("}") - }.toString() } |