mirror of
https://github.com/zhw2590582/ArtPlayer.git
synced 2026-10-24 06:31:20 -08:00
Add new utility functions and update styles
This commit is contained in:
1 parent
29ff487547
commit
780124d84b
5 files changed
+47
-25
No files matched your search
@@ -248,15 +248,7 @@ Artplayer.USE_RAF = false;
|
||||
if (utils.isBrowser) {
|
||||
window['Artplayer'] = Artplayer;
|
||||
|
||||
const $style = document.getElementById('artplayer-style');
|
||||
if ($style) {
|
||||
$style.textContent = style;
|
||||
} else {
|
||||
const $style = utils.createElement('style');
|
||||
$style.id = 'artplayer-style';
|
||||
$style.textContent = style;
|
||||
document.head.appendChild($style);
|
||||
}
|
||||
utils.setStyleText('artplayer-style', style);
|
||||
|
||||
setTimeout(() => {
|
||||
if (Artplayer.LOG_VERSION) {
|
||||
|
||||
@@ -95,3 +95,15 @@ export function getIcon(key = '', html = '') {
|
||||
append(icon, html);
|
||||
return icon;
|
||||
}
|
||||
|
||||
export function setStyleText(id, style) {
|
||||
const $style = document.getElementById(id);
|
||||
if ($style) {
|
||||
$style.textContent = style;
|
||||
} else {
|
||||
const $style = createElement('style');
|
||||
$style.id = id;
|
||||
$style.textContent = style;
|
||||
document.head.appendChild($style);
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user