���� JFIF �� � ( %"1"%)+...383,7(-.-
![]() Server : Apache/2.4.6 (CentOS) OpenSSL/1.0.2k-fips PHP/7.4.20 System : Linux st2.domain.com 3.10.0-1127.10.1.el7.x86_64 #1 SMP Wed Jun 3 14:28:03 UTC 2020 x86_64 User : apache ( 48) PHP Version : 7.4.20 Disable Function : NONE Directory : /var/www/html/video/layout/js/node_modules/artplayer/src/ |
import { isMobile } from './utils'; export default class Hotkey { constructor(art) { this.art = art; this.keys = {}; if (art.option.hotkey && !isMobile) { this.init(); } } init() { const { proxy, constructor } = this.art; this.add(27, () => { if (this.art.fullscreenWeb) { this.art.fullscreenWeb = false; } }); this.add(32, () => { this.art.toggle(); }); this.add(37, () => { this.art.backward = constructor.SEEK_STEP; }); this.add(38, () => { this.art.volume += constructor.VOLUME_STEP; }); this.add(39, () => { this.art.forward = constructor.SEEK_STEP; }); this.add(40, () => { this.art.volume -= constructor.VOLUME_STEP; }); proxy(window, 'keydown', (event) => { if (this.art.isFocus) { const tag = document.activeElement.tagName.toUpperCase(); const editable = document.activeElement.getAttribute('contenteditable'); if (tag !== 'INPUT' && tag !== 'TEXTAREA' && editable !== '' && editable !== 'true' && !event.altKey && !event.ctrlKey && !event.metaKey && !event.shiftKey) { const events = this.keys[event.keyCode]; if (events) { event.preventDefault(); for (let index = 0; index < events.length; index++) { events[index].call(this.art, event); } this.art.emit('hotkey', event); } } } }); } add(key, event) { if (this.keys[key]) { this.keys[key].push(event); } else { this.keys[key] = [event]; } return this; } remove(key, event) { if (this.keys[key]) { const index = this.keys[key].indexOf(event); if (index !== -1) { this.keys[key].splice(index, 1); } } return this; } }