From a36a178985d7966f43d4773da1589c962a4f00d5 Mon Sep 17 00:00:00 2001 From: Hakadao Date: Thu, 31 Aug 2023 16:26:34 +0800 Subject: [PATCH] refactor: adjust extension loading effect --- src/contentScripts/index.ts | 10 ++++++++++ src/contentScripts/views/App.vue | 2 +- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/src/contentScripts/index.ts b/src/contentScripts/index.ts index 528c98bc..056ed31d 100644 --- a/src/contentScripts/index.ts +++ b/src/contentScripts/index.ts @@ -9,6 +9,8 @@ let app: any const isFirefox: boolean = /Firefox/i.test(navigator.userAgent) +document.documentElement.style.opacity = '0' +// document.documentElement.style.transition = 'opacity .5s ease-in-out' if (isFirefox) { let isFirstScriptExecute = true document.addEventListener('beforescriptexecute', () => { @@ -16,6 +18,10 @@ if (isFirefox) { return injectApp() + setTimeout(() => { + document.documentElement.style.opacity = '1' + // document.documentElement.style.transition = 'unset' + }, 800) isFirstScriptExecute = false }) @@ -23,6 +29,10 @@ if (isFirefox) { else { document.addEventListener('DOMContentLoaded', () => { injectApp() + setTimeout(() => { + document.documentElement.style.opacity = '1' + // document.documentElement.style.transition = 'unset' + }, 800) }) } diff --git a/src/contentScripts/views/App.vue b/src/contentScripts/views/App.vue index 4095789e..237f66d2 100644 --- a/src/contentScripts/views/App.vue +++ b/src/contentScripts/views/App.vue @@ -125,7 +125,7 @@ onMounted(() => { nextTick(() => { setTimeout(() => { mainAppOpacity.value = 1 - }, 800) + }, 1200) }) // Force overwrite Bilibili Evolved body tag & html tag background color