Refactor player.core.js and embed.core.js: extract subtitles and menu functionality#1
Draft
Copilot wants to merge 12 commits into
Draft
Refactor player.core.js and embed.core.js: extract subtitles and menu functionality#1Copilot wants to merge 12 commits into
Copilot wants to merge 12 commits into
Conversation
Co-authored-by: sphynkx <7884935+sphynkx@users.noreply.github.com>
Co-authored-by: sphynkx <7884935+sphynkx@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Refactor player.core.js to separate subtitles functionality
Refactor player.core.js to separate subtitles functionality
Jan 12, 2026
Co-authored-by: sphynkx <7884935+sphynkx@users.noreply.github.com>
Co-authored-by: sphynkx <7884935+sphynkx@users.noreply.github.com>
Copilot
AI
changed the title
Refactor player.core.js to separate subtitles functionality
Refactor player.core.js: extract subtitles and menu functionality
Jan 12, 2026
…e Back button Co-authored-by: sphynkx <7884935+sphynkx@users.noreply.github.com>
Co-authored-by: sphynkx <7884935+sphynkx@users.noreply.github.com>
Co-authored-by: sphynkx <7884935+sphynkx@users.noreply.github.com>
Co-authored-by: sphynkx <7884935+sphynkx@users.noreply.github.com>
…iding module import Co-authored-by: sphynkx <7884935+sphynkx@users.noreply.github.com>
…te modules Co-authored-by: sphynkx <7884935+sphynkx@users.noreply.github.com>
Copilot
AI
changed the title
Refactor player.core.js: extract subtitles and menu functionality
Refactor player.core.js and embed.core.js: extract subtitles and menu functionality
Jan 12, 2026
Co-authored-by: sphynkx <7884935+sphynkx@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Overview
This PR extracts subtitle and menu functionality from both the main player (
player.core.js) and embed player (embed.core.js) into separate, reusable modules. This improves code organization, maintainability, and reduces file sizes by ~20% across both players. Additionally, it fixes critical menu UI bugs related to scrollbar visibility and mouse wheel event capture.Changes Made
Main Player Refactoring ✅
Created New Modules:
player.subtitles.js(245 lines) - All subtitle-related functionsplayer.menu.js(332 lines) - All menu-related functions with scrollbar fixesRefactored player.core.js:
Embed Player Refactoring ✅
Created New Modules:
embed.subtitles.js(245 lines) - All subtitle-related functionsembed.menu.js(332 lines) - All menu-related functions with scrollbar fixesRefactored embed.core.js:
Menu Bug Fixes Applied to Both Players ✅
Fixed critical issues with the Settings → Languages menu:
overflowY: 'auto'to'scroll'with complete stylingstopPropagation()to prevent page scrollingCritical Bug Fix (This Commit) 🔧
Problem:
The embed player refactoring accidentally removed three essential menu helper functions that were being called but not defined:
ensureMenuMainSnapshot()- Saves initial menu HTMLlockMenuHeightFromCurrent()- Locks menu to current heightresetMenuHeightLock()- Removes height lockThis caused multiple features to break:
Solution:
menuMainHTMLandmenuFixedMinHeightstate variablesmenuView = 'main'to usemenuManager.setView('main')File Naming Convention
Maintained consistent naming structure:
player.core.js,player.subtitles.js,player.menu.js,player.entry.jsembed.core.js,embed.subtitles.js,embed.menu.js,embed.entry.jsutil.js,storage.js,fallback.js,playlist.js,icons.jsResults
Code Reduction
New Modules Created
Functionality
Testing
The refactoring successfully achieves better code organization while simultaneously fixing all menu-related bugs in both the main and embed players.
Original prompt
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.