mirror of
https://github.com/zhw2590582/ArtPlayer.git
synced 2026-10-25 16:11:20 -08:00
refactor(core): CORE-12 type template resources and verify bundled notices
This commit is contained in:
1 parent
b8039ad1f1
commit
9eb7c945ca
101 files changed
+7363
-664
No files matched your search
@@ -1,5 +1,8 @@
|
||||
import { isMobile } from './compatibility'
|
||||
|
||||
export { setStyleText } from '../style/inject'
|
||||
|
||||
/** @param {string} selector @param {ParentNode} parent */
|
||||
export function query(selector, parent = document) {
|
||||
return parent.querySelector(selector)
|
||||
}
|
||||
@@ -90,6 +93,7 @@ export function createElement(tag) {
|
||||
return document.createElement(tag)
|
||||
}
|
||||
|
||||
/** @param {string} key @param {string | HTMLElement} html */
|
||||
export function getIcon(key = '', html = '') {
|
||||
const icon = createElement('i')
|
||||
addClass(icon, 'art-icon')
|
||||
@@ -98,23 +102,6 @@ export function getIcon(key = '', html = '') {
|
||||
return icon
|
||||
}
|
||||
|
||||
export function setStyleText(id, style) {
|
||||
let $style = document.getElementById(id)
|
||||
if (!$style) {
|
||||
$style = document.createElement('style')
|
||||
$style.id = id
|
||||
if (document.readyState === 'loading') {
|
||||
document.addEventListener('DOMContentLoaded', () => {
|
||||
document.head.appendChild($style)
|
||||
})
|
||||
}
|
||||
else {
|
||||
(document.head || document.documentElement).appendChild($style)
|
||||
}
|
||||
}
|
||||
$style.textContent = style
|
||||
}
|
||||
|
||||
export function supportsFlex() {
|
||||
const div = document.createElement('div')
|
||||
div.style.display = 'flex'
|
||||
|
||||
Reference in new issue
Block a user