-
Notifications
You must be signed in to change notification settings - Fork 17
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
Refactor contextmenu creation #41
Conversation
@polesye please take a look. You've had some concerns regarding context menu implementation IIRC. |
@@ -16,82 +19,93 @@ domReady(function() { | |||
// VideoJS Player() object necessary for context menu creation | |||
var player = videojs('{{ video_player_id }}'); | |||
|
|||
/** | |||
* Create elements of nested context submenu. | |||
*/ | |||
function createNestedContextSubMenu(e) { | |||
var target = e.target; | |||
|
|||
if (target.matches("li.vjs-menu-item") | |||
&& target.innerText == player.contextmenuUI.content[3].label |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we fix content[3]
here?
liSubMenu.onclick = function() { | ||
player.playbackRate(parseFloat(playbackRate)); | ||
} | ||
})(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it's better to use DocumentFragment in bulk DOM element generations.
forEach
method can also help you to simply the code.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice job!
Add context menu Add context menu Created context menu with videojs-contextmenu-ui plugin Created a nested menu for a context menu Fix nested submenu creation sequence Prevented nested submenu duplicates Set an event handler to a context menu item to create a nested submenu Enable custom context menu for each backend separately Minor changes as per convention Refactor context menu Refactor with pure JavaScript Refactor hiding a nested submenu Refactor contextmenu creation Refactored menu labels update Changed playback rate assignment Moved hide/show of submenu to css Optimized submenu creation
b078f48
to
31218fc
Compare
…linter * commit '324aa43674d214d184637bf3ec52331495fe12da': Enable popup submenu in Edge Fixed Speed label for Brightcove Remove unused static assets Disable .srt uploads for transcripts as this format not supported by VideoJS Add language select Not include videojs-transcripts.js to page if no transcripts (#50) Refactor of including javascript content to brightcove player Add caption for video Enabling/disabling of interactive transcripts Optimized submenu creation (#41) Add download transcript button for students Buttons for videojs player Replace videojs playback rate control with custom Refactor context menu Feature/player id validation (#37) Save state on next button clicking (#39) Add text "Speed" on large viewports Refactor context menu
…unity-fixes 1.0.0 community alpha ... merge (broken) community fork changes toward Py3 / Juniper compat
Refactored menu labels update
Changed playback rate assignment
Moved hide/show of submenu to css