|
@@ -1,7 +1,7 @@
|
|
|
<template>
|
|
|
<div class="denet-toolbox" @click.stop="clickHead" ref="dom_toolbox" :class="{ 'pre-view': pre_view }">
|
|
|
<div class="head" @click.stop="clickHead">
|
|
|
- <span>Subway Surfers</span>
|
|
|
+ <span></span>
|
|
|
<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-full.png')" alt class="full" @click.stop="clickFull" />
|
|
@@ -72,7 +72,8 @@ let state = reactive({
|
|
|
dom: {
|
|
|
root: null,
|
|
|
iframe: null
|
|
|
- }
|
|
|
+ },
|
|
|
+ handle_type: ''
|
|
|
})
|
|
|
|
|
|
let props = defineProps({
|
|
@@ -107,7 +108,11 @@ const clickContinue = () => {
|
|
|
if (state.checkbox) {
|
|
|
setChromeStorage({ fullCheck: JSON.stringify({ fullCheck: 1 }) })
|
|
|
// 全屏
|
|
|
-
|
|
|
+ if (state.handle_type == '全屏') {
|
|
|
+ handleFull()
|
|
|
+ } else {
|
|
|
+ handleFixed()
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
onMounted(() => {
|
|
@@ -147,7 +152,9 @@ const getDetail = () => {
|
|
|
iframe.onload = function () {
|
|
|
state.status = ''
|
|
|
}
|
|
|
- state.iframe_url = state.detail.originUrl
|
|
|
+ setTimeout(()=>{
|
|
|
+ state.iframe_url = state.detail.originUrl
|
|
|
+ },1000)
|
|
|
} else {
|
|
|
let iframe = dom_iframe.value
|
|
|
state.detail.originUrl = 'https://www.bilibili.com'
|
|
@@ -157,7 +164,10 @@ const getDetail = () => {
|
|
|
iframe.onload = function () {
|
|
|
state.status = ''
|
|
|
}
|
|
|
- state.iframe_url = state.detail.originUrl
|
|
|
+ setTimeout(()=>{
|
|
|
+ state.iframe_url = state.detail.originUrl
|
|
|
+ },1000)
|
|
|
+
|
|
|
}
|
|
|
})
|
|
|
}
|
|
@@ -167,6 +177,7 @@ const clickCancel = () => {
|
|
|
}
|
|
|
|
|
|
const clickFixed = () => {
|
|
|
+ state.handle_type = '固定'
|
|
|
getChromeStorage('fullCheck', (res) => {
|
|
|
if (res && res.fullCheck) {
|
|
|
// 固定
|
|
@@ -178,10 +189,35 @@ const clickFixed = () => {
|
|
|
}
|
|
|
|
|
|
// 固定
|
|
|
-const handleFixed = () => {
|
|
|
+const handleFull = () => {
|
|
|
if (state.status || !state.iframe_url) {
|
|
|
return
|
|
|
}
|
|
|
+ // 切换状态
|
|
|
+ state.status = '关闭'
|
|
|
+ // 操作全屏dom
|
|
|
+ let dom = document.querySelector('#denet-tool-box-fixed')
|
|
|
+ dom.style.cssText = `
|
|
|
+ width:100%;
|
|
|
+ height: 100%;
|
|
|
+ position: fixed;
|
|
|
+ right: 0px;
|
|
|
+ top: 0px;`
|
|
|
+ dom.style.display = 'block'
|
|
|
+ state.show_btn = false
|
|
|
+ sendEventInfo({
|
|
|
+ event_type: 'ToolBox_To_Fixed',
|
|
|
+ data: {
|
|
|
+ iframe_url: state.iframe_url,
|
|
|
+ tweetId: state.tweetId
|
|
|
+ }
|
|
|
+ })
|
|
|
+ // 清除当前iframe src
|
|
|
+ state.iframe_url = ''
|
|
|
+}
|
|
|
+
|
|
|
+// 全屏
|
|
|
+const handleFixed = () => {
|
|
|
// 切换状态
|
|
|
state.status = '固定右上角'
|
|
|
// 操作全屏dom
|
|
@@ -200,10 +236,11 @@ const handleFixed = () => {
|
|
|
}
|
|
|
|
|
|
const clickFull = () => {
|
|
|
+ state.handle_type = '全屏'
|
|
|
getChromeStorage('fullCheck', (res) => {
|
|
|
if (res && res.fullCheck) {
|
|
|
// 全屏
|
|
|
-
|
|
|
+ handleFull()
|
|
|
} else {
|
|
|
state.show_alert = true
|
|
|
}
|