mirror of
https://github.com/zhw2590582/ArtPlayer.git
synced 2026-10-27 17:51:20 -08:00
分离事件中心
This commit is contained in:
1 parent
b5694fea89
commit
1d40d1c46b
31 files changed
+728
-403
No files matched your search
@@ -70,6 +70,11 @@ export function setStyles(element, styles) {
|
||||
return element;
|
||||
}
|
||||
|
||||
export function getStyle(element, key, numberType = true) {
|
||||
const value = window.getComputedStyle(element, null).getPropertyValue(key);
|
||||
return numberType ? parseFloat(value) : value;
|
||||
}
|
||||
|
||||
export function secondToTime(second) {
|
||||
const add0 = num => num < 10 ? `0${num}` : String(num);
|
||||
const hour = Math.floor(second / 3600);
|
||||
@@ -105,18 +110,6 @@ export function deepMerge(...sources) {
|
||||
return returnValue;
|
||||
}
|
||||
|
||||
export function getStorage(key) {
|
||||
const storage = JSON.parse(localStorage.getItem('artplayer_settings')) || {};
|
||||
return key ? storage[key] : storage;
|
||||
}
|
||||
|
||||
export function setStorage(key, value) {
|
||||
const storage = Object.assign({}, getStorage(), {
|
||||
[key]: value
|
||||
});
|
||||
localStorage.setItem('artplayer_settings', JSON.stringify(storage));
|
||||
}
|
||||
|
||||
export function tooltip(target, msg, pos = 'up') {
|
||||
target.setAttribute('data-balloon', msg);
|
||||
target.setAttribute('data-balloon-pos', pos);
|
||||
|
||||
Reference in new issue
Block a user