add: i18n support

This commit is contained in:
Hakadao
2022-04-06 22:26:58 +08:00
parent 0798a0d664
commit 02e5dcbded
18 changed files with 728 additions and 228 deletions

84
_locales/cmn-SC.yml Normal file
View File

@@ -0,0 +1,84 @@
topbar:
sign_in: 登录
notifications: 通知
moments: 动态
faviours: 收藏
history: 历史
creative_center: 创作中心
upload: 投稿
logo_dropdown:
anime: 番剧
movies: 电影
chinese_anime: 国创
tv_shows: 电视剧
variety_shows: 综艺
documentary_films: 纪录片
animations: 动画
gaming: 游戏
kichiku: 鬼畜
music: 音乐
dance: 舞蹈
cinephile: 影视
showbiz: 娱乐
knowledge: 知识
technology: 科技
news: 资讯
foods: 美食
life: 生活
cars: 汽车
fashion: 时尚
sports: 运动
animals: 动物圈
vlog: VLOG
funny: 搞笑
standalone_gaming: 单机游戏
vtubers: 虚拟主播
charitable_events: 公益
moocs: 公开课
articles: 专栏
live: 直播
activities: 活动
paid_courses: 课堂
community: 社区中心
music_plus: 新歌热榜
user_dropdown:
money: 硬币:
b_coins: B币
following: 关注
followers: 观众
posts: 动态
accout_settings: 个人中心
uploads_manager: 投稿管理
b_coins_wallet: B币钱包
orders: 订单中心
my_stream_info: 直播中心
my_courses: 我的课程
log_out: 退出登录
noti_dropdown:
replys: 回复我的
mentions: 提到我的
likes: 收到的赞
messages: 系统消息
chats: 我的消息
upload_dropdown:
article: 专栏
music: 音频
sticker: 贴纸
video: 视频
manager: 投稿
home:
loading_more: 加载中...
settings:
title: 设置
authorize_app: 授权 BewlyBewly 使用 Access Key
authorize_app_desc: 授权使用后能在首页推送我可能有兴趣观看的视频
topbar_visiable: 顶栏可见性
topbar_visiable_desc: 用于兼容 Bilibili Evolved 自定义顶栏
btn:
authorize: 授权
revoke: 取消授权
chk_box:
show: 显示
hidden: 隐藏

84
_locales/cmn-TC.yml Normal file
View File

@@ -0,0 +1,84 @@
topbar:
sign_in: 登入
notifications: 通知
moments: 動向
faviours: 收藏
history: 記錄
creative_center: 創作中心
upload: 上載
logo_dropdown:
anime: 番劇
movies: 電影
chinese_anime: 國創
tv_shows: 電視劇
variety_shows: 綜藝
documentary_films: 紀錄片
animations: 動畫
gaming: 遊戲
kichiku: 鬼畜
music: 音樂
dance: 舞蹈
cinephile: 影視
showbiz: 娛樂
knowledge: 知識
technology: 科技
news: 新聞
foods: 美食
life: 生活
cars: 汽車
fashion: 時尚
sports: 運動
animals: 動物圈
vlog: VLOG
funny: 搞笑
standalone_gaming: 單機遊戲
vtubers: Vtubers & Vups
charitable_events: 慈善
moocs: 開放式線上課程
articles: 專欄
live: 直播
activities: 活動
paid_courses: 課堂
community: 社羣中心
music_plus: 新歌熱榜
user_dropdown:
money: 硬幣:
b_coins: B幣
following: 追蹤
followers: 訂閱者
posts: 貼文
accout_settings: 帳戶資訊
uploads_manager: 內容管理
b_coins_wallet: B幣錢包
orders: 訂單資訊
my_stream_info: 實況首頁
my_courses: 我的課程
log_out: 退出登入
noti_dropdown:
replys: 回覆留言
mentions: 提及我的
likes: 按讚訊息
messages: 系统通知
chats: 聊天室
upload_dropdown:
article: 上載文章
music: 上載音訊
sticker: 上載貼圖
video: 上載影片
manager: 內容管理
home:
loading_more: 載入中...
settings:
title: 設定
authorize_app: 授權 BewlyBewly 使用 Access Key
authorize_app_desc: 授權使用後能在首頁推送我可能有興趣觀看的影片
topbar_visiable: 頂欄可視性
topbar_visiable_desc: 用於相容 Bilibili Evolved 的客製化頂欄
btn:
authorize: 授權
revoke: 解除授權
chk_box:
show: 顯示
hidden: 隱藏

84
_locales/en.yml Normal file
View File

@@ -0,0 +1,84 @@
topbar:
sign_in: Sign in
notifications: Notifications
moments: Moments
faviours: Faviours
history: History
creative_center: Creative Center
upload: Upload
logo_dropdown:
anime: Anime
movies: Movies
chinese_anime: Chinese anime
tv_shows: TV shows
variety_shows: Variety shows
documentary_films: Documentary films
animations: Animations
gaming: Gaming
kichiku: Kichiku
music: Music
dance: Dance
cinephile: Cinephile
showbiz: Showbiz
knowledge: Knowledge
technology: Technology
news: News
foods: Foods
life: Life
cars: Cars
fashion: Fashion
sports: Sports
animals: Animals
vlog: VLOG
funny: Funny
standalone_gaming: Standalone gaming
vtubers: Vtubers & Vups
charitable_events: Charitable events
moocs: MOOCs
articles: Articles
live: Live
activities: Activities
paid_courses: Paid courses
community: Community
music_plus: Music plus
user_dropdown:
money: 'Money: '
b_coins: 'B-coins: '
following: FOLLOWING
followers: FOLLOWERS
posts: POSTS
accout_settings: Account settings
uploads_manager: Uploads manager
b_coins_wallet: B-coins Wallet
orders: Orders
my_stream_info: My stream info
my_courses: My courses
log_out: Log out
noti_dropdown:
replys: Replys
mentions: Mentions
likes: Likes
messages: Messages
chats: Chats
upload_dropdown:
article: Article
music: Music
sticker: Sticker
video: Video
manager: Manager
home:
loading_more: Loading more...
settings:
title: Settings
authorize_app: Authorize BewlyBewly to use Access Key
authorize_app_desc: After being Authorized, you can get some you might like videos based on what you watch.
topbar_visiable: Topbar visiable
topbar_visiable_desc: Compatible with Bilibili Evolved customize topbar
btn:
authorize: Authorize
revoke: Revoke
chk_box:
show: Show
hidden: Hidden

