mirror of
https://github.com/BewlyBewly/BewlyBewly.git
synced 2025-04-14 13:15:29 +00:00
feat: add common method injectCSS
* refactor: address ts errors
This commit is contained in:
@@ -4,19 +4,12 @@ import App from './views/App.vue'
|
||||
import { setupApp } from '~/logic/common-setup'
|
||||
import { i18n } from '~/utils/i18n'
|
||||
import { SVG_ICONS } from '~/utils/svgIcons'
|
||||
import { injectCSS } from '~/utils/main'
|
||||
|
||||
let app: any
|
||||
|
||||
const isFirefox: boolean = /Firefox/i.test(navigator.userAgent)
|
||||
|
||||
function injectCSS(css: string): HTMLStyleElement {
|
||||
const el = document.createElement('style')
|
||||
el.setAttribute('rel', 'stylesheet')
|
||||
el.innerText = css
|
||||
document.documentElement.appendChild(el)
|
||||
return el
|
||||
}
|
||||
|
||||
const beforeLoadedStyleEl = injectCSS(`
|
||||
html.dark {
|
||||
background: hsl(230 12% 6%);
|
||||
@@ -70,6 +63,8 @@ function injectApp() {
|
||||
|| /https?:\/\/search.bilibili.com\.*/.test(currentUrl)
|
||||
// moments
|
||||
|| /https?:\/\/t.bilibili.com\.*/.test(currentUrl)
|
||||
// history page
|
||||
|| /https?:\/\/(www.)?bilibili.com\/account\/history.*/.test(currentUrl)
|
||||
) {
|
||||
if (
|
||||
/https?:\/\/bilibili.com\/?$/.test(currentUrl)
|
||||
|
||||
Reference in New Issue
Block a user