|
@@ -1,15 +1,15 @@
|
|
<template>
|
|
<template>
|
|
- <div class="denet-toolbox" @click.stop="clickHead">
|
|
|
|
|
|
+ <div class="denet-toolbox" @click.stop="clickHead" ref="dom_toolbox">
|
|
<div class="head" @click.stop="clickHead">
|
|
<div class="head" @click.stop="clickHead">
|
|
<span>Subway Surfers</span>
|
|
<span>Subway Surfers</span>
|
|
- <div>
|
|
|
|
|
|
+ <div v-show="state.show_btn">
|
|
<img :src="require('@/assets/img/icon-fixed.png')" alt class="fixed" @click.stop="clickFixed" />
|
|
<img :src="require('@/assets/img/icon-fixed.png')" alt class="fixed" @click.stop="clickFixed" />
|
|
<img :src="require('@/assets/img/icon-full.png')" alt class="full" @click.stop="clickFull" />
|
|
<img :src="require('@/assets/img/icon-full.png')" alt class="full" @click.stop="clickFull" />
|
|
<!-- <img :src="require('@/assets/img/icon-close.png')" alt class="full" @click="clickFull" /> -->
|
|
<!-- <img :src="require('@/assets/img/icon-close.png')" alt class="full" @click="clickFull" /> -->
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div class="content">
|
|
<div class="content">
|
|
- <iframe src="https://www.bilibili.com" v-show="state.status == ''" frameborder="0"></iframe>
|
|
|
|
|
|
+ <iframe :src="state.iframe_url" v-show="state.status == ''" frameborder="0"></iframe>
|
|
<!-- 网页错误 -->
|
|
<!-- 网页错误 -->
|
|
<div class="state" v-show="state.status == '网页错误'">
|
|
<div class="state" v-show="state.status == '网页错误'">
|
|
<img :src="require('@/assets/img/icon-page-fail.png')" alt />
|
|
<img :src="require('@/assets/img/icon-page-fail.png')" alt />
|
|
@@ -17,6 +17,9 @@
|
|
</div>
|
|
</div>
|
|
|
|
|
|
<!-- 加载 -->
|
|
<!-- 加载 -->
|
|
|
|
+ <div class="state" v-show="state.status == '加载'">
|
|
|
|
+ <img :src="require('@/assets/img/icon-loading-gray.png')" alt />
|
|
|
|
+ </div>
|
|
|
|
|
|
<!-- 关闭 -->
|
|
<!-- 关闭 -->
|
|
<div class="state" v-show="state.status == '关闭'">
|
|
<div class="state" v-show="state.status == '关闭'">
|
|
@@ -30,7 +33,7 @@
|
|
</div>
|
|
</div>
|
|
<!-- alert -->
|
|
<!-- alert -->
|
|
<div class="alert" v-show="state.show_alert">
|
|
<div class="alert" v-show="state.show_alert">
|
|
- <div class="back"></div>
|
|
|
|
|
|
+ <div class="back" @click.stop="clickCancel"></div>
|
|
<div class="confirm">
|
|
<div class="confirm">
|
|
<div class="check">
|
|
<div class="check">
|
|
<input :id="state.checkbox_id" type='checkbox' v-model="state.checkbox" />
|
|
<input :id="state.checkbox_id" type='checkbox' v-model="state.checkbox" />
|
|
@@ -47,44 +50,122 @@
|
|
</div>
|
|
</div>
|
|
</template>
|
|
</template>
|
|
<script setup>
|
|
<script setup>
|
|
-import { getChromeStorage, setChromeStorage } from "@/uilts/chromeExtension";
|
|
|
|
|
|
+import { getChromeStorage, setChromeStorage, httpContentToBack } from "@/uilts/chromeExtension";
|
|
import { guid } from "@/uilts/help";
|
|
import { guid } from "@/uilts/help";
|
|
-
|
|
|
|
-import { onMounted, reactive } from "vue";
|
|
|
|
|
|
+import { onMounted, reactive, ref } from "vue";
|
|
|
|
+let dom_toolbox = ref(null)
|
|
let state = reactive({
|
|
let state = reactive({
|
|
- status: '', //
|
|
|
|
|
|
+ status: '加载', //
|
|
show_alert: false,
|
|
show_alert: false,
|
|
|
|
+ show_btn: true,
|
|
list: [],
|
|
list: [],
|
|
checkbox: false,
|
|
checkbox: false,
|
|
- checkbox_id: `denet-${guid()}`
|
|
|
|
|
|
+ checkbox_id: `denet-${guid()}`,
|
|
|
|
+ postId: '',
|
|
|
|
+ tweetId: '',
|
|
|
|
+ detail: null,
|
|
|
|
+ dom: {
|
|
|
|
+ root: null,
|
|
|
|
+ iframe: null
|
|
|
|
+ }
|
|
})
|
|
})
|
|
|
|
|
|
const clickHead = () => {
|
|
const clickHead = () => {
|
|
//
|
|
//
|
|
}
|
|
}
|
|
|
|
+
|
|
const clickContinue = () => {
|
|
const clickContinue = () => {
|
|
- console.log(state.checkbox)
|
|
|
|
|
|
+ if (state.checkbox) {
|
|
|
|
+ setChromeStorage({ fullCheck: JSON.stringify({ fullCheck: 1 }) })
|
|
|
|
+ // 全屏
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+}
|
|
|
|
+onMounted(() => {
|
|
|
|
+ // twitterid
|
|
|
|
+ // postid
|
|
|
|
+ console.log('dom_toolbox', dom_toolbox.value)
|
|
|
|
+ if (dom_toolbox.value) {
|
|
|
|
+ state.dom_root = dom_toolbox.value.closest('div[data-tweet-id]')
|
|
|
|
+ if (state.dom_root) {
|
|
|
|
+ state.postId = state.dom_root.dataset.postId || ''
|
|
|
|
+ state.tweetId = state.dom_root.dataset.tweetId || ''
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ getDetail()
|
|
|
|
+})
|
|
|
|
+
|
|
|
|
+// detail函数
|
|
|
|
+const getDetail = () => {
|
|
|
|
+ httpContentToBack({
|
|
|
|
+ url: `/post/getDetail`,
|
|
|
|
+ params: {
|
|
|
|
+ postId: 'e81fd3731cf84e339e6ef39efa992d10' //state.postId
|
|
|
|
+ }
|
|
|
|
+ }, (res) => {
|
|
|
|
+ if (res && res.code == 0) {
|
|
|
|
+ state.detail = JSON.parse(res.data.postBizData)
|
|
|
|
+ console.log('postBizData', state.detail)
|
|
|
|
+
|
|
|
|
+ // 加载iframe
|
|
|
|
+ let iframe = state.dom_root.querySelector('iframe')
|
|
|
|
+ state.detail.originUrl = 'https://www.bilibili.com'
|
|
|
|
+ state.iframe_url = state.detail.originUrl
|
|
|
|
+ iframe.onerror = () => {
|
|
|
|
+ state.status = '网页错误'
|
|
|
|
+ }
|
|
|
|
+ iframe.onload = () => {
|
|
|
|
+ state.status = ''
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ })
|
|
}
|
|
}
|
|
|
|
+
|
|
const clickCancel = () => {
|
|
const clickCancel = () => {
|
|
state.show_alert = false
|
|
state.show_alert = false
|
|
}
|
|
}
|
|
|
|
+
|
|
const clickFixed = () => {
|
|
const clickFixed = () => {
|
|
- state.show_alert = true
|
|
|
|
- // getChromeStorage('tool_box_check',(res)=>{
|
|
|
|
|
|
+ getChromeStorage('fullCheck', (res) => {
|
|
|
|
+ if (res && res.fullCheck) {
|
|
|
|
+ // 固定
|
|
|
|
+ handleFixed()
|
|
|
|
+ } else {
|
|
|
|
+ state.show_alert = true
|
|
|
|
+ }
|
|
|
|
+ })
|
|
|
|
+}
|
|
|
|
|
|
- // })
|
|
|
|
|
|
+// 固定
|
|
|
|
+const handleFixed = () => {
|
|
|
|
+ // 1.清除当前iframe src
|
|
|
|
+ state.dom_root.querySelector('iframe').src = ''
|
|
|
|
+ // 2.切换状态
|
|
|
|
+ state.status = '固定右上角'
|
|
|
|
+ // 3.操作全屏dom
|
|
|
|
+ let dom = document.querySelector('#denet-tool-box-fixed')
|
|
|
|
+ dom.style.display = 'block'
|
|
|
|
+ dom.dataset.tweetId = state.tweetId
|
|
|
|
+ dom.querySelector('iframe').src = state.iframe_url
|
|
}
|
|
}
|
|
|
|
+
|
|
const clickFull = () => {
|
|
const clickFull = () => {
|
|
- //
|
|
|
|
- state.show_alert = true
|
|
|
|
|
|
+ getChromeStorage('fullCheck', (res) => {
|
|
|
|
+ if (res && res.fullCheck) {
|
|
|
|
+ // 全屏
|
|
|
|
+
|
|
|
|
+ } else {
|
|
|
|
+ state.show_alert = true
|
|
|
|
+ }
|
|
|
|
+ })
|
|
}
|
|
}
|
|
|
|
|
|
</script>
|
|
</script>
|
|
|
|
|
|
<style lang="scss">
|
|
<style lang="scss">
|
|
.denet-toolbox {
|
|
.denet-toolbox {
|
|
- width: 505px;
|
|
|
|
- height: 544px;
|
|
|
|
|
|
+ width: 100%;
|
|
|
|
+ height: 100%;
|
|
filter: drop-shadow(0px 4px 20px rgba(0, 0, 0, 0.2));
|
|
filter: drop-shadow(0px 4px 20px rgba(0, 0, 0, 0.2));
|
|
border-radius: 12px;
|
|
border-radius: 12px;
|
|
overflow: hidden;
|
|
overflow: hidden;
|
|
@@ -106,7 +187,7 @@ const clickFull = () => {
|
|
left: 0;
|
|
left: 0;
|
|
width: 100%;
|
|
width: 100%;
|
|
height: 100%;
|
|
height: 100%;
|
|
-
|
|
|
|
|
|
+ cursor: auto;
|
|
}
|
|
}
|
|
|
|
|
|
.confirm {
|
|
.confirm {
|
|
@@ -160,6 +241,7 @@ const clickFull = () => {
|
|
line-height: 47px;
|
|
line-height: 47px;
|
|
cursor: pointer;
|
|
cursor: pointer;
|
|
border-radius: 1000px;
|
|
border-radius: 1000px;
|
|
|
|
+ user-select: none;
|
|
}
|
|
}
|
|
|
|
|
|
.cancel {
|
|
.cancel {
|