84
_locales/jyut.yml Normal file
View File

@@ -0,0 +1,84 @@
topbar:
sign_in: 登入
notifications: 通知
moments: 動向
faviours: 賣飛佛
history: 記錄
creative_center: 創作中心
upload: 上載
logo_dropdown:
anime: 番劇
movies: 電影
chinese_anime: 國創
tv_shows: 電視劇
variety_shows: 綜藝
documentary_films: 紀錄片
animations: 動畫
gaming: 遊戲
kichiku: 鬼畜
music: 音樂
dance: 舞蹈
cinephile: 影視
showbiz: 娛樂
knowledge: 知識
technology: 科技
news: 新聞
foods: 美食
life: 生活
cars: 汽車
fashion: 時尚
sports: 運動
animals: 動物圈
vlog: VLOG
funny: 搞笑
standalone_gaming: 單機遊戲
vtubers: Vtubers & Vups
charitable_events: 慈善
moocs: 線上學堂
articles: 專欄
live: 直播
activities: 活動
paid_courses: 課堂
community: 社羣中心
music_plus: 新歌熱榜
user_dropdown:
money: 銀仔:
b_coins: B幣
following: 追蹤
followers: 訂閱者
posts: 貼文動向
accout_settings: 帳戶資料
uploads_manager: 內容管理
b_coins_wallet: B幣荷包
orders: 訂單資訊
my_stream_info: 實況首頁
my_courses: 我嘅課程
log_out: 登出
noti_dropdown:
replys: 覆我
mentions: 提起我
likes: 撳 like 訊息
messages: 系统通知
chats: 傾偈室
upload_dropdown:
article: 寫文
music: 擺音樂
sticker: 出貼圖
video: Po 片
manager: 內容管理
home:
loading_more: 撈緊...
settings:
title: 校做
authorize_app: 授權 BewlyBewly 使用 Access Key
authorize_app_desc: 授權咗之後首頁就會收到啲可能啱我心水嘅片
topbar_visiable: 頂欄可睇性
topbar_visiable_desc: 用於兼容 Bilibili Evolved 客製化頂欄
btn:
authorize: 授權
revoke: 解除授權
chk_box:
show: 擺出嚟
hidden: 收埋

View File

@@ -26,6 +26,7 @@
"@antfu/eslint-config": "^0.9.0",
"@ffflorian/jszip-cli": "^3.1.5",
"@iconify/json": "^1.1.408",
"@intlify/vite-plugin-vue-i18n": "^3.4.0",
"@types/chrome": "^0.0.179",
"@types/fs-extra": "^9.0.13",
"@types/node": "^16.10.2",
@@ -58,6 +59,7 @@
},
"dependencies": {
"esbuild-darwin-64": "0.13.3",
"vue-i18n": "9",
"vue-router": "4"
}
}

124
pnpm-lock.yaml generated
View File

