mirror of
https://github.com/AllanWang/Frost-for-Facebook.git
synced 2024-11-10 04:52:38 +01:00
Create full size image css
This commit is contained in:
parent
7c8e02d385
commit
c7cfb2c868
@ -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) =
|
||||
|
@ -0,0 +1,20 @@
|
||||
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)
|
||||
}
|
||||
}
|
@ -198,6 +198,8 @@ class Prefs(factory: KPrefFactory) : KPref("${BuildConfig.APPLICATION_ID}.prefs"
|
||||
|
||||
var showCreateFab: Boolean by kpref("show_create_fab", true)
|
||||
|
||||
var fullSizeImage: Boolean by kpref("full_size_image", false)
|
||||
|
||||
inline val mainActivityLayout: MainActivityLayout
|
||||
get() = MainActivityLayout(mainActivityLayoutType)
|
||||
|
||||
|
@ -26,6 +26,7 @@ import android.webkit.WebView
|
||||
import ca.allanwang.kau.utils.withAlpha
|
||||
import com.pitchedapps.frost.facebook.USER_AGENT
|
||||
import com.pitchedapps.frost.injectors.CssHider
|
||||
import com.pitchedapps.frost.injectors.CssSmallAssets
|
||||
import com.pitchedapps.frost.injectors.jsInject
|
||||
import com.pitchedapps.frost.utils.L
|
||||
import com.pitchedapps.frost.utils.Prefs
|
||||
@ -116,6 +117,7 @@ class DebugWebView @JvmOverloads constructor(
|
||||
(url?.contains("?sk=h_chr") ?: false) &&
|
||||
prefs.aggressiveRecents
|
||||
),
|
||||
CssSmallAssets.FullSizeImage.maybe(prefs.fullSizeImage),
|
||||
prefs = prefs
|
||||
)
|
||||
}
|
||||
|
@ -29,6 +29,7 @@ import com.pitchedapps.frost.facebook.FbItem
|
||||
import com.pitchedapps.frost.facebook.WWW_FACEBOOK_COM
|
||||
import com.pitchedapps.frost.facebook.formattedFbUrl
|
||||
import com.pitchedapps.frost.injectors.CssHider
|
||||
import com.pitchedapps.frost.injectors.CssSmallAssets
|
||||
import com.pitchedapps.frost.injectors.JsActions
|
||||
import com.pitchedapps.frost.injectors.JsAssets
|
||||
import com.pitchedapps.frost.injectors.jsInject
|
||||
@ -126,10 +127,11 @@ open class FrostWebViewClient(val web: FrostWebView) : BaseWebViewClient() {
|
||||
(web.url?.contains("?sk=h_chr") ?: false) &&
|
||||
prefs.aggressiveRecents
|
||||
),
|
||||
CssHider.ADS.maybe(!prefs.showFacebookAds),
|
||||
CssSmallAssets.FullSizeImage.maybe(prefs.fullSizeImage),
|
||||
JsAssets.DOCUMENT_WATCHER,
|
||||
JsAssets.HORIZONTAL_SCROLLING,
|
||||
JsAssets.CLICK_A,
|
||||
CssHider.ADS.maybe(!prefs.showFacebookAds),
|
||||
JsAssets.CONTEXT_A,
|
||||
JsAssets.MEDIA,
|
||||
prefs = prefs
|
||||
|
Loading…
Reference in New Issue
Block a user