diff --git a/assets/broken-image.png b/assets/broken-image.png new file mode 100644 index 00000000..d6bbdb9d Binary files /dev/null and b/assets/broken-image.png differ diff --git a/src/components/Settings/components/Appearance.vue b/src/components/Settings/components/Appearance.vue index 9c0942a2..1253c0bb 100644 --- a/src/components/Settings/components/Appearance.vue +++ b/src/components/Settings/components/Appearance.vue @@ -2,14 +2,10 @@ import { useThrottleFn } from '@vueuse/core' import { useI18n } from 'vue-i18n' -import Input from '~/components/Input.vue' -import Radio from '~/components/Radio.vue' import Select from '~/components/Select.vue' -import Slider from '~/components/Slider.vue' -import Tooltip from '~/components/Tooltip.vue' -import { WALLPAPERS } from '~/constants/imgs' import { settings } from '~/logic' +import ChangeWallpaper from './ChangeWallpaper.vue' import SettingsItem from './SettingsItem.vue' import SettingsItemGroup from './SettingsItemGroup.vue' @@ -122,99 +118,9 @@ function changeWallpaper(url: string) { - - - - - {{ $t('settings.wallpaper_mode_opt.build_in') }} - - - {{ $t('settings.wallpaper_mode_opt.by_url') }} - - - - - - - - - - - - - - - - - - - - - - - - - {{ $t('settings.image_url_hint') }} - - - - - - - - {{ $t('common.performance_impact_warn') }} - - - - - - - - - - {{ $t('common.performance_impact_warn') }} - - - - + diff --git a/src/components/Settings/components/ChangeWallpaper.vue b/src/components/Settings/components/ChangeWallpaper.vue new file mode 100644 index 00000000..154c466b --- /dev/null +++ b/src/components/Settings/components/ChangeWallpaper.vue @@ -0,0 +1,243 @@ + + + + + + + + {{ $t('settings.wallpaper_mode_opt.build_in') }} + + + {{ $t('settings.wallpaper_mode_opt.by_url') }} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + {{ $t('settings.image_url_hint') }} + + + + + + + + {{ $t('common.performance_impact_warn') }} + + + + + + + + + + + + {{ $t('common.performance_impact_warn') }} + + + + + + + + diff --git a/src/components/Settings/components/SearchPage.vue b/src/components/Settings/components/SearchPage.vue index 6a5b12c0..ab0248c6 100644 --- a/src/components/Settings/components/SearchPage.vue +++ b/src/components/Settings/components/SearchPage.vue @@ -1,11 +1,10 @@ @@ -113,93 +108,7 @@ function changeWallpaper(url: string) { - - - - - {{ $t('settings.wallpaper_mode_opt.build_in') }} - - - {{ $t('settings.wallpaper_mode_opt.by_url') }} - - - - - - - - - - - - - - - - - - - - - - - - - {{ $t('settings.image_url_hint') }} - - - - - - - - {{ $t('common.performance_impact_warn') }} - - - - - - - - - - {{ $t('common.performance_impact_warn') }} - - - - + diff --git a/src/constants/imgs.ts b/src/constants/imgs.ts index 7be44271..df3face0 100644 --- a/src/constants/imgs.ts +++ b/src/constants/imgs.ts @@ -5,22 +5,24 @@ export const SEARCH_BAR_CHARACTERS: { name: string, url: string }[] = [ { name: '33 娘', url: 'https://cdn.jsdelivr.net/gh/BewlyBewly/Imgs/searchBarCharacters/33chan-2.png' }, ] -export const WALLPAPERS: { name: string, url: string, thumbnail: string }[] = [ - { - name: 'Unsplash Random Nature Image', - url: 'https://source.unsplash.com/1920x1080/?nature', - thumbnail: 'https://source.unsplash.com/1920x1080/?nature', - }, - { - name: 'Unsplash Random Building Image', - url: 'https://source.unsplash.com/1920x1080/?building', - thumbnail: 'https://source.unsplash.com/1920x1080/?building', - }, - { - name: 'Unsplash Random Night Scene Image', - url: 'https://source.unsplash.com/1920x1080/?night-scene', - thumbnail: 'https://source.unsplash.com/1920x1080/?night-scene', - }, +export interface wallpaperItem { name: string, url: string, thumbnail?: string } + +export const WALLPAPERS: wallpaperItem[] = [ + // { + // name: 'Unsplash Random Nature Image', + // url: 'https://source.unsplash.com/1920x1080/?nature', + // thumbnail: 'https://source.unsplash.com/1920x1080/?nature', + // }, + // { + // name: 'Unsplash Random Building Image', + // url: 'https://source.unsplash.com/1920x1080/?building', + // thumbnail: 'https://source.unsplash.com/1920x1080/?building', + // }, + // { + // name: 'Unsplash Random Night Scene Image', + // url: 'https://source.unsplash.com/1920x1080/?night-scene', + // thumbnail: 'https://source.unsplash.com/1920x1080/?night-scene', + // }, { name: 'LoremPicsum Random Image', url: 'https://picsum.photos/2560/1440/?nature', diff --git a/src/logic/storage.ts b/src/logic/storage.ts index 490fd7ec..4ca3b595 100644 --- a/src/logic/storage.ts +++ b/src/logic/storage.ts @@ -1,4 +1,5 @@ import { useStorageLocal } from '~/composables/useStorageLocal' +import type { wallpaperItem } from '~/constants/imgs' import type { HomeSubPage } from '~/contentScripts/views/Home/types' import type { AppPage } from '~/enums/appEnums' @@ -33,6 +34,7 @@ export interface Settings { enableWallpaperMasking: boolean wallpaperMaskOpacity: number wallpaperBlurIntensity: number + customizeWallpaper: wallpaperItem | null searchPageDarkenOnSearchFocus: boolean searchPageBlurredOnSearchFocus: boolean @@ -84,6 +86,7 @@ export const settings = useStorageLocal('settings', ref({ enableWallpaperMasking: false, wallpaperMaskOpacity: 80, wallpaperBlurIntensity: 0, + customizeWallpaper: null, searchPageDarkenOnSearchFocus: true, searchPageBlurredOnSearchFocus: false, diff --git a/src/styles/main.scss b/src/styles/main.scss index 7f4a372a..882c9acf 100644 --- a/src/styles/main.scss +++ b/src/styles/main.scss @@ -70,6 +70,22 @@ html.dark.bewly-design { } } +// Adjust broken image icon +img { + position: relative; + + &::before { + content: ""; + display: block; + width: 100%; + height: 100%; + background-image: url("/assets/broken-image.png"); + background-size: 25px; + background-position: center; + background-repeat: no-repeat; + } +} + // Change OverlayScrollbar color .os-scrollbar .os-scrollbar-handle { --os-handle-bg: rgba(120, 120, 140, 0.44);
- {{ $t('settings.image_url_hint') }} -
+ {{ $t('settings.image_url_hint') }} +