Skip to content

Commit

Permalink
新增 VideoTogether 注入功能
Browse files Browse the repository at this point in the history
  • Loading branch information
MagmaBlock committed Jan 23, 2024
1 parent aaae4fe commit 5c311ee
Show file tree
Hide file tree
Showing 3 changed files with 60 additions and 1 deletion.
25 changes: 24 additions & 1 deletion src/App.vue
Original file line number Diff line number Diff line change
@@ -1,6 +1,29 @@
<script setup>
import View from "./views/View.vue";
import ThemeProvier from './components/ThemeProvier.vue'
import ThemeProvier from "./components/ThemeProvier.vue";
import { useScriptTag, useStorage } from "@vueuse/core";
import { watch } from "vue";
// 一起看相关脚本处理
const { scriptTag, load, unload } = useScriptTag(
"https://2gether.video/release/extension.website.user.js",
() => {
// do something
},
{ manual: true }
);
const enableVideoTogether = useStorage("enableVideoTogether", false);
watch(enableVideoTogether, applyVideoTogether);
applyVideoTogether();
async function applyVideoTogether() {
if (enableVideoTogether.value) {
await load();
}
}
</script>

<template>
Expand Down
34 changes: 34 additions & 0 deletions src/components/My/VideoTogether.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
<template>
<NCard title="一起看视频" :bordered="false" embedded>
<template #header-extra>
<NSpace size="small">
<NA href="https://videotogether.github.io/zh-cn/" target="_blank">
VideoTogether
</NA>
提供技术支持
</NSpace>
</template>

<NP>
您可以使用此功能与其他番剧库用户一起观看视频。<br />
在右下角悬浮窗中创建房间,并与其他用户分享您的房间。
</NP>

<template #action>
<NSwitch v-model:value="isEnable" />
</template>
</NCard>
</template>

<script setup>
import { useStorage } from "@vueuse/core";
import { watch } from "vue";
const isEnable = useStorage("enableVideoTogether", false);
watch(isEnable, () => {
if (isEnable.value === false) {
$message.info("将在下次刷新界面后关闭");
}
});
</script>
2 changes: 2 additions & 0 deletions src/views/User/UserView.vue
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
<MyViewHistory />
<MyFollow />
<AdminLinks :withCard="true" />
<VideoTogether />
</div>
</div>
</ContainerMobileFull>
Expand All @@ -22,6 +23,7 @@ import FunctionsCard from "../../components/My/FunctionsCard.vue";
import MyViewHistory from "../../components/My/ViewHistory/MyViewHistory.vue";
import MyFollow from "../../components/My/MyFollow.vue";
import AdminLinks from "../../components/Admin/AdminLinks.vue";
import VideoTogether from "../../components/My/VideoTogether.vue";
onMounted(() => {
document.title = "我的 | 熔岩番剧库 LavaAnimeLib";
Expand Down

0 comments on commit 5c311ee

Please sign in to comment.