@@ -4,6 +4,7 @@ specifiers:
'@antfu/eslint-config': ^0.9.0
'@ffflorian/jszip-cli': ^3.1.5
'@iconify/json': ^1.1.408
'@intlify/vite-plugin-vue-i18n': ^3.4.0
'@types/chrome': ^0.0.179
'@types/fs-extra': ^9.0.13
'@types/node': ^16.10.2
@@ -31,6 +32,7 @@ specifiers:
vite-plugin-windicss: ^1.4.8
vue: ^3.2.19
vue-demi: ^0.11.4
vue-i18n: '9'
vue-router: '4'
web-ext: ^6.4.0
webext-bridge: ^5.0.0
@@ -38,12 +40,14 @@ specifiers:
dependencies:
esbuild-darwin-64: 0.13.3
vue-i18n: 9.1.9_vue@3.2.19
vue-router: 4.0.13_vue@3.2.19
devDependencies:
'@antfu/eslint-config': 0.9.0_eslint@7.32.0+typescript@4.4.3
'@ffflorian/jszip-cli': 3.1.5
'@iconify/json': 1.1.408
'@intlify/vite-plugin-vue-i18n': 3.4.0_vite@2.6.2+vue-i18n@9.1.9
'@types/chrome': 0.0.179
'@types/fs-extra': 9.0.13
'@types/node': 16.10.2
@@ -495,6 +499,104 @@ packages:
resolution: {integrity: sha512-GceXOj/a8FqPKT19umdPdV+yyxGyv9karZRWBTAseaO8jNdFzcj6Def77ZgysxkxilP+MWloW1/CAznPbE08xw==}
dev: true
/@intlify/bundle-utils/2.2.2_vue-i18n@9.1.9:
resolution: {integrity: sha512-vngkvlIVV8ZJoyC5VqMvqJd2nvsx+qMN7pQjPiPjOrVndeiR7Dlue0k86Q8FsFUzyksW3HJZZi833ldxwbFzTA==}
engines: {node: '>= 12'}
peerDependencies:
petite-vue-i18n: '*'
vue-i18n: '*'
peerDependenciesMeta:
petite-vue-i18n:
optional: true
vue-i18n:
optional: true
dependencies:
'@intlify/message-compiler': 9.1.9
'@intlify/shared': 9.1.9
jsonc-eslint-parser: 1.3.1
source-map: 0.6.1
vue-i18n: 9.1.9_vue@3.2.19
yaml-eslint-parser: 0.3.2
dev: true
/@intlify/core-base/9.1.9:
resolution: {integrity: sha512-x5T0p/Ja0S8hs5xs+ImKyYckVkL4CzcEXykVYYV6rcbXxJTe2o58IquSqX9bdncVKbRZP7GlBU1EcRaQEEJ+vw==}
engines: {node: '>= 10'}
dependencies:
'@intlify/devtools-if': 9.1.9
'@intlify/message-compiler': 9.1.9
'@intlify/message-resolver': 9.1.9
'@intlify/runtime': 9.1.9
'@intlify/shared': 9.1.9
'@intlify/vue-devtools': 9.1.9
dev: false
/@intlify/devtools-if/9.1.9:
resolution: {integrity: sha512-oKSMKjttG3Ut/1UGEZjSdghuP3fwA15zpDPcjkf/1FjlOIm6uIBGMNS5jXzsZy593u+P/YcnrZD6cD3IVFz9vQ==}
engines: {node: '>= 10'}
dependencies:
'@intlify/shared': 9.1.9
dev: false
/@intlify/message-compiler/9.1.9:
resolution: {integrity: sha512-6YgCMF46Xd0IH2hMRLCssZI3gFG4aywidoWQ3QP4RGYQXQYYfFC54DxhSgfIPpVoPLQ+4AD29eoYmhiHZ+qLFQ==}
engines: {node: '>= 10'}
dependencies:
'@intlify/message-resolver': 9.1.9
'@intlify/shared': 9.1.9
source-map: 0.6.1
/@intlify/message-resolver/9.1.9:
resolution: {integrity: sha512-Lx/DBpigeK0sz2BBbzv5mu9/dAlt98HxwbG7xLawC3O2xMF9MNWU5FtOziwYG6TDIjNq0O/3ZbOJAxwITIWXEA==}
engines: {node: '>= 10'}
/@intlify/runtime/9.1.9:
resolution: {integrity: sha512-XgPw8+UlHCiie3fI41HPVa/VDJb3/aSH7bLhY1hJvlvNV713PFtb4p4Jo+rlE0gAoMsMCGcsiT982fImolSltg==}
engines: {node: '>= 10'}
dependencies:
'@intlify/message-compiler': 9.1.9
'@intlify/message-resolver': 9.1.9
'@intlify/shared': 9.1.9
dev: false
/@intlify/shared/9.1.9:
resolution: {integrity: sha512-xKGM1d0EAxdDFCWedcYXOm6V5Pfw/TMudd6/qCdEb4tv0hk9EKeg7lwQF1azE0dP2phvx0yXxrt7UQK+IZjNdw==}
engines: {node: '>= 10'}
/@intlify/vite-plugin-vue-i18n/3.4.0_vite@2.6.2+vue-i18n@9.1.9:
resolution: {integrity: sha512-XXcZBgwJ+3FRu11c4ARoY9N00kElPii0/jNZ49qR045Ka7/YGCwb1Ku14BBlMSEHiHDSjLQknLwrJKSQGVZLyA==}
engines: {node: '>= 12'}
peerDependencies:
petite-vue-i18n: ^9.1.0
vite: ^2.0.0
vue-i18n: ^9.1.0
peerDependenciesMeta:
petite-vue-i18n:
optional: true
vue-i18n:
optional: true
dependencies:
'@intlify/bundle-utils': 2.2.2_vue-i18n@9.1.9
'@intlify/shared': 9.1.9
'@rollup/pluginutils': 4.1.2
debug: 4.3.2
fast-glob: 3.2.7
source-map: 0.6.1
vite: 2.6.2_sass@1.49.9
vue-i18n: 9.1.9_vue@3.2.19
transitivePeerDependencies:
- supports-color
dev: true
/@intlify/vue-devtools/9.1.9:
resolution: {integrity: sha512-YPehH9uL4vZcGXky4Ev5qQIITnHKIvsD2GKGXgqf+05osMUI6WSEQHaN9USRa318Rs8RyyPCiDfmA0hRu3k7og==}
engines: {node: '>= 10'}
dependencies:
'@intlify/message-resolver': 9.1.9
'@intlify/runtime': 9.1.9
'@intlify/shared': 9.1.9
dev: false
/@mdn/browser-compat-data/4.0.2:
resolution: {integrity: sha512-XGLqWi1uOil0L4TJs9KOTMRl9FdEtRQLvBDaB7++AFnFf9G0QYihiUNRJ4eXZa53KI9VORsEi3Fj8p3N+m/Gdw==}
dev: true
@@ -4865,7 +4967,6 @@ packages:
/source-map/0.6.1:
resolution: {integrity: sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==}
engines: {node: '>=0.10.0'}
dev: true
/sourcemap-codec/1.4.8:
resolution: {integrity: sha512-9NykojV5Uih4lgo5So5dtw+f0JgJX30KCNI8gwhz2J9A15wD0Ml6tjHKwf6fTSa6fAdVBdZeNOs9eJ71qCk8vA==}
@@ -5592,6 +5693,19 @@ packages:
- supports-color
dev: true
/vue-i18n/9.1.9_vue@3.2.19:
resolution: {integrity: sha512-JeRdNVxS2OGp1E+pye5XB6+M6BBkHwAv9C80Q7+kzoMdUDGRna06tjC0vCB/jDX9aWrl5swxOMFcyAr7or8XTA==}
engines: {node: '>= 10'}
peerDependencies:
vue: ^3.0.0
dependencies:
'@intlify/core-base': 9.1.9
'@intlify/shared': 9.1.9
'@intlify/vue-devtools': 9.1.9
'@vue/devtools-api': 6.0.12
vue: 3.2.19
dev: false
/vue-router/4.0.13_vue@3.2.19:
resolution: {integrity: sha512-LmXrC+BkDRLak+d5xTMgUYraT3Nj0H/vCbP+7usGvIl9Viqd1UP6AsP0i69pSbn9O0dXK/xCdp4yPw21HqV9Jw==}
peerDependencies:
@@ -5810,6 +5924,14 @@ packages:
resolution: {integrity: sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==}
dev: true
/yaml-eslint-parser/0.3.2:
resolution: {integrity: sha512-32kYO6kJUuZzqte82t4M/gB6/+11WAuHiEnK7FreMo20xsCKPeFH5tDBU7iWxR7zeJpNnMXfJyXwne48D0hGrg==}
dependencies:
eslint-visitor-keys: 1.3.0
lodash: 4.17.21
yaml: 1.10.2
dev: true
/yaml-eslint-parser/0.4.1:
resolution: {integrity: sha512-GoJ/p1EW8O2tbTbuhfxjo1XhfUFU3uX3kwvfEQoOaZjO2Lubx8POjlsSqB+18b3SxkujAdQYT9r9nURaUWNYWQ==}
dependencies:

