aboutsummaryrefslogtreecommitdiff
path: root/app/src/main/kotlin/com/pitchedapps/frost/injectors
diff options
context:
space:
mode:
authorAllan Wang <me@allanwang.ca>2020-05-23 21:12:23 -0700
committerGitHub <noreply@github.com>2020-05-23 21:12:23 -0700
commit327ed78db8b7f77891eab88c562132aff93958a4 (patch)
tree5f240c8db9ba2b7d69888a86659a963bcd352c00 /app/src/main/kotlin/com/pitchedapps/frost/injectors
parentffce9e645572eefdcd837921214a2be026514b43 (diff)
parenta6a1b8dffd08219c76614e0eeba6e4d92f02aa6b (diff)
downloadfrost-327ed78db8b7f77891eab88c562132aff93958a4.tar.gz
frost-327ed78db8b7f77891eab88c562132aff93958a4.tar.bz2
frost-327ed78db8b7f77891eab88c562132aff93958a4.zip
Merge pull request #1680 from AllanWang/full-size-image
Diffstat (limited to 'app/src/main/kotlin/com/pitchedapps/frost/injectors')
-rw-r--r--app/src/main/kotlin/com/pitchedapps/frost/injectors/CssHider.kt4
-rw-r--r--app/src/main/kotlin/com/pitchedapps/frost/injectors/CssSmallAssets.kt36
2 files changed, 38 insertions, 2 deletions
diff --git a/app/src/main/kotlin/com/pitchedapps/frost/injectors/CssHider.kt b/app/src/main/kotlin/com/pitchedapps/frost/injectors/CssHider.kt
index 94367853..9630117d 100644
--- a/app/src/main/kotlin/com/pitchedapps/frost/injectors/CssHider.kt
+++ b/app/src/main/kotlin/com/pitchedapps/frost/injectors/CssHider.kt
@@ -24,7 +24,7 @@ import com.pitchedapps.frost.utils.Prefs
*
* List of elements to hide
*/
-enum class CssHider(vararg val items: String) : InjectorContract {
+enum class CssHider(private vararg val items: String) : InjectorContract {
CORE("[data-sigil=m_login_upsell]", "[role=progressbar]"),
HEADER(
"#header:not(.mFuturePageHeader):not(.titled)",
@@ -51,7 +51,7 @@ enum class CssHider(vararg val items: String) : InjectorContract {
val injector: JsInjector by lazy {
JsBuilder().css("${items.joinToString(separator = ",")}{display:none !important}")
- .single(name).build()
+ .single("css-hider-$name").build()
}
override fun inject(webView: WebView, prefs: Prefs) =
diff --git a/app/src/main/kotlin/com/pitchedapps/frost/injectors/CssSmallAssets.kt b/app/src/main/kotlin/com/pitchedapps/frost/injectors/CssSmallAssets.kt
new file mode 100644
index 00000000..27b6e278
--- /dev/null
+++ b/app/src/main/kotlin/com/pitchedapps/frost/injectors/CssSmallAssets.kt
@@ -0,0 +1,36 @@
+/*
+ * Copyright 2020 Allan Wang
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+package com.pitchedapps.frost.injectors
+
+import android.webkit.WebView
+import com.pitchedapps.frost.utils.Prefs
+
+/**
+ * Small misc inline css assets
+ */
+enum class CssSmallAssets(private val content: String) : InjectorContract {
+ FullSizeImage("div._4prr[style*=\"max-width\"][style*=\"max-height\"]{max-width:none !important;max-height:none !important}")
+ ;
+
+ val injector: JsInjector by lazy {
+ JsBuilder().css(content).single("css-small-assets-$name").build()
+ }
+
+ override fun inject(webView: WebView, prefs: Prefs) {
+ injector.inject(webView, prefs)
+ }
+}