Skip to content

feat: add full-screen back-to-YouTube button (#3137)#3141

Merged
ImprovedTube merged 6 commits intocode-charity:masterfrom
suryaprakash0010:feature/fullscreen-back-button
Sep 22, 2025
Merged

feat: add full-screen back-to-YouTube button (#3137)#3141
ImprovedTube merged 6 commits intocode-charity:masterfrom
suryaprakash0010:feature/fullscreen-back-button

Conversation

@suryaprakash0010
Copy link
Contributor

Problem

Users who run videos in fullscreen by default cannot easily return to YouTube.
Currently, they must exit fullscreen first to access the YouTube homepage or subscriptions.

Solution

This PR implements a new "Return to YouTube" button in the fullscreen player.

  • Positioned in the top-left corner (instead of the video title area).
  • Uses official YouTube logo SVG for familiarity.
  • Navigates to:
    • YouTube homepage (/), or
    • Subscriptions feed (/feed/subscriptions)
      based on user preference.
  • Appears only in fullscreen mode.

Features

✅ Added ImprovedTube.addYouTubeReturnButton() in player.js
✅ Added CSS in player.css for styling & positioning
✅ Integrated MutationObserver to detect fullscreen state changes
✅ Added setting options:
- player_youtube_return_button (toggle on/off)
- player_youtube_return_destination (homepage / subscriptions)
✅ Proper initialization in functions.js

Closes

Closes #3137

@Tibood Tibood mentioned this pull request Sep 3, 2025
@ImprovedTube
Copy link
Member

thank you so much! @suryaprakash0010

@ImprovedTube
Copy link
Member

ImprovedTube commented Sep 4, 2025

lets add a clear descriptive text to locales/en/messages.json

player_youtube_return_destination could also enhance our feature "auto-full screen" listed above it.
to both features it is a sub-option, we can show conditionally only when the feature is enabled:
https://github.com/code-charity/youtube/blob/master/menu/styles/sub-options.css

@ImprovedTube
Copy link
Member

hi, using history.back(); so that the page doesn't reload

and removed:
if (ImprovedTube.storage.player_youtube_return_destination === 'subscriptions') {
window.location.href = '/feed/subscriptions';
} else {
window.location.href = '/';
}

but we can add more buttons, such as:

	fullscreen_link_button: {
		component: 'select',
		text: 'destination',
		options: [{
			text: 'none',
			value: 'none'
		}, {
			text: 'URL',
			value: 'url'  
			
			//to add an input: check appearance > player > size > custom.

		}{
			text: 'homepage',
			value: 'homepage'
		}, {
			text: 'subscriptions',
			value: 'subscriptions'
		}],
		value: 'none'
	},	

@ImprovedTube
Copy link
Member

( and we can enhance this feature to go history.back() when closing fullscreen as well)

/------------------------------------------------------------------------------
AUTO FULLSCREEN
------------------------------------------------------------------------------
/
ImprovedTube.playerAutofullscreen = function () {
if (
this.storage.player_autofullscreen === true &&
document.documentElement.dataset.pageType === 'video' &&
!document.fullscreenElement
) {
this.elements.player.toggleFullscreen();
}
};

@ImprovedTube ImprovedTube merged commit a5d1100 into code-charity:master Sep 22, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

💡[Feature Request] Add a button to return to youtube in the fullscreen player.

3 participants