separate variable constants

This commit is contained in:
Harvey committed 2022-04-27 10:42:07 +08:00
1 parent 57a14f63ac
commit fc3abd7d1d
20 files changed
+143 -80

No files matched your search

@@ -3,6 +3,7 @@ import { setStyle, addClass, removeClass, hasClass } from '../utils';
export default function autoOrientation(art) {
const {
option,
constructor,
template: { $player, $video },
} = art;
@@ -21,7 +22,7 @@ export default function autoOrientation(art) {
setStyle($player, 'transform-origin', '0 0');
setStyle($player, 'transform', `rotate(90deg) translate(0, -${viewWidth}px)`);
addClass($player, 'art-auto-orientation');
}, 100);
}, constructor.MOBILE_AUTO_ORIENTATION_TIME);
}
} else {
if (hasClass($player, 'art-auto-orientation')) {
@@ -4,13 +4,14 @@ export default function autoPlayback(art) {
const {
i18n,
storage,
constructor,
template: { $poster },
} = art;
art.on('video:timeupdate', () => {
const times = storage.get('times') || {};
const keys = Object.keys(times);
if (keys.length > 10) delete times[keys[0]];
if (keys.length > constructor.AUTO_PLAYBACK_MAX) delete times[keys[0]];
times[art.option.url] = art.currentTime;
storage.set('times', times);
});