feat: block ads

This commit is contained in:
Hakadao
2024-03-05 00:25:37 -03:00
parent e6b8a7c708
commit 02788ddb90
9 changed files with 50 additions and 2 deletions

View File

@@ -94,6 +94,16 @@ watch(() => settings.value.adaptToOtherPageStyles, () => {
handleAdaptToOtherPageStylesChange()
})
watch(() => settings.value.blockAds, () => {
handleBlockAds()
})
onBeforeMount(() => {
handleBlockAds()
setAppThemeColor()
handleAdaptToOtherPageStylesChange()
})
onMounted(() => {
// openVideoPageIfBvidExists()
@@ -114,8 +124,6 @@ onMounted(() => {
handleChangeAccessKey()
setAppAppearance()
setAppLanguage()
setAppThemeColor()
handleAdaptToOtherPageStylesChange()
})
function handleChangeAccessKey() {
@@ -237,6 +245,13 @@ function handleOsScroll() {
topBarRef.value?.handleScroll()
}
function handleBlockAds() {
if (settings.value.blockAds)
document.documentElement.classList.add('block-ads')
else
document.documentElement.classList.remove('block-ads')
}
// fix #166 https://github.com/hakadao/BewlyBewly/issues/166
// function openVideoPageIfBvidExists() {
// Assume the URL is https://www.bilibili.com/?bvid=BV1be41127ft&spm_id_from=333.788.seo.out