Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

change file name and object name #16

Merged
merged 1 commit into from
Mar 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/js/modal-dialog.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import Component from './component';
import window from 'global/window';
import document from 'global/document';
import keycode from 'keycode';
import SpatialNavKeycode from './utils/spatialnav-keycodes';
import SpatialNavKeyCodes from './utils/spatial-navigation-key-codes';

const MODAL_CLASS_NAME = 'vjs-modal-dialog';

Expand Down Expand Up @@ -471,7 +471,7 @@ class ModalDialog extends Component {
}

// If 'Esc' is pressed or Backspace is pressed & spatialNavigation is enabled & Modal is 'closeable'.
if ((keycode.isEventKey(event, 'Escape') || (SpatialNavKeycode.isEventKey(event, 'Back') && isSpatialNavListening)) && this.closeable()) {
if ((keycode.isEventKey(event, 'Escape') || (SpatialNavKeyCodes.isEventKey(event, 'Back') && isSpatialNavListening)) && this.closeable()) {
event.preventDefault();
this.close();
return;
Expand Down
8 changes: 4 additions & 4 deletions src/js/spatial-navigation.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
*/
import EventTarget from './event-target';
import keycode from 'keycode';
import SpatialNavKeycode from './utils/spatialnav-keycodes';
import SpatialNavKeyCodes from './utils/spatial-navigation-key-codes';

// The number of seconds the `step*` functions move the timeline.
const STEP_SECONDS = 5;
Expand Down Expand Up @@ -80,11 +80,11 @@ class SpatialNavigation extends EventTarget {
const direction = keycode(event);

this.move(direction);
} else if (SpatialNavKeycode.isEventKey(event, 'play') || SpatialNavKeycode.isEventKey(event, 'pause') ||
SpatialNavKeycode.isEventKey(event, 'ff') || SpatialNavKeycode.isEventKey(event, 'rw')) {
} else if (SpatialNavKeyCodes.isEventKey(event, 'play') || SpatialNavKeyCodes.isEventKey(event, 'pause') ||
SpatialNavKeyCodes.isEventKey(event, 'ff') || SpatialNavKeyCodes.isEventKey(event, 'rw')) {
// Handle media actions
event.preventDefault();
const action = SpatialNavKeycode.getEventName(event);
const action = SpatialNavKeyCodes.getEventName(event);

this.performMediaAction(action);
}
Expand Down
47 changes: 47 additions & 0 deletions src/js/utils/spatial-navigation-key-codes.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
// /**
// * @file spatial-navigation-keycode.js
// */

import * as browser from './browser.js';

// Determine the keycode for the 'back' key based on the platform
const backKeyCode = browser.IS_TIZEN ? 10009 : browser.IS_WEBOS ? 461 : 8;

const SpatialNavKeyCodes = {
codes: {
play: 415,
pause: 19,
ff: 417,
rw: 412,
back: backKeyCode
},
names: {
415: 'play',
19: 'pause',
417: 'ff',
412: 'rw',
[backKeyCode]: 'back'
},

isEventKey(event, keyName) {
keyName = keyName.toLowerCase();

if (this.names[event.keyCode] && this.names[event.keyCode] === keyName) {
return true;
}
return false;
},

getEventName(event) {
if (this.names[event.keyCode]) {
return this.names[event.keyCode];
} else if (this.codes[event.code]) {
const code = this.codes[event.code];

return this.names[code];
}
return null;
}
};

export default SpatialNavKeyCodes;
49 changes: 0 additions & 49 deletions src/js/utils/spatialnav-keycodes.js

This file was deleted.

Loading