View File

@@ -1,60 +1,3 @@
<template>
<div class="fixed w-full h-full top-0 left-0 bg-black bg-opacity-30" z="9998" @click="close"></div>
<div id="settings-window" z="9999">
<div
class="absolute right-0 top-0 transform translate-x-1/2 -translate-y-1/2"
text="2xl"
font="leading-0"
bg="$bew-content-solid-1"
w="32px"
h="32px"
p="1"
rounded="full"
shadow="md"
cursor="pointer"
@click="close"
>
<ic-baseline-clear />
</div>
<div text="3xl" m="b-4">
Settings
</div>
<div class="settings-item">
<div>
Authorize BewlyBewly to use Access Key
<br />
<span class="desc">This change will make you able to get some suggested videos</span>
</div>
<button
v-if="accessKey + '' === 'undefined' || accessKey + '' === 'null'"
ref="authorizeBtn"
class="btn"
@click="onAuthorize"
>
Authorize
</button>
<button v-else class="line-btn" @click="onRevoke">
<span>Revoke</span>
</button>
</div>
<div class="settings-item">
<div>
Topbar visiable
<br />
<span class="desc">Compatible with bilibili evolved</span>
</div>
<div>
<label for="topbarVisiable" class="chk-btn" cursor="pointer" pointer="auto">
<template v-if="isShowTopbar">Show</template>
<template v-else>Hidden</template>
<input id="topbarVisiable" v-model="isShowTopbar" type="checkbox" />
</label>
</div>
</div>
</div>
</template>
<script lang="ts">
import { grantAccessKey, revokeAccessKey } from '~/utils/index'
import { isShowTopbar, apperance, accessKey } from '~/logic/storage'
@@ -83,6 +26,63 @@ export default defineComponent({
})
</script>
<template>
<div class="fixed w-full h-full top-0 left-0 bg-black bg-opacity-30" z="9998" @click="close"></div>
<div id="settings-window" z="9999">
<div
class="absolute right-0 top-0 transform translate-x-1/2 -translate-y-1/2"
text="2xl"
font="leading-0"
bg="$bew-content-solid-1"
w="32px"
h="32px"
p="1"
rounded="full"
shadow="md"
cursor="pointer"
@click="close"
>
<ic-baseline-clear />
</div>
<div text="3xl" m="b-4">
{{ $t('settings.title') }}
</div>
<div class="settings-item">
<div>
{{ $t('settings.authorize_app') }}
<br />
<span class="desc">{{ $t('settings.authorize_app_desc') }}</span>
</div>
<button
v-if="accessKey + '' === 'undefined' || accessKey + '' === 'null'"
ref="authorizeBtn"
class="btn"
@click="onAuthorize"
>
{{ $t('settings.btn.authorize') }}
</button>
<button v-else class="line-btn" @click="onRevoke">
<span>{{ $t('settings.btn.revoke') }}</span>
</button>
</div>
<div class="settings-item">
<div>
{{ $t('settings.topbar_visiable') }}
<br />
<span class="desc">{{ $t('settings.topbar_visiable_desc') }}</span>
</div>
<div>
<label for="topbarVisiable" class="chk-btn" cursor="pointer" pointer="auto">
<template v-if="isShowTopbar">{{ $t('settings.chk_box.show') }}</template>
<template v-else>{{ $t('settings.chk_box.hidden') }}</template>
<input id="topbarVisiable" v-model="isShowTopbar" type="checkbox" />
</label>
</div>
</div>
</div>
</template>
<style lang="scss">
#settings-window {
@apply fixed top-1/5 left-1/2 w-700px h-1/2

View File

@@ -1,3 +1,45 @@
<script setup lang="ts">
import { useI18n } from 'vue-i18n'
const { t } = useI18n()
const genres = [
{ name: t('topbar.logo_dropdown.anime'), icon: '#channel-anime', href: 'https://www.bilibili.com/anime' },
{ name: t('topbar.logo_dropdown.movies'), icon: '#channel-movie', href: 'https://www.bilibili.com/movie' },
{ name: t('topbar.logo_dropdown.chinese_anime'), icon: '#channel-guochuang', href: 'https://www.bilibili.com/guochuang' },
{ name: t('topbar.logo_dropdown.tv_shows'), icon: '#channel-teleplay', href: 'https://www.bilibili.com/tv' },
{ name: t('topbar.logo_dropdown.variety_shows'), icon: '#channel-zongyi', href: 'https://www.bilibili.com/variety' },
{ name: t('topbar.logo_dropdown.documentary_films'), icon: '#channel-documentary', href: 'https://www.bilibili.com/documentary' },
{ name: t('topbar.logo_dropdown.animations'), icon: '#channel-douga', href: 'https://www.bilibili.com/v/douga' },
{ name: t('topbar.logo_dropdown.gaming'), icon: '#channel-game', href: 'https://www.bilibili.com/v/game' },
{ name: t('topbar.logo_dropdown.kichiku'), icon: '#channel-kichiku', href: 'https://www.bilibili.com/v/kichiku' },
{ name: t('topbar.logo_dropdown.music'), icon: '#channel-music', href: 'https://www.bilibili.com/v/music' },
{ name: t('topbar.logo_dropdown.dance'), icon: '#channel-dance', href: 'https://www.bilibili.com/v/dance' },
{ name: t('topbar.logo_dropdown.cinephile'), icon: '#channel-cinephile', href: 'https://www.bilibili.com/v/cinephile' },
{ name: t('topbar.logo_dropdown.showbiz'), icon: '#channel-ent', href: 'https://www.bilibili.com/v/ent' },
{ name: t('topbar.logo_dropdown.knowledge'), icon: '#channel-knowledge', href: 'https://www.bilibili.com/v/knowledge' },
{ name: t('topbar.logo_dropdown.technology'), icon: '#channel-tech', href: 'https://www.bilibili.com/v/tech' },
{ name: t('topbar.logo_dropdown.news'), icon: '#channel-information', href: 'https://www.bilibili.com/v/information' },
{ name: t('topbar.logo_dropdown.foods'), icon: '#channel-food', href: 'https://www.bilibili.com/v/food' },
{ name: t('topbar.logo_dropdown.life'), icon: '#channel-life', href: 'https://www.bilibili.com/v/life' },
{ name: t('topbar.logo_dropdown.cars'), icon: '#channel-car', href: 'https://www.bilibili.com/v/car' },
{ name: t('topbar.logo_dropdown.fashion'), icon: '#channel-fashion', href: 'https://www.bilibili.com/v/fashion' },
{ name: t('topbar.logo_dropdown.sports'), icon: '#channel-sports', href: 'https://www.bilibili.com/v/sports' },
{ name: t('topbar.logo_dropdown.animals'), icon: '#channel-animal', href: 'https://www.bilibili.com/v/animal' },
{ name: t('topbar.logo_dropdown.vlog'), icon: '#channel-vlog', href: 'https://www.bilibili.com/v/life/daily/#/530003' },
{ name: t('topbar.logo_dropdown.funny'), icon: '#channel-gaoxiao', href: 'https://www.bilibili.com/v/life/funny' },
{ name: t('topbar.logo_dropdown.standalone_gaming'), icon: '#channel-danjiyouxi', href: 'https://www.bilibili.com/v/game/stand_alone' },
{ name: t('topbar.logo_dropdown.vtubers'), icon: '#channel-vtuber', href: 'https://www.bilibili.com/v/virtual' },
{ name: t('topbar.logo_dropdown.charitable_events'), icon: '#channel-love', href: 'https://love.bilibili.com' },
{ name: t('topbar.logo_dropdown.moocs'), icon: '#channel-gongkaike', href: 'https://www.bilibili.com/mooc' },
{ name: t('topbar.logo_dropdown.articles'), icon: '#channel-read', href: 'https://www.bilibili.com/read/home' },
{ name: t('topbar.logo_dropdown.live'), icon: '#channel-live', href: 'https://live.bilibili.com' },
{ name: t('topbar.logo_dropdown.activities'), icon: '#channel-activity', href: 'https://www.bilibili.com/blackboard/activity-list.html' },
{ name: t('topbar.logo_dropdown.paid_courses'), icon: '#channel-zhishi', href: 'https://www.bilibili.com/cheese' },
{ name: t('topbar.logo_dropdown.community'), icon: '#channel-blackroom', href: 'https://www.bilibili.com/blackboard/activity-5zJxM3spoS.html' },
{ name: t('topbar.logo_dropdown.music_plus'), icon: '#channel-musicplus', href: 'https://www.bilibili.com/v/musicplus' },
]
</script>
<template>
<div
style="backdrop-filter: var(--bew-filter-glass); box-shadow: var(--bew-shadow-3);"
@@ -38,45 +80,6 @@
</div>
</template>
<script setup lang="ts">
const genres = [
{ name: 'Anime', icon: '#channel-anime', href: 'https://www.bilibili.com/anime' },
{ name: 'Movies', icon: '#channel-movie', href: 'https://www.bilibili.com/movie' },
{ name: 'Chinese anime', icon: '#channel-guochuang', href: 'https://www.bilibili.com/guochuang' },
{ name: 'TV shows', icon: '#channel-teleplay', href: 'https://www.bilibili.com/tv' },
{ name: 'Variety shows', icon: '#channel-zongyi', href: 'https://www.bilibili.com/variety' },
{ name: 'Documentary films', icon: '#channel-documentary', href: 'https://www.bilibili.com/documentary' },
{ name: 'Animations', icon: '#channel-douga', href: 'https://www.bilibili.com/v/douga' },
{ name: 'Gaming', icon: '#channel-game', href: 'https://www.bilibili.com/v/game' },
{ name: 'Kichiku', icon: '#channel-kichiku', href: 'https://www.bilibili.com/v/kichiku' },
{ name: 'Music', icon: '#channel-music', href: 'https://www.bilibili.com/v/music' },
{ name: 'Dance', icon: '#channel-dance', href: 'https://www.bilibili.com/v/dance' },
{ name: 'Cinephile', icon: '#channel-cinephile', href: 'https://www.bilibili.com/v/cinephile' },
{ name: 'Showbiz', icon: '#channel-ent', href: 'https://www.bilibili.com/v/ent' },
{ name: 'Knowledge', icon: '#channel-knowledge', href: 'https://www.bilibili.com/v/knowledge' },
{ name: 'Technology', icon: '#channel-tech', href: 'https://www.bilibili.com/v/tech' },
{ name: 'News', icon: '#channel-information', href: 'https://www.bilibili.com/v/information' },
{ name: 'Foods', icon: '#channel-food', href: 'https://www.bilibili.com/v/food' },
{ name: 'Life', icon: '#channel-life', href: 'https://www.bilibili.com/v/life' },
{ name: 'Cars', icon: '#channel-car', href: 'https://www.bilibili.com/v/car' },
{ name: 'Fashion', icon: '#channel-fashion', href: 'https://www.bilibili.com/v/fashion' },
{ name: 'Sports', icon: '#channel-sports', href: 'https://www.bilibili.com/v/sports' },
{ name: 'Animals', icon: '#channel-animal', href: 'https://www.bilibili.com/v/animal' },
{ name: 'VLOG', icon: '#channel-vlog', href: 'https://www.bilibili.com/v/life/daily/#/530003' },
{ name: 'Funny', icon: '#channel-gaoxiao', href: 'https://www.bilibili.com/v/life/funny' },
{ name: 'Standalone gaming', icon: '#channel-danjiyouxi', href: 'https://www.bilibili.com/v/game/stand_alone' },
{ name: 'Vtubers & Vups', icon: '#channel-vtuber', href: 'https://www.bilibili.com/v/virtual' },
{ name: 'Charitable events', icon: '#channel-love', href: 'https://love.bilibili.com' },
{ name: 'MOOCs', icon: '#channel-gongkaike', href: 'https://www.bilibili.com/mooc' },
{ name: 'Articles', icon: '#channel-read', href: 'https://www.bilibili.com/read/home' },
{ name: 'Live', icon: '#channel-live', href: 'https://live.bilibili.com' },
{ name: 'Activities', icon: '#channel-activity', href: 'https://www.bilibili.com/blackboard/activity-list.html' },
{ name: 'Paid courses', icon: '#channel-zhishi', href: 'https://www.bilibili.com/cheese' },
{ name: 'Community', icon: '#channel-blackroom', href: 'https://www.bilibili.com/blackboard/activity-5zJxM3spoS.html' },
{ name: 'Music plus', icon: '#channel-musicplus', href: 'https://www.bilibili.com/v/musicplus' },
]
</script>
<style lang="scss" scoped>
.svg-icon {
width: 2em;

View File

@@ -48,27 +48,27 @@ export default defineComponent({
return {
list: [
{
name: 'Replys',
name: this.$t('topbar.noti_dropdown.replys'),
url: 'https://message.bilibili.com/#/reply',
unreadCount: 0,
},
{
name: 'Mentions',
name: this.$t('topbar.noti_dropdown.mentions'),
url: 'https://message.bilibili.com/#/at',
unreadCount: 0,
},
{
name: 'Likes',
name: this.$t('topbar.noti_dropdown.likes'),
url: 'https://message.bilibili.com/#/love',
unreadCount: 0,
},
{
name: 'Messages',
name: this.$t('topbar.noti_dropdown.messages'),
url: 'https://message.bilibili.com/#/system',
unreadCount: 0,
},
{
name: 'Chats',
name: this.$t('topbar.noti_dropdown.chats'),
url: 'https://message.bilibili.com/#/whisper',
unreadCount: 0,
},

View File

@@ -5,7 +5,7 @@
rounded="$bew-radius"
style="box-shadow: var(--bew-shadow-3);"
p="4"
w="180px"
w="150px"
>
<a
class="upload-item"
@@ -60,7 +60,7 @@
/>
</svg>
<div>Article</div>
<div>{{ $t('topbar.upload_dropdown.article') }}</div>
</a>
<a
class="upload-item"
@@ -123,7 +123,7 @@
/>
</svg>
<div>Music</div>
<div>{{ $t('topbar.upload_dropdown.music') }}</div>
</a>
<a
class="upload-item"
@@ -182,7 +182,7 @@
/>
</svg>
<div>Sticker</div>
<div>{{ $t('topbar.upload_dropdown.sticker') }}</div>
</a>
<a
class="upload-item"
@@ -228,7 +228,7 @@
/>
</svg>
<div>Video</div>
<div>{{ $t('topbar.upload_dropdown.video') }}</div>
</a>
<a
class="upload-item"
@@ -259,7 +259,7 @@
/>
</svg>
<div>Management</div>
<div>{{ $t('topbar.upload_dropdown.manager') }}</div>
</a>
</div>
</template>

View File

@@ -54,11 +54,11 @@ export default defineComponent({
class="mr-4"
href="https://account.bilibili.com/account/coin"
target="_blank"
>Money: {{ userInfo.money }}</a>
>{{ $t('topbar.user_dropdown.money') + userInfo.money }}</a>
<a
href="https://pay.bilibili.com/pay-v2-web/bcoin_index"
target="_blank"
>B-coin: {{ userInfo.wallet?.bcoin_balance }}</a>
>{{ $t('topbar.user_dropdown.b_coins') + userInfo.wallet?.bcoin_balance }}</a>
</div>
<div id="channel-info">
<a
@@ -67,7 +67,7 @@ export default defineComponent({
:title="userStat.following"
>
<div class="num">{{ userStat.following ? numFormatter(userStat.following) : '0' }}</div>
<div>following</div>
<div>{{ $t('topbar.user_dropdown.following') }}</div>
</a>
<a
:href="'https://space.bilibili.com/' + mid + '/fans/fans'"
@@ -75,7 +75,7 @@ export default defineComponent({
:title="userStat.follower"
>
<div class="num">{{ userStat.follower ? numFormatter(userStat.follower) : '0' }}</div>
<div>follower</div>
<div>{{ $t('topbar.user_dropdown.followers') }}</div>
</a>
<a
href="https://t.bilibili.com/"
@@ -83,36 +83,36 @@ export default defineComponent({
:title="userStat.dynamic_count"
>
<div class="num">{{ userStat.dynamic_count ? numFormatter(userStat.dynamic_count) : '0' }}</div>
<div>posts</div>
<div>{{ $t('topbar.user_dropdown.posts') }}</div>
</a>
</div>
<div id="other-link">
<a href="https://account.bilibili.com/account/home" target="_blank">
Account settings
{{ $t('topbar.user_dropdown.accout_settings') }}
<tabler:arrow-right />
</a>
<a href="https://member.bilibili.com/v2#/upload-manager/article" target="_blank">
Uploads manager
{{ $t('topbar.user_dropdown.uploads_manager') }}
<tabler:arrow-right />
</a>
<a href="https://pay.bilibili.com/" target="_blank">
B-coin Wallet
{{ $t('topbar.user_dropdown.b_coins_wallet') }}
<tabler:arrow-right />
</a>
<a href="https://show.bilibili.com/orderlist" target="_blank">
Orders
{{ $t('topbar.user_dropdown.orders') }}
<tabler:arrow-right />
</a>
<a href="https://link.bilibili.com/p/center/index" target="_blank">
My stream info
{{ $t('topbar.user_dropdown.my_stream_info') }}
<tabler:arrow-right />
</a>
<a href="https://www.bilibili.com/cheese/mine/list" target="_blank">
My course
{{ $t('topbar.user_dropdown.my_courses') }}
<tabler:arrow-right />
</a>
<div id="logout" @click="logout()">
Log out
{{ $t('topbar.user_dropdown.log_out') }}
</div>
</div>
</div>
@@ -144,10 +144,10 @@ export default defineComponent({
}
.num {
@apply font-bold text-xl;
@apply font-semibold text-xl;
+ div {
@apply text-$bew-text-2;
@apply text-$bew-text-2 mt-1 text-xs font-semibold;
}
}
}

View File

@@ -152,7 +152,7 @@ export default defineComponent({
<div class="right-side">
<div v-if="!isLogin" class="right-side-item">
<a href="https://passport.bilibili.com/login" class="login">
<ic-outline-account-circle class="text-base mr-2" />LOGIN IN
<ic-outline-account-circle class="text-base mr-2" />{{ $t('topbar.sign_in') }}
</a>
</div>
<template v-if="isLogin">
@@ -196,7 +196,11 @@ export default defineComponent({
>
{{ unReadmessageCount > 999 ? '999+' : unReadmessageCount }}
</div>
<a href="https://message.bilibili.com" target="_blank" title="Notifications">
<a
href="https://message.bilibili.com"
target="_blank"
:title="$t('topbar.notifications')"
>
<tabler:bell />
</a>
@@ -215,7 +219,11 @@ export default defineComponent({
>
{{ newMomentsCount > 999 ? '999+' : newMomentsCount }}
</div>
<a href="https://t.bilibili.com" target="_blank" title="Moments">
<a
href="https://t.bilibili.com"
target="_blank"
:title="$t('topbar.moments')"
>
<tabler:windmill />
</a>
</div>
@@ -223,13 +231,17 @@ export default defineComponent({
<a
:href="'https://space.bilibili.com/' + mid + '/favlist'"
target="_blank"
title="Faviours"
:title="$t('topbar.favorites')"
>
<tabler:star />
</a>
</div>
<div class="right-side-item">
<a href="https://www.bilibili.com/account/history" target="_blank" title="History">
<a
href="https://www.bilibili.com/account/history"
target="_blank"
:title="$t('topbar.history')"
>
<tabler:clock />
</a>
</div>
@@ -237,7 +249,7 @@ export default defineComponent({
<a
href="https://member.bilibili.com/platform/home"
target="_blank"
title="Creative Center"
:title="$t('topbar.creative_center')"
>
<tabler:bulb />
</a>
@@ -259,7 +271,7 @@ export default defineComponent({
<span
m="l-2"
display="xl:block <xl:hidden"
>Upload</span>
>{{ $t('topbar.upload') }}</span>
</a>
<transition name="slide">

View File

@@ -1,11 +1,13 @@
/* eslint-disable no-console */
import { onMessage } from 'webext-bridge'
import { createApp } from 'vue'
import App from './views/App.vue'
import { getCookie, setCookie, SVG_ICONS } from '~/utils'
import { createI18n } from 'vue-i18n'
// Firefox `browser.tabs.executeScript()` requires scripts return a primitive value
;(() => {
import App from './views/App.vue'
import { getCookie, i18n, setCookie, SVG_ICONS } from '~/utils'
(() => {
console.info('[vitesse-webext] Hello world from content script')
// communication example: send previous tab title from background page
@@ -40,7 +42,8 @@ import { getCookie, setCookie, SVG_ICONS } from '~/utils'
container.appendChild(styleEl)
container.appendChild(root)
document.body.appendChild(container)
createApp(App).mount(root)
createApp(App).use(i18n).mount(root)
// inject svg icons
const svgDiv = document.createElement('div')

View File

@@ -1,98 +1,3 @@
<template>
<div
m="x-22 b-0 t-0"
grid="~ xl:cols-4 lg:cols-3 md:cols-2 gap-4"
>
<transition-group
name="list"
@enter="onEnter"
>
<div
v-for="(video, index) in videoList"
:key="video.idx"
:data-index="index"
class="video-card"
>
<a :href="'/video/av' + video.uri.split('/')[3]" target="_blank">
<div class="thumbnail">
<div class="duration">{{ calcCurrentTime(video.duration) }}</div>
<div
class="overflow-hidden w-full relative rounded-$bew-radius z-1"
style="aspect-ratio: 16/9"
>
<img class="cover" :src="video.cover + '@672w_378h_1c'" loading="lazy" />
</div>
<img class="cover-shadow" :src="video.cover + '@672w_378h_1c'" loading="lazy" />
</div>
<div class="detail">
<div class="flex">
<a class="avatar" @click="gotoChannel(video.mid)">
<img
:src="(video.face + '').replace('http:', '') + '@60w_60h_1c'"
width="48"
height="48"
loading="lazy"
/>
</a>
</div>
<div class="meta">
<h3 class="video-title" :title="video.title">{{ video.title }}</h3>
<div class="channel-name" @click="gotoChannel(video.mid)">{{ video.name }}</div>
<div class="video-info">
{{ numFormatter(video.play) }} views
<span class="text-xs font-light"></span>
{{ calcTimeSince(new Date(video.ctime * 1000)) }} ago
</div>
</div>
</div>
</a>
</div>
</transition-group>
</div>
<div
v-if="isLoading"
w="full"
h="46px"
p="y-8"
flex="~"
justify="center"
items="center"
>
<img
src="https://s2.loli.net/2022/03/20/4YZhnF1cmya6tHO.gif"
alt="loading"
w="46px"
h="46px"
m="r-2"
/>
Loading more...
</div>
<div
v-if="!isLoading"
style="height: 100px"
w="full"
p="y-8"
flex="~"
items="center"
justify="center"
>
<button
style="box-shadow: var(--bew-shadow-1);"
bg="$bew-content-1"
p="x-8 y-4"
text="$bew-text-1"
rounded="$bew-radius"
flex="~"
items="center"
@click="onRefresh"
>
<tabler:refresh class="mr-2" />Click to refresh
</button>
</div>
</template>
<script lang="ts">
import { accessKey } from '~/logic/storage'
import { numFormatter, calcTimeSince, calcCurrentTime } from '~/utils'
@@ -163,6 +68,103 @@ export default defineComponent({
})
</script>
<template>
<div
m="x-22 b-0 t-0"
grid="~ xl:cols-4 lg:cols-3 md:cols-2 gap-4"
>
<transition-group
name="list"
@enter="onEnter"
>
<div
v-for="(video, index) in videoList"
:key="video.idx"
:data-index="index"
class="video-card"
>
<a :href="'/video/av' + video.uri.split('/')[3]" target="_blank">
<div class="thumbnail">
<div class="duration">{{ calcCurrentTime(video.duration) }}</div>
<div
class="overflow-hidden w-full relative rounded-$bew-radius z-1"
style="aspect-ratio: 16/9"
>
<img class="cover" :src="video.cover + '@672w_378h_1c'" loading="lazy" />
</div>
<img class="cover-shadow" :src="video.cover + '@672w_378h_1c'" loading="lazy" />
</div>
<div class="detail">
<div class="flex">
<a class="avatar" @click="gotoChannel(video.mid)">
<img
:src="(video.face + '').replace('http:', '') + '@60w_60h_1c'"
width="48"
height="48"
loading="lazy"
/>
</a>
</div>
<div class="meta">
<h3 class="video-title" :title="video.title">{{ video.title }}</h3>
<div class="channel-name" @click="gotoChannel(video.mid)">{{ video.name }}</div>
<div class="video-info">
{{ numFormatter(video.play) }} views
<span class="text-xs font-light"></span>
{{ calcTimeSince(new Date(video.ctime * 1000)) }} ago
</div>
</div>
</div>
</a>
</div>
</transition-group>
</div>
<div
v-if="isLoading"
w="full"
h="46px"
p="y-8"
flex="~"
justify="center"
items="center"
>
<img
src="https://s2.loli.net/2022/03/20/4YZhnF1cmya6tHO.gif"
alt="loading"
w="46px"
h="46px"
m="r-2"
/>
{{ $t('home.loading_more') }}
</div>
<div
v-if="!isLoading"
style="height: 100px"
w="full"
p="y-8"
flex="~"
items="center"
justify="center"
>
<button
style="box-shadow: var(--bew-shadow-1);"
bg="!$bew-theme-color"
w="60px"
h="60px"
text="white 2xl"
rounded="full"
flex="~"
justify="center"
items="center"
@click="onRefresh"
>
<tabler:refresh />
</button>
</div>
</template>
<style lang="scss" scoped>
.list-move,
.list-enter-active,

9
src/utils/i18n.ts Normal file
View File

@@ -0,0 +1,9 @@
import { createI18n } from 'vue-i18n'
import messages from '@intlify/vite-plugin-vue-i18n/messages'
export const i18n = createI18n({
legacy: false,
locale: 'jyut',
globalInjection: true,
messages,
})

View File

@@ -1,10 +1,12 @@
import { grantAccessKey, revokeAccessKey } from './auth-provider'
import { SVG_ICONS } from './svgIcons'
import { i18n } from './i18n'
export {
grantAccessKey,
revokeAccessKey,
SVG_ICONS,
i18n,
}
export * from './dataFormatter'

View File

@@ -15,6 +15,7 @@
"types": [
"vite/client",
"chrome",
"@intlify/vite-plugin-vue-i18n/client"
],
"paths": {
"~/*": ["src/*"],

View File

@@ -5,6 +5,7 @@ import Icons from 'unplugin-icons/vite'
import IconsResolver from 'unplugin-icons/resolver'
import Components from 'unplugin-vue-components/vite'
import AutoImport from 'unplugin-auto-import/vite'
import VueI18n from '@intlify/vite-plugin-vue-i18n'
import WindiCSS from 'vite-plugin-windicss'
import windiConfig from './windi.config'
import { r, port, isDev } from './scripts/utils'
@@ -50,6 +51,13 @@ export const sharedConfig: UserConfig = {
// https://github.com/antfu/unplugin-icons
Icons(),
// https://github.com/intlify/bundle-tools/tree/main/packages/vite-plugin-vue-i18n
VueI18n({
runtimeOnly: true,
compositionOnly: true,
include: [r('./_locales/**')],
}),
// rewrite assets to use relative path
{
name: 'assets-rewrite',