From da5074d981ff4f5155b4ea4dc0e17e77976603b4 Mon Sep 17 00:00:00 2001 From: Deepak Tripathy Date: Mon, 9 Nov 2026 11:13:01 +0300 Subject: [PATCH 1/7] added stretch mode (v1) --- CHANGELOG.md | 107 ++++++++++++++++++++++++++++++++++++++++ README.md | 65 +++++++++++++----------- package.json | 2 +- src/content.css | 20 +++++++- src/index.ts | 21 ++++---- src/player/button.ts | 61 +++++++++++++++++------ src/player/crop.ts | 57 ---------------------- src/player/fit.ts | 113 ++++++++++++++++++++++++++++++++++++++++++ src/popup/popup.ts | 23 +++++---- src/storage/mode.ts | 22 +++++++++ src/storage/state.ts | 48 +++++++++++------- src/sync/sync.ts | 15 +++--- tests/fit.test.ts | 114 +++++++++++++++++++++++++++++++++++++++++++ tests/mode.test.ts | 27 ++++++++++ tests/state.test.ts | 107 ++++++++++++++++++++++++++++++++++++++++ 15 files changed, 656 insertions(+), 146 deletions(-) create mode 100644 CHANGELOG.md delete mode 100644 src/player/crop.ts create mode 100644 src/player/fit.ts create mode 100644 src/storage/mode.ts create mode 100644 tests/fit.test.ts create mode 100644 tests/mode.test.ts create mode 100644 tests/state.test.ts diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 0000000..d14ceb5 --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,107 @@ +# Changelog + +All notable changes to this project are documented in this file. + +The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), +and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). + +## [Unreleased] + +## [1.3.0] - 2026-11-09 + +### Added + +- Stretch mode: fills the player by scaling the video unevenly on the shorter + axis instead of trimming the edges. People who prefer seeing the whole frame + can now choose distortion over cropping. +- The player button now cycles through three states: off, crop, stretch, off. + +### Changed + +- The toolbar popup reports the current mode (`Off`, `Crop is on`, + `Stretch is on`) instead of a single on/off value. +- The selected mode is stored as `cropMode` (`off`, `crop`, or `stretch`) + instead of the boolean `cropEnabled`. +- Existing installs are migrated once on first load: + `cropEnabled: true` becomes `cropMode: "crop"`, `false` or missing becomes + `"off"`. The old key is then removed so storage has one source of truth. +- The player button keeps its corner brackets, with a small square for crop and + a wide bar for stretch. Its `title`, `aria-label`, and `data-flrm-mode` follow + the mode. +- The README features, FAQ, and How It Works sections describe the two fill + modes and the new storage key. + +### Implementation + +**Why a third state rather than a toggle:** crop and stretch are different +trade-offs, not two ways of doing the same thing. Crop preserves shape and +trims edges; stretch preserves framing and distorts shape. The user has to be +able to pick one, so the state model is a three-value mode rather than two +independent booleans. One key also avoids an impossible "crop and stretch both +on" state and keeps cross-tab comparison to a single value. + +**Files added:** + +- `src/storage/mode.ts` — defines `CropMode` and two pure helpers. + `parseMode` is the single validation point for the stored mode; the legacy + boolean is read once during migration. `nextMode` is the single definition of + the button cycle, so the UI cannot drift from the stored order. +- `tests/mode.test.ts` — covers accepted/rejected values and the cycle order. +- `tests/state.test.ts` — drives `loadState` and `cycleMode` against an + in-memory `chrome.storage.local` fake: legacy true/false, fresh install, + existing mode, invalid mode fallback, and cycle writes. +- `tests/fit.test.ts` — drives the renderer with a fake player object (class + set, style map, fixed geometry), so no browser or `chrome` stub is needed. +- `CHANGELOG.md` — this file. + +**Files changed:** + +- `src/player/crop.ts` → `src/player/fit.ts` — renamed and rewritten as a + pure renderer. `applyFit(player, mode)` receives the mode instead of reading + storage, which keeps storage out of the render path and makes the transitions + testable. Crop keeps its original uniform scale: + `max(playerAspect / videoAspect, videoAspect / playerAspect)`, written to + `--flrm-scale`. Stretch writes `--flrm-scale-x` and `--flrm-scale-y`: the + shorter axis gets the ratio, the other stays `1`. Both round to four decimal + places and only write when the value changes, matching the original + write-only-if-needed style. +- `src/content.css` — added the `.flrm-stretch-on` transform. This uses a + transform instead of `width`/`height` plus `object-fit` because YouTube sizes + `.html5-main-video` to the video's own aspect ratio and centers it inside the + player. On a live page the video was 649×365 at `left: 68px` inside a + 784×365 player, and its `.html5-video-container` had zero height, so + percentage sizing is unreliable. Scaling the element is the same mechanism + crop already uses and was verified against the live player. +- `src/player/button.ts` — one `syncButtonState` now writes mode, label, and + `aria-pressed` for both freshly injected and existing buttons. The icon has + two overlay shapes toggled by CSS, so the DOM is built once and only its + state changes. +- `src/storage/state.ts` — `cropMode` is now the in-memory and persisted + value. `loadState` reads both keys, validates the new one with `parseMode`, + falls back to the legacy boolean, writes the new key, and removes the old + one. `onStorageChange` compares mode strings instead of booleans. Removed + `isEnabled`, which had no remaining callers. +- `src/sync/sync.ts`, `src/index.ts` — call `applyFit(getPlayer(), getMode())`. + The navigation, mutation, resize, metadata, fullscreen, and retry logic is + unchanged; that is what makes the mode survive navigation, refresh, theater + mode, and fullscreen. +- `src/popup/popup.ts` — maps the stored mode to text and a status class with + a `Record`; the popup stays read-only. +- `package.json` — version 1.3.0. The build reads the version from here and + writes it into both generated manifests. +- `README.md` — documents crop versus stretch, the three-state button, the + popup text, and the new storage/migration behavior. + +**Upgrade path:** no action is required from users. The first content script +load after upgrading translates the old boolean, saves `cropMode`, and removes +`cropEnabled`. Someone who had crop on stays in crop; a fresh install starts +off. If the stored `cropMode` is ever malformed, it falls back through the same +migration path. + +**Testing:** `bun run test` covers mode parsing/cycling, the migration paths, +and the renderer's class and variable transitions. The stretch CSS and icon +states were checked against a live YouTube player (geometry coverage and a +visual screenshot). Manual checks cover the parts unit tests cannot: navigation, +refresh, theater/fullscreen, cross-tab sync, the popup, and the legacy storage +migration in a real extension context. `web-ext lint` reports no errors; its one +warning about `strict_min_version` and Android is pre-existing. diff --git a/README.md b/README.md index 3fa3550..d6b9c2b 100644 --- a/README.md +++ b/README.md @@ -7,9 +7,11 @@ Website: https://fullorama.com [![Install from the Chrome Web Store](https://img.shields.io/badge/Get_it_on-Chrome_Web_Store-4285F4?style=for-the-badge&logo=googlechrome&logoColor=white)](https://chromewebstore.google.com/detail/fullorama-for-youtube/pacjdmdcmmnbpnjfhmjfgenbpedbakjg) [![Install from Firefox Add-ons](https://img.shields.io/badge/Get_it_on-Firefox_Add--ons-FF7139?style=for-the-badge&logo=firefoxbrowser&logoColor=white)](https://addons.mozilla.org/firefox/addon/fullorama/) -Fullorama for YouTube™ adds one crop button directly to YouTube's player. Turn -it on once and videos stay zoomed to fill across videos, refreshes, navigation, -and fullscreen, until you turn it off. +Fullorama for YouTube™ adds one button directly to YouTube's player. Click it to +cycle between crop, stretch, and off. Crop zooms in evenly to fill the player and +trims the edges; stretch widens the picture to fill it and leaves nothing out. +The choice stays across videos, refreshes, navigation, and fullscreen, until you +change it. Built for 21:9 and other ultrawide displays. @@ -30,18 +32,20 @@ https://github.com/user-attachments/assets/3c62393f-5d82-4c7b-8543-0c3c0938f052 ## Features -- YouTube player button for ultrawide crop / zoom-to-fill -- Global persistent on/off state across videos, refreshes, and navigation +- YouTube player button that cycles off, crop, and stretch +- Crop mode zooms evenly to fill the player and trims the edges +- Stretch mode fills the player without trimming, at the cost of distortion +- The chosen mode persists across videos, refreshes, and navigation - Works with YouTube's single-page navigation - Works in theater mode and fullscreen -- Read-only popup shows current crop status +- Read-only popup shows the current mode - Optional feedback form (popup link and uninstall survey) ## FAQ ### How do I watch YouTube full screen on an ultrawide monitor? -Install Fullorama for [Chrome](https://chromewebstore.google.com/detail/fullorama-for-youtube/pacjdmdcmmnbpnjfhmjfgenbpedbakjg) or [Firefox](https://addons.mozilla.org/firefox/addon/fullorama/) and play any YouTube video. Look at the bottom-right of the player: there's a new button with four little corner brackets, next to the settings gear. Click it and the video zooms in to fill the player. A small square appears in the middle of the icon to show it's on. Click it again to go back to normal. +Install Fullorama for [Chrome](https://chromewebstore.google.com/detail/fullorama-for-youtube/pacjdmdcmmnbpnjfhmjfgenbpedbakjg) or [Firefox](https://addons.mozilla.org/firefox/addon/fullorama/) and play any YouTube video. Look at the bottom-right of the player: there's a new button with four little corner brackets, next to the settings gear. Click it once to crop, which zooms the video in to fill the player. Click it again to stretch, which fills the player without trimming anything. A small square or wide bar appears in the middle of the icon to show which mode is on. Click it once more to go back to normal. ### I can't find the button. Where is it? @@ -49,27 +53,27 @@ It's with YouTube's own buttons at the bottom-right of the video, between the se ### Will the video look stretched? -No. Fullorama zooms in evenly from the center, so people and objects keep their normal shape. The trade-off is that a little of the edges gets trimmed. +Crop mode doesn't stretch anything. It zooms in evenly from the center, so people and objects keep their normal shape; the trade-off is that a little of the edges gets trimmed. Stretch mode does stretch the picture to fill the player and will make it look wider or taller than it is. Nothing gets trimmed in stretch mode. Use crop if you care more about shape, and stretch if you care more about seeing the whole frame. ### Why do some videos still have black bars? -Some videos have the bars recorded into the picture itself, often old movies or re-uploads. Fullorama can't tell those apart from the real image, so they can stay even with the button on. It also can't show picture that was never in the video. +Some videos have the bars recorded into the picture itself, often old movies or re-uploads. Fullorama can't tell those apart from the real image, so they can stay even with a mode on. It also can't show picture that was never in the video. ### Does it work in theater mode and fullscreen? -Yes. When you switch to theater mode or fullscreen, the zoom adjusts automatically to fill the new size. +Yes. When you switch to theater mode or fullscreen, the scaling adjusts automatically to fill the new size. ### Do I have to click it for every video? -No. Turn it on once and it stays on as you watch more videos, refresh, or browse around YouTube. Turn it off the same way whenever you like. The setting applies to all of YouTube in that browser. +No. Pick a mode once and it stays selected as you watch more videos, refresh, or browse around YouTube. Change it the same way whenever you like. The setting applies to all of YouTube in that browser. ### Does it work on 21:9 and 32:9 ultrawide monitors? -Yes. Fullorama works out the zoom from the shape of your player and the video, so it fits 21:9, 32:9 and anything in between. On wider screens, a little more of the edges is trimmed. +Yes. Fullorama works out the scaling from the shape of your player and the video, so it fits 21:9, 32:9 and anything in between. In crop mode, wider screens trim a little more of the edges; stretch mode fills them without trimming. ### Can I fill the screen and still see the whole picture? -Only if the video is already the same shape as your screen. Otherwise a little of the edges is trimmed to fill it. You can turn the button off any time to see the whole picture. +Only if the video is already the same shape as your screen. Crop mode trims a little of the edges to fill it; stretch mode keeps everything but distorts the shape. You can turn the button off any time to see the original picture. ### Does it work on Netflix, other sites, or my phone? @@ -77,15 +81,15 @@ No, only YouTube in a desktop browser (Chrome or Firefox). It doesn't work on Ne ### Will it slow YouTube down or make videos sharper? -It just zooms in on the video that's already playing, so it doesn't change the video's quality or load anything extra. Zooming in won't make it sharper, either. We haven't measured its effect on performance yet, but it does very little work. It only resizes the video you're watching. +It just scales the video that's already playing, so it doesn't change the video's quality or load anything extra. Scaling won't make it sharper, either. We haven't measured its effect on performance yet, but it does very little work. It only resizes the video you're watching. ### What's the toolbar icon for? -Clicking Fullorama's icon in your browser toolbar shows whether the zoom is on or off, and has a link to send us feedback. To turn it on or off, use the button in the video player. +Clicking Fullorama's icon in your browser toolbar shows whether you're off, in crop, or in stretch, and has a link to send us feedback. To change the mode, use the button in the video player. ### Does Fullorama collect my data? -No. It saves one thing in your browser: whether the zoom is on or off. It doesn't track what you watch, has no ads, and needs no account. +No. It saves one thing in your browser: which mode is selected. It doesn't track what you watch, has no ads, and needs no account. Feedback is optional and goes through a separate form run by Tally. It opens if you choose "Share feedback" in the toolbar popup, or after you uninstall. The form link includes the extension's version and where you opened it from. On Firefox, those two details are only sent if you've allowed the optional data permission. See the [privacy policy](https://fullorama.com/privacy) for the full details. @@ -95,24 +99,29 @@ Yes, completely free and open source. The code is on GitHub under the [MIT licen ## How It Works -The extension stores one boolean, `cropEnabled`, in extension local storage (`chrome.storage.local` on Chrome and `browser.storage.local` on Firefox). +The extension stores `cropMode` — `off`, `crop`, or `stretch` — in extension +local storage (`chrome.storage.local` on Chrome and `browser.storage.local` on +Firefox). Upgrading from a version that stored `cropEnabled` translates the old +on/off value to `crop`/`off` on first load and removes the old key. -A read-only toolbar popup displays whether crop is currently on or off by -reading the stored value once when opened. The popup cannot toggle crop — only -the player button can. A tiny background script registers an uninstall survey -URL so the browser can open the optional feedback form if you remove the -extension. +A read-only toolbar popup displays the current mode by reading the stored value +once when opened. The popup cannot change it — only the player button can. A +tiny background script registers an uninstall survey URL so the browser can open +the optional feedback form if you remove the extension. -When crop is enabled, the content script adds a class to YouTube's -`#movie_player` element and sets a CSS scale variable based on the current -player aspect ratio and video aspect ratio. The CSS clips the player and scales -the rendered video from the center. +When a mode is active, the content script adds a class to YouTube's +`#movie_player` element and sets CSS variables from the current player and video +aspect ratios. Crop scales both axes by the same amount and clips the overflow, +so the picture fills the player without changing shape. Stretch scales only the +shorter axis, so the picture fills the player but changes shape. `content.css` +applies both transforms from the center. YouTube rebuilds parts of its player during normal navigation, so the extension uses YouTube navigation events, a controls-scoped `MutationObserver`, a player-scoped `ResizeObserver`, video metadata events, window resize, fullscreen, -and short retry bursts to keep the button and crop state in sync. Player-size -changes automatically recalculate the crop when entering or leaving theater mode. +and short retry bursts to keep the button and mode state in sync. Player-size +changes automatically recalculate the scaling when entering or leaving theater +mode. ## Install Locally diff --git a/package.json b/package.json index 94d8f59..bea4f77 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "fullorama", - "version": "1.2.1", + "version": "1.3.0", "description": "Fill your ultrawide screen with YouTube videos without distracting black bars.", "type": "module", "license": "MIT", diff --git a/src/content.css b/src/content.css index 77eef8d..1f96115 100644 --- a/src/content.css +++ b/src/content.css @@ -11,10 +11,19 @@ display: block; } -.flrm-btn[aria-pressed="false"] .flrm-on { +.flrm-btn .flrm-crop, +.flrm-btn .flrm-stretch { display: none; } +.flrm-btn[data-flrm-mode="crop"] .flrm-crop { + display: block; +} + +.flrm-btn[data-flrm-mode="stretch"] .flrm-stretch { + display: block; +} + #movie_player.flrm-crop-on { overflow: hidden !important; } @@ -23,3 +32,12 @@ transform: scale(var(--flrm-scale, 1)) !important; transform-origin: center center !important; } + +#movie_player.flrm-stretch-on { + overflow: hidden !important; +} + +#movie_player.flrm-stretch-on video.html5-main-video { + transform: scale(var(--flrm-scale-x, 1), var(--flrm-scale-y, 1)) !important; + transform-origin: center center !important; +} diff --git a/src/index.ts b/src/index.ts index 431b395..062d4bc 100644 --- a/src/index.ts +++ b/src/index.ts @@ -1,18 +1,19 @@ /** * Fullorama for YouTube™ * - * Adds a crop button to the YouTube player that zooms the video to fill - * the player, removing letterboxing. The toggle persists in - * chrome.storage.local across videos, refreshes, and navigation. + * Adds a mode button to the YouTube player that cycles through off, crop, + * and stretch. Crop zooms the video to fill the player; stretch scales it + * to fill. The mode persists in chrome.storage.local across videos, + * refreshes, and navigation. */ -import { loadState, onStorageChange } from './storage/state'; +import { getMode, loadState, onStorageChange } from './storage/state'; import { updateButton } from './player/button'; -import { applyCrop } from './player/crop'; +import { applyFit } from './player/fit'; import { getPlayer } from './player/dom'; import { - applyCropAndSync, - applyCropNow, + applyFitAndSync, + applyFitNow, onVideoMetadata, resetObserver, retryBurst, @@ -24,12 +25,12 @@ async function init(): Promise { // Sync from other tabs onStorageChange(() => { updateButton(); - applyCrop(getPlayer()); + applyFit(getPlayer(), getMode()); }); // Apply crop immediately on resize and fullscreen - window.addEventListener('resize', applyCropNow, { passive: true }); - document.addEventListener('fullscreenchange', applyCropAndSync); + window.addEventListener('resize', applyFitNow, { passive: true }); + document.addEventListener('fullscreenchange', applyFitAndSync); document.addEventListener('yt-navigate-finish', retryBurst); document.addEventListener('yt-navigate-start', resetObserver); document.addEventListener('loadedmetadata', onVideoMetadata, true); diff --git a/src/player/button.ts b/src/player/button.ts index 87d3982..eb6c495 100644 --- a/src/player/button.ts +++ b/src/player/button.ts @@ -1,14 +1,21 @@ /** - * Button — injects and manages the crop toggle button in YouTube's player. + * Button — injects and manages the mode button in YouTube's player. */ -import { isEnabled, toggleCrop } from '../storage/state'; -import { applyCrop } from './crop'; +import { CropMode } from '../storage/mode'; +import { cycleMode, getMode } from '../storage/state'; +import { applyFit } from './fit'; import { getPlayer } from './dom'; const BUTTON_ATTR = 'data-flrm-btn'; const SVG_NS = 'http://www.w3.org/2000/svg'; +const LABELS: Record = { + off: 'Fullorama: off', + crop: 'Fullorama: crop', + stretch: 'Fullorama: stretch', +}; + function svgElement( tagName: string, attributes: Record, @@ -49,7 +56,7 @@ function createIcon(): SVGSVGElement { svg.append( group, svgElement('rect', { - class: 'flrm-on', + class: 'flrm-crop', x: '13', y: '13', width: '10', @@ -58,17 +65,46 @@ function createIcon(): SVGSVGElement { fill: 'currentColor', stroke: 'none', }), + svgElement('rect', { + class: 'flrm-stretch', + x: '10', + y: '15', + width: '16', + height: '6', + rx: '1', + fill: 'currentColor', + stroke: 'none', + }), ); return svg; } +function syncButtonState(button: HTMLElement): void { + const mode = getMode(); + const label = LABELS[mode]; + const pressed = String(mode !== 'off'); + + if (button.dataset.flrmMode !== mode) { + button.dataset.flrmMode = mode; + } + if (button.title !== label) { + button.title = label; + } + if (button.getAttribute('aria-label') !== label) { + button.setAttribute('aria-label', label); + } + if (button.getAttribute('aria-pressed') !== pressed) { + button.setAttribute('aria-pressed', pressed); + } +} + function onButtonClick(event: Event): void { event.preventDefault(); event.stopPropagation(); - toggleCrop(); + cycleMode(); updateButton(); - applyCrop(getPlayer()); + applyFit(getPlayer(), getMode()); } export function injectButton( @@ -82,12 +118,9 @@ export function injectButton( const button = document.createElement('button'); button.setAttribute(BUTTON_ATTR, ''); button.className = 'ytp-button flrm-btn'; - button.title = 'Fullorama crop'; - button.setAttribute('aria-label', 'Fullorama crop'); - button.setAttribute('aria-pressed', String(isEnabled())); button.append(createIcon()); - button.addEventListener('click', onButtonClick); + syncButtonState(button); controls.insertBefore( button, @@ -99,11 +132,7 @@ export function updateButton(): void { const btn = document.querySelector( '#movie_player [' + BUTTON_ATTR + ']', ); - if (!btn) { - return; - } - const pressed = String(isEnabled()); - if (btn.getAttribute('aria-pressed') !== pressed) { - btn.setAttribute('aria-pressed', pressed); + if (btn) { + syncButtonState(btn); } } diff --git a/src/player/crop.ts b/src/player/crop.ts deleted file mode 100644 index 84869c4..0000000 --- a/src/player/crop.ts +++ /dev/null @@ -1,57 +0,0 @@ -/** - * Crop — applies zoom-to-fill by adding a class + CSS variable to #movie_player. - * The actual transform is defined in content.css. - */ - -import { isEnabled } from '../storage/state'; - -const CROP_CLASS = 'flrm-crop-on'; -const SCALE_VAR = '--flrm-scale'; - -export function applyCrop(player: HTMLElement | null): void { - if (!player) { - return; - } - - if (!isEnabled()) { - if (player.classList.contains(CROP_CLASS)) { - player.classList.remove(CROP_CLASS); - } - if (player.style.getPropertyValue(SCALE_VAR)) { - player.style.removeProperty(SCALE_VAR); - } - return; - } - - const video = player.querySelector('video.html5-main-video'); - if (!video) { - return; - } - - const vw = video.videoWidth; - const vh = video.videoHeight; - if (!vw || !vh) { - return; - } - - const rect = player.getBoundingClientRect(); - if (!rect.width || !rect.height) { - return; - } - - // Scale to fill: ratio of player and video aspect ratios - const videoAspect = vw / vh; - const playerAspect = rect.width / rect.height; - const scale = - Math.round( - Math.max(playerAspect / videoAspect, videoAspect / playerAspect) * 10000, - ) / 10000; - - const nextScale = String(scale); - if (player.style.getPropertyValue(SCALE_VAR) !== nextScale) { - player.style.setProperty(SCALE_VAR, nextScale); - } - if (!player.classList.contains(CROP_CLASS)) { - player.classList.add(CROP_CLASS); - } -} \ No newline at end of file diff --git a/src/player/fit.ts b/src/player/fit.ts new file mode 100644 index 0000000..bb507b0 --- /dev/null +++ b/src/player/fit.ts @@ -0,0 +1,113 @@ +/** + * Fit — applies the active mode to #movie_player. + * Crop zooms the video uniformly to fill; stretch scales each axis to fill. + * The actual transforms are defined in content.css. + */ + +import { CropMode } from '../storage/mode'; + +const CROP_CLASS = 'flrm-crop-on'; +const STRETCH_CLASS = 'flrm-stretch-on'; +const SCALE_VAR = '--flrm-scale'; +const SCALE_X_VAR = '--flrm-scale-x'; +const SCALE_Y_VAR = '--flrm-scale-y'; + +type Aspects = { + video: number; + player: number; +}; + +function readAspects(player: HTMLElement): Aspects | null { + const video = player.querySelector('video.html5-main-video'); + if (!video) { + return null; + } + + const vw = video.videoWidth; + const vh = video.videoHeight; + if (!vw || !vh) { + return null; + } + + const rect = player.getBoundingClientRect(); + if (!rect.width || !rect.height) { + return null; + } + + return { + video: vw / vh, + player: rect.width / rect.height, + }; +} + +function removeClass(player: HTMLElement, name: string): void { + if (player.classList.contains(name)) { + player.classList.remove(name); + } +} + +function removeVar(player: HTMLElement, name: string): void { + if (player.style.getPropertyValue(name)) { + player.style.removeProperty(name); + } +} + +function setVar(player: HTMLElement, name: string, value: string): void { + if (player.style.getPropertyValue(name) !== value) { + player.style.setProperty(name, value); + } +} + +function round(value: number): number { + return Math.round(value * 10000) / 10000; +} + +export function applyFit(player: HTMLElement | null, mode: CropMode): void { + if (!player) { + return; + } + + if (mode === 'off') { + removeClass(player, CROP_CLASS); + removeClass(player, STRETCH_CLASS); + removeVar(player, SCALE_VAR); + removeVar(player, SCALE_X_VAR); + removeVar(player, SCALE_Y_VAR); + return; + } + + const aspects = readAspects(player); + if (!aspects) { + return; + } + + if (mode === 'stretch') { + removeClass(player, CROP_CLASS); + removeVar(player, SCALE_VAR); + + const wider = aspects.player >= aspects.video; + const scaleX = wider ? aspects.player / aspects.video : 1; + const scaleY = wider ? 1 : aspects.video / aspects.player; + + setVar(player, SCALE_X_VAR, String(round(scaleX))); + setVar(player, SCALE_Y_VAR, String(round(scaleY))); + if (!player.classList.contains(STRETCH_CLASS)) { + player.classList.add(STRETCH_CLASS); + } + return; + } + + removeClass(player, STRETCH_CLASS); + removeVar(player, SCALE_X_VAR); + removeVar(player, SCALE_Y_VAR); + + const scale = Math.max( + aspects.player / aspects.video, + aspects.video / aspects.player, + ); + + setVar(player, SCALE_VAR, String(round(scale))); + if (!player.classList.contains(CROP_CLASS)) { + player.classList.add(CROP_CLASS); + } +} diff --git a/src/popup/popup.ts b/src/popup/popup.ts index 72cfac9..39c1bbe 100644 --- a/src/popup/popup.ts +++ b/src/popup/popup.ts @@ -1,14 +1,15 @@ /** - * Popup entrypoint — read-only crop status display. + * Popup entrypoint — read-only mode status display. * - * Reads `cropEnabled` from storage.local once when opened and reflects it. - * It never writes state: the only way to toggle crop is the YouTube player - * button. The popup closes when focus returns to YouTube, so a live + * Reads `cropMode` from storage.local once when opened and reflects it. + * It never writes state: the only way to change the mode is the YouTube + * player button. The popup closes when focus returns to YouTube, so a live * storage listener provides no practical benefit. */ import { canSendFeedbackMetadata, extensionApi } from '../platform/extension-api'; import { STORAGE_KEY } from '../storage/state'; +import { CropMode, parseMode } from '../storage/mode'; import { buildFeedbackUrl, FEEDBACK_URL } from '../feedback'; declare const TARGET_BROWSER: 'chrome' | 'firefox'; @@ -17,6 +18,12 @@ const feedbackSource = TARGET_BROWSER === 'firefox' ? 'firefox-popup' : 'chrome-popup'; +const STATUS: Record = { + off: { text: 'Off', stateClass: 'is-off' }, + crop: { text: 'Crop is on', stateClass: 'is-on' }, + stretch: { text: 'Stretch is on', stateClass: 'is-on' }, +}; + function setStatus(text: string, stateClass: string): void { const status = document.getElementById('status'); const statusText = document.getElementById('status-text'); @@ -45,11 +52,9 @@ async function init(): Promise { try { const result = await extensionApi.storage.local.get(STORAGE_KEY); - if (result[STORAGE_KEY] === true) { - setStatus('Crop is on', 'is-on'); - } else { - setStatus('Crop is off', 'is-off'); - } + const mode = parseMode(result[STORAGE_KEY]) ?? 'off'; + const status = STATUS[mode]; + setStatus(status.text, status.stateClass); } catch { setStatus('Status unavailable', 'is-unavailable'); } diff --git a/src/storage/mode.ts b/src/storage/mode.ts new file mode 100644 index 0000000..4170ab5 --- /dev/null +++ b/src/storage/mode.ts @@ -0,0 +1,22 @@ +/** + * Modes — the three player states, persisted in extension storage. + */ + +export type CropMode = 'off' | 'crop' | 'stretch'; + +export function parseMode(value: unknown): CropMode | null { + return value === 'off' || value === 'crop' || value === 'stretch' + ? value + : null; +} + +export function nextMode(mode: CropMode): CropMode { + switch (mode) { + case 'off': + return 'crop'; + case 'crop': + return 'stretch'; + case 'stretch': + return 'off'; + } +} diff --git a/src/storage/state.ts b/src/storage/state.ts index 6acffa8..d368f30 100644 --- a/src/storage/state.ts +++ b/src/storage/state.ts @@ -1,29 +1,43 @@ /** - * State — crop on/off persisted in extension storage. + * State — player mode persisted in extension storage. */ import { extensionApi } from '../platform/extension-api'; +import { CropMode, nextMode, parseMode } from './mode'; -export const STORAGE_KEY = 'cropEnabled'; +export const STORAGE_KEY = 'cropMode'; +const LEGACY_STORAGE_KEY = 'cropEnabled'; -let cropEnabled = false; +let mode: CropMode = 'off'; -export function isEnabled(): boolean { - return cropEnabled; +export function getMode(): CropMode { + return mode; } -export async function loadState(): Promise { - const result = await extensionApi.storage.local.get(STORAGE_KEY); - cropEnabled = result[STORAGE_KEY] === true; +function setMode(next: CropMode): void { + mode = next; + extensionApi.storage.local.set({ [STORAGE_KEY]: next }); } -function saveState(): void { - extensionApi.storage.local.set({ [STORAGE_KEY]: cropEnabled }); +export async function loadState(): Promise { + const result = await extensionApi.storage.local.get([ + STORAGE_KEY, + LEGACY_STORAGE_KEY, + ]); + + const stored = parseMode(result[STORAGE_KEY]); + if (stored) { + mode = stored; + return; + } + + mode = result[LEGACY_STORAGE_KEY] === true ? 'crop' : 'off'; + await extensionApi.storage.local.set({ [STORAGE_KEY]: mode }); + await extensionApi.storage.local.remove(LEGACY_STORAGE_KEY); } -export function toggleCrop(): void { - cropEnabled = !cropEnabled; - saveState(); +export function cycleMode(): void { + setMode(nextMode(mode)); } export function onStorageChange( @@ -35,12 +49,12 @@ export function onStorageChange( } const change = changes[STORAGE_KEY]; if (change) { - const nextEnabled = change.newValue === true; - if (cropEnabled === nextEnabled) { + const next = parseMode(change.newValue) ?? 'off'; + if (mode === next) { return; } - cropEnabled = nextEnabled; + mode = next; cb(); } }); -} \ No newline at end of file +} diff --git a/src/sync/sync.ts b/src/sync/sync.ts index 6c10fa5..fed113b 100644 --- a/src/sync/sync.ts +++ b/src/sync/sync.ts @@ -3,7 +3,8 @@ * Watches for YouTube DOM changes, navigation events, and player resizes. */ -import { applyCrop } from '../player/crop'; +import { getMode } from '../storage/state'; +import { applyFit } from '../player/fit'; import { injectButton } from '../player/button'; import { getPlayer, getControls } from '../player/dom'; @@ -47,7 +48,7 @@ function observePlayer(player: HTMLElement | null): void { return; } - playerObserver = new ResizeObserver(applyCropNow); + playerObserver = new ResizeObserver(applyFitNow); playerObserver.observe(player); } @@ -59,7 +60,7 @@ function sync(): void { if (player && controls) { injectButton(player, controls); } - applyCrop(player); + applyFit(player, getMode()); } export function scheduleSync(): void { @@ -109,11 +110,11 @@ export function onVideoMetadata(event: Event): void { } } -export function applyCropNow(): void { - applyCrop(getPlayer()); +export function applyFitNow(): void { + applyFit(getPlayer(), getMode()); } -export function applyCropAndSync(): void { - applyCrop(getPlayer()); +export function applyFitAndSync(): void { + applyFit(getPlayer(), getMode()); scheduleSync(); } \ No newline at end of file diff --git a/tests/fit.test.ts b/tests/fit.test.ts new file mode 100644 index 0000000..50ada33 --- /dev/null +++ b/tests/fit.test.ts @@ -0,0 +1,114 @@ +import { describe, expect, it } from 'bun:test'; +import { applyFit } from '../src/player/fit'; + +function createPlayer( + playerWidth = 2560, + playerHeight = 1080, + videoWidth = 1920, + videoHeight = 1080, +) { + const classes = new Set(); + const styles = new Map(); + const video = { videoWidth, videoHeight }; + + const player = { + classList: { + add: (name: string) => { + classes.add(name); + }, + remove: (...names: string[]) => { + for (const name of names) { + classes.delete(name); + } + }, + contains: (name: string) => classes.has(name), + }, + style: { + getPropertyValue: (name: string) => styles.get(name) ?? '', + setProperty: (name: string, value: string) => { + styles.set(name, value); + }, + removeProperty: (name: string) => { + styles.delete(name); + }, + }, + querySelector: () => video, + getBoundingClientRect: () => ({ width: playerWidth, height: playerHeight }), + }; + + return { + player: player as unknown as HTMLElement, + classes, + styles, + }; +} + +describe('applyFit', () => { + it('clears crop and stretch state when off', () => { + const { player, classes, styles } = createPlayer(); + classes.add('flrm-crop-on'); + classes.add('flrm-stretch-on'); + styles.set('--flrm-scale', '1.5'); + styles.set('--flrm-scale-x', '1.5'); + styles.set('--flrm-scale-y', '1.5'); + + applyFit(player, 'off'); + + expect(classes.has('flrm-crop-on')).toBe(false); + expect(classes.has('flrm-stretch-on')).toBe(false); + expect(styles.has('--flrm-scale')).toBe(false); + expect(styles.has('--flrm-scale-x')).toBe(false); + expect(styles.has('--flrm-scale-y')).toBe(false); + }); + + it('applies a uniform scale in crop mode', () => { + const { player, classes, styles } = createPlayer(); + + applyFit(player, 'crop'); + + expect(classes.has('flrm-crop-on')).toBe(true); + expect(classes.has('flrm-stretch-on')).toBe(false); + expect(styles.get('--flrm-scale')).toBe('1.3333'); + expect(styles.has('--flrm-scale-x')).toBe(false); + expect(styles.has('--flrm-scale-y')).toBe(false); + }); + + it('stretches horizontally for a wide player', () => { + const { player, classes, styles } = createPlayer(); + classes.add('flrm-crop-on'); + styles.set('--flrm-scale', '1.5'); + + applyFit(player, 'stretch'); + + expect(classes.has('flrm-stretch-on')).toBe(true); + expect(classes.has('flrm-crop-on')).toBe(false); + expect(styles.has('--flrm-scale')).toBe(false); + expect(styles.get('--flrm-scale-x')).toBe('1.3333'); + expect(styles.get('--flrm-scale-y')).toBe('1'); + }); + + it('stretches vertically when the video is wider than the player', () => { + const { player, classes, styles } = createPlayer(1440, 1080, 1920, 1080); + + applyFit(player, 'stretch'); + + expect(classes.has('flrm-stretch-on')).toBe(true); + expect(styles.get('--flrm-scale-x')).toBe('1'); + expect(styles.get('--flrm-scale-y')).toBe('1.3333'); + }); + + it('drops stretch state when returning to crop', () => { + const { player, classes, styles } = createPlayer(); + classes.add('flrm-stretch-on'); + styles.set('--flrm-scale-x', '1.5'); + styles.set('--flrm-scale-y', '1'); + + applyFit(player, 'crop'); + + expect(classes.has('flrm-crop-on')).toBe(true); + expect(classes.has('flrm-stretch-on')).toBe(false); + expect(styles.get('--flrm-scale')).toBe('1.3333'); + expect(styles.has('--flrm-scale-x')).toBe(false); + expect(styles.has('--flrm-scale-y')).toBe(false); + }); +}); diff --git a/tests/mode.test.ts b/tests/mode.test.ts new file mode 100644 index 0000000..46d7720 --- /dev/null +++ b/tests/mode.test.ts @@ -0,0 +1,27 @@ +import { describe, expect, it } from 'bun:test'; +import { nextMode, parseMode } from '../src/storage/mode'; + +describe('parseMode', () => { + it('accepts the three known modes', () => { + expect(parseMode('off')).toBe('off'); + expect(parseMode('crop')).toBe('crop'); + expect(parseMode('stretch')).toBe('stretch'); + }); + + it('rejects unknown values', () => { + expect(parseMode(undefined)).toBeNull(); + expect(parseMode(null)).toBeNull(); + expect(parseMode(true)).toBeNull(); + expect(parseMode('CROP')).toBeNull(); + expect(parseMode('on')).toBeNull(); + expect(parseMode(1)).toBeNull(); + }); +}); + +describe('nextMode', () => { + it('cycles off -> crop -> stretch -> off', () => { + expect(nextMode('off')).toBe('crop'); + expect(nextMode('crop')).toBe('stretch'); + expect(nextMode('stretch')).toBe('off'); + }); +}); diff --git a/tests/state.test.ts b/tests/state.test.ts new file mode 100644 index 0000000..5cee7f0 --- /dev/null +++ b/tests/state.test.ts @@ -0,0 +1,107 @@ +import { beforeEach, describe, expect, it } from 'bun:test'; + +type Store = Record; + +let store: Store = {}; +let removed: string[][] = []; + +(globalThis as { chrome?: unknown }).chrome = { + storage: { + local: { + get: async (keys: string | string[]) => { + const list = Array.isArray(keys) ? keys : [keys]; + return Object.fromEntries( + list.filter((key) => key in store).map((key) => [key, store[key]]), + ); + }, + set: async (values: Store) => { + Object.assign(store, values); + }, + remove: async (keys: string | string[]) => { + const list = Array.isArray(keys) ? keys : [keys]; + removed.push(list); + for (const key of list) { + delete store[key]; + } + }, + }, + onChanged: { + addListener: () => {}, + }, + }, +}; + +beforeEach(() => { + store = {}; + removed = []; +}); + +const state = await import('../src/storage/state'); + +describe('loadState', () => { + it('migrates legacy enabled to crop and removes the old key', async () => { + store.cropEnabled = true; + + await state.loadState(); + + expect(state.getMode()).toBe('crop'); + expect(store.cropMode).toBe('crop'); + expect('cropEnabled' in store).toBe(false); + expect(removed).toContainEqual(['cropEnabled']); + }); + + it('migrates a legacy disabled value to off', async () => { + store.cropEnabled = false; + + await state.loadState(); + + expect(state.getMode()).toBe('off'); + expect(store.cropMode).toBe('off'); + expect('cropEnabled' in store).toBe(false); + }); + + it('starts a fresh install at off', async () => { + await state.loadState(); + + expect(state.getMode()).toBe('off'); + expect(store.cropMode).toBe('off'); + }); + + it('keeps an existing mode', async () => { + store.cropMode = 'stretch'; + + await state.loadState(); + + expect(state.getMode()).toBe('stretch'); + expect(store.cropMode).toBe('stretch'); + expect(removed).toEqual([]); + }); + + it('falls back to migration when the stored mode is invalid', async () => { + store.cropMode = 'zoom'; + store.cropEnabled = true; + + await state.loadState(); + + expect(state.getMode()).toBe('crop'); + expect(store.cropMode).toBe('crop'); + }); +}); + +describe('cycleMode', () => { + it('advances through off, crop, stretch and back', async () => { + await state.loadState(); + + state.cycleMode(); + expect(state.getMode()).toBe('crop'); + expect(store.cropMode).toBe('crop'); + + state.cycleMode(); + expect(state.getMode()).toBe('stretch'); + expect(store.cropMode).toBe('stretch'); + + state.cycleMode(); + expect(state.getMode()).toBe('off'); + expect(store.cropMode).toBe('off'); + }); +}); From 2c3c32e1f826e00df1026eb035267f78dec8f7c6 Mon Sep 17 00:00:00 2001 From: Deepak Tripathy Date: Mon, 9 Nov 2026 18:04:49 +0300 Subject: [PATCH 2/7] feat: move mode selection to the popup --- CHANGELOG.md | 201 +++++++++++++++++++++++++----------------- README.md | 72 ++++++++------- package.json | 2 +- scripts/build.ts | 1 + src/content.css | 4 +- src/index.ts | 14 +-- src/player/button.ts | 18 ++-- src/player/fit.ts | 12 ++- src/popup/popup.css | 127 ++++++++++++++++++++++++++ src/popup/popup.html | 16 ++++ src/popup/popup.ts | 53 +++++++---- src/popup/preview.jpg | Bin 0 -> 25123 bytes src/storage/mode.ts | 23 ++--- src/storage/state.ts | 100 +++++++++++++++------ src/sync/sync.ts | 8 +- tests/build.test.ts | 5 ++ tests/fit.test.ts | 23 +++-- tests/mode.test.ts | 43 +++++---- tests/state.test.ts | 128 +++++++++++++++++++++------ 19 files changed, 605 insertions(+), 245 deletions(-) create mode 100644 src/popup/preview.jpg diff --git a/CHANGELOG.md b/CHANGELOG.md index d14ceb5..e3059e1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,101 +7,144 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] -## [1.3.0] - 2026-11-09 +## [1.3.1] - 2026-11-09 ### Added -- Stretch mode: fills the player by scaling the video unevenly on the shorter - axis instead of trimming the edges. People who prefer seeing the whole frame - can now choose distortion over cropping. -- The player button now cycles through three states: off, crop, stretch, off. +- Stretch mode. It fills the player by scaling the video unevenly on the + shorter axis instead of trimming the edges. People who prefer seeing the + whole frame can now choose distortion over cropping. +- The toolbar popup now has two large selectable cards, Crop and Stretch, each + with an animated preview of a 21:9 player. The previews loop between normal + and the mode applied, so the difference is visible before choosing. +- The popup reports the selected mode and whether it is on: + `Crop is off`, `Crop is on`, `Stretch is off`, `Stretch is on`. ### Changed -- The toolbar popup reports the current mode (`Off`, `Crop is on`, - `Stretch is on`) instead of a single on/off value. -- The selected mode is stored as `cropMode` (`off`, `crop`, or `stretch`) - instead of the boolean `cropEnabled`. -- Existing installs are migrated once on first load: - `cropEnabled: true` becomes `cropMode: "crop"`, `false` or missing becomes - `"off"`. The old key is then removed so storage has one source of truth. -- The player button keeps its corner brackets, with a small square for crop and - a wide bar for stretch. Its `title`, `aria-label`, and `data-flrm-mode` follow - the mode. -- The README features, FAQ, and How It Works sections describe the two fill - modes and the new storage key. +- The player button no longer cycles through three states. It turns the mode + selected in the popup off and on. The popup card is now the only mode + selector; the player button is the only off switch. +- Clicking a popup card selects that mode and turns it on. Clicking the active + card keeps it on. +- The selected card is outlined; it fills in when the mode is on. The player + icon still distinguishes the active mode: a small square for crop, a wide bar + for stretch, and only while the selected mode is on. +- The popup is interactive instead of read-only. +- State is stored as `fillMode` (`crop` or `stretch`) and `fillEnabled` + (`true` or `false`) instead of a single `cropMode` tri-state or the older + boolean `cropEnabled`. Existing values are migrated once on first load and + the old keys are removed. +- The README features, FAQ, and How It Works sections describe the split + controls, the previews, and the two storage keys. ### Implementation -**Why a third state rather than a toggle:** crop and stretch are different -trade-offs, not two ways of doing the same thing. Crop preserves shape and -trims edges; stretch preserves framing and distorts shape. The user has to be -able to pick one, so the state model is a three-value mode rather than two -independent booleans. One key also avoids an impossible "crop and stretch both -on" state and keeps cross-tab comparison to a single value. +**Why two values instead of one:** the player can be off while still +remembering which mode its button should turn back on. A single +`off | crop | stretch` value cannot represent "stretch is selected but currently +off" without losing the last mode, and two independent booleans would allow the +impossible "crop and stretch both on" state. `fillMode` plus `fillEnabled` +models the interaction exactly: the popup picks the mode, the player button +toggles the boolean. + +**Interaction model:** clicking a card calls `selectMode`, which sets the mode +and sets `fillEnabled` to true. The player button calls `toggleEnabled`, which +changes only the boolean. This is why the player button is the only off switch +and why the popup can change modes without a separate toggle. **Files added:** -- `src/storage/mode.ts` — defines `CropMode` and two pure helpers. - `parseMode` is the single validation point for the stored mode; the legacy - boolean is read once during migration. `nextMode` is the single definition of - the button cycle, so the UI cannot drift from the stored order. -- `tests/mode.test.ts` — covers accepted/rejected values and the cycle order. -- `tests/state.test.ts` — drives `loadState` and `cycleMode` against an - in-memory `chrome.storage.local` fake: legacy true/false, fresh install, - existing mode, invalid mode fallback, and cycle writes. +- `src/storage/mode.ts` — `FillMode` (`crop | stretch`), `parseFillMode` for the + new key, and `parseLegacyMode` for the old `off | crop | stretch` form. + `parseLegacyMode` exists only for migration, so the removed three-state model + cannot leak into runtime code. +- `src/popup/preview.jpg` — a 560×315 JPEG cropped from + `store-assets/screenshots/screenshot-before-off-1280x800.png`, above the + player controls. It shows a real YouTube video frame, keeps the popup package + around 25 KB, and stays sharp at 2× and 3× display density. +- `tests/mode.test.ts` — accept/reject tables for both parsers. +- `tests/state.test.ts` — drives `loadState`, `selectMode`, and `toggleEnabled` + against an in-memory `chrome.storage.local` fake: both migration chains, fresh + install, valid keys untouched, malformed fallback, and writes. - `tests/fit.test.ts` — drives the renderer with a fake player object (class set, style map, fixed geometry), so no browser or `chrome` stub is needed. - `CHANGELOG.md` — this file. **Files changed:** -- `src/player/crop.ts` → `src/player/fit.ts` — renamed and rewritten as a - pure renderer. `applyFit(player, mode)` receives the mode instead of reading - storage, which keeps storage out of the render path and makes the transitions - testable. Crop keeps its original uniform scale: - `max(playerAspect / videoAspect, videoAspect / playerAspect)`, written to - `--flrm-scale`. Stretch writes `--flrm-scale-x` and `--flrm-scale-y`: the +- `src/storage/state.ts` — holds `fillMode` and `fillEnabled` in memory and + persists both. `loadState` first accepts a valid pair of new keys, then falls + back through `cropMode` and `cropEnabled`, writes the new pair, and removes + the legacy keys. `onStorageChange` watches both keys and fires one callback + per change event, so a popup write and a player-button write both update open + YouTube tabs. +- `src/player/fit.ts` — now `applyFit(player, enabled, mode)`. Disabled clears + both mode classes and all scale variables. Crop keeps its original uniform + scale, `max(playerAspect / videoAspect, videoAspect / playerAspect)`, written + to `--flrm-scale`. Stretch writes `--flrm-scale-x` and `--flrm-scale-y`: the shorter axis gets the ratio, the other stays `1`. Both round to four decimal - places and only write when the value changes, matching the original - write-only-if-needed style. -- `src/content.css` — added the `.flrm-stretch-on` transform. This uses a - transform instead of `width`/`height` plus `object-fit` because YouTube sizes - `.html5-main-video` to the video's own aspect ratio and centers it inside the - player. On a live page the video was 649×365 at `left: 68px` inside a - 784×365 player, and its `.html5-video-container` had zero height, so - percentage sizing is unreliable. Scaling the element is the same mechanism - crop already uses and was verified against the live player. -- `src/player/button.ts` — one `syncButtonState` now writes mode, label, and - `aria-pressed` for both freshly injected and existing buttons. The icon has - two overlay shapes toggled by CSS, so the DOM is built once and only its - state changes. -- `src/storage/state.ts` — `cropMode` is now the in-memory and persisted - value. `loadState` reads both keys, validates the new one with `parseMode`, - falls back to the legacy boolean, writes the new key, and removes the old - one. `onStorageChange` compares mode strings instead of booleans. Removed - `isEnabled`, which had no remaining callers. -- `src/sync/sync.ts`, `src/index.ts` — call `applyFit(getPlayer(), getMode())`. - The navigation, mutation, resize, metadata, fullscreen, and retry logic is - unchanged; that is what makes the mode survive navigation, refresh, theater - mode, and fullscreen. -- `src/popup/popup.ts` — maps the stored mode to text and a status class with - a `Record`; the popup stays read-only. -- `package.json` — version 1.3.0. The build reads the version from here and - writes it into both generated manifests. -- `README.md` — documents crop versus stretch, the three-state button, the - popup text, and the new storage/migration behavior. - -**Upgrade path:** no action is required from users. The first content script -load after upgrading translates the old boolean, saves `cropMode`, and removes -`cropEnabled`. Someone who had crop on stays in crop; a fresh install starts -off. If the stored `cropMode` is ever malformed, it falls back through the same -migration path. - -**Testing:** `bun run test` covers mode parsing/cycling, the migration paths, -and the renderer's class and variable transitions. The stretch CSS and icon -states were checked against a live YouTube player (geometry coverage and a -visual screenshot). Manual checks cover the parts unit tests cannot: navigation, -refresh, theater/fullscreen, cross-tab sync, the popup, and the legacy storage -migration in a real extension context. `web-ext lint` reports no errors; its one -warning about `strict_min_version` and Android is pre-existing. + places and only write when the value changes. The mode math is unchanged; + only the enabled gate and the parameter list changed. +- `src/player/button.ts` — `syncButtonState` now writes the selected mode to + `data-flrm-mode`, the enabled state to `aria-pressed`, and a label such as + `Fullorama: crop off` or `Fullorama: stretch on`. Clicking toggles enabled + instead of advancing a cycle. The icon still contains both overlay shapes; + CSS reveals only the matching one while the button is pressed. +- `src/content.css` — the icon rules now require + `[aria-pressed="true"]` as well as the mode attribute, so the square and bar + disappear when off. The crop and stretch transforms are otherwise unchanged. + Transforms are used instead of `width`/`height` plus `object-fit` because + YouTube sizes `.html5-main-video` to the video's own aspect ratio and centers + it inside the player. On a live page the video was 649×365 at `left: 68px` + inside a 784×365 player, and its `.html5-video-container` had zero height, so + percentage sizing is unreliable. +- `src/popup/popup.html` — adds the two mode cards between the status line and + the feedback link. Each card is a button with a decorative 21:9 preview and a + visible Crop/Stretch label. +- `src/popup/popup.css` — two equal card columns that can shrink below the + image's intrinsic width (`minmax(0, 1fr)` plus `min-width: 0`). At the 300 px + popup width this yields 129 px cards and 48.7 px previews. Selected is an + accent outline; on is an accent-tinted fill. The preview starts as a 16:9 + image centred in a 21:9 box, so it has side bars. Crop scales both axes by + `21 ÷ 16 = 1.3125`; stretch scales only X by the same amount. Both run the + same 5-second loop: hold normal, transition, hold applied, transition back. + `prefers-reduced-motion: reduce` removes the animation and holds each card in + its applied state so the preview still explains the mode. +- `src/popup/popup.ts` — loads shared state, renders the status text and card + classes, and calls `selectMode` on a card click. `aria-pressed` marks the + selected mode; the status line and fill treatment communicate on/off. +- `src/sync/sync.ts`, `src/index.ts` — pass `isEnabled()` and `getMode()` to + `applyFit`. The navigation, mutation, resize, metadata, fullscreen, and retry + logic is unchanged; that is what keeps the selected mode and on/off state + across navigation, refresh, theater mode, and fullscreen. +- `scripts/build.ts` — copies `preview.jpg` into both package roots. +- `package.json` — version 1.3.1. The build reads it and writes it into both + generated manifests. +- `README.md` — documents choosing a mode in the popup, toggling it from the + player button, the previews, the two storage keys, and the migration path. + +**Upgrade path:** no action is required from users. On first load the extension +translates the first key it finds and removes the legacy keys: + +| Stored value | Result | +| --- | --- | +| `cropMode: "crop"` | mode crop, enabled | +| `cropMode: "stretch"` | mode stretch, enabled | +| `cropMode: "off"` | mode crop, disabled | +| `cropEnabled: true` | mode crop, enabled | +| `cropEnabled: false` | mode crop, disabled | +| nothing or malformed | mode crop, disabled | + +Someone who had crop on stays in crop with it on. Someone who had stretch on +stays in stretch with it on. A fresh install starts in crop, off, outlined in +the popup. + +**Testing:** `bun run test` covers mode parsing, both migration chains, +`selectMode`/`toggleEnabled`, the renderer's class and variable transitions, and +the presence of `preview.jpg` in both packages. The popup was rendered in a +300 px stubbed-Chrome harness: the grid resolves to 129 px cards with 48.7 px +previews, and the selected/on state and status text update on click. The +stretch transform geometry was checked against a live YouTube player during +development. `web-ext lint` reports no errors; its one warning about +`strict_min_version` and Android is pre-existing. diff --git a/README.md b/README.md index d6b9c2b..29e0477 100644 --- a/README.md +++ b/README.md @@ -7,11 +7,11 @@ Website: https://fullorama.com [![Install from the Chrome Web Store](https://img.shields.io/badge/Get_it_on-Chrome_Web_Store-4285F4?style=for-the-badge&logo=googlechrome&logoColor=white)](https://chromewebstore.google.com/detail/fullorama-for-youtube/pacjdmdcmmnbpnjfhmjfgenbpedbakjg) [![Install from Firefox Add-ons](https://img.shields.io/badge/Get_it_on-Firefox_Add--ons-FF7139?style=for-the-badge&logo=firefoxbrowser&logoColor=white)](https://addons.mozilla.org/firefox/addon/fullorama/) -Fullorama for YouTube™ adds one button directly to YouTube's player. Click it to -cycle between crop, stretch, and off. Crop zooms in evenly to fill the player and -trims the edges; stretch widens the picture to fill it and leaves nothing out. -The choice stays across videos, refreshes, navigation, and fullscreen, until you -change it. +Fullorama for YouTube™ adds one button directly to YouTube's player. Choose Crop +or Stretch in the toolbar popup, then click the player button to turn that mode +on or off. Crop zooms in evenly to fill the player and trims the edges; stretch +widens the picture to fill it and leaves nothing out. The choice stays across +videos, refreshes, navigation, and fullscreen, until you change it. Built for 21:9 and other ultrawide displays. @@ -32,20 +32,22 @@ https://github.com/user-attachments/assets/3c62393f-5d82-4c7b-8543-0c3c0938f052 ## Features -- YouTube player button that cycles off, crop, and stretch +- Choose Crop or Stretch in the toolbar popup +- Animated previews show what each mode does +- YouTube player button turns the selected mode on or off - Crop mode zooms evenly to fill the player and trims the edges - Stretch mode fills the player without trimming, at the cost of distortion -- The chosen mode persists across videos, refreshes, and navigation +- The selected mode and on/off state persist across videos, refreshes, and navigation - Works with YouTube's single-page navigation - Works in theater mode and fullscreen -- Read-only popup shows the current mode +- Popup shows the selected mode and whether it's on or off - Optional feedback form (popup link and uninstall survey) ## FAQ ### How do I watch YouTube full screen on an ultrawide monitor? -Install Fullorama for [Chrome](https://chromewebstore.google.com/detail/fullorama-for-youtube/pacjdmdcmmnbpnjfhmjfgenbpedbakjg) or [Firefox](https://addons.mozilla.org/firefox/addon/fullorama/) and play any YouTube video. Look at the bottom-right of the player: there's a new button with four little corner brackets, next to the settings gear. Click it once to crop, which zooms the video in to fill the player. Click it again to stretch, which fills the player without trimming anything. A small square or wide bar appears in the middle of the icon to show which mode is on. Click it once more to go back to normal. +Install Fullorama for [Chrome](https://chromewebstore.google.com/detail/fullorama-for-youtube/pacjdmdcmmnbpnjfhmjfgenbpedbakjg) or [Firefox](https://addons.mozilla.org/firefox/addon/fullorama/) and play any YouTube video. Click Fullorama's icon in your browser toolbar and choose Crop or Stretch from the two preview cards. Crop zooms the video in to fill the player; stretch fills it without trimming anything, at the cost of distortion. Then use the new button with four little corner brackets at the bottom-right of the player, next to the settings gear, to turn that mode on or off. A small square (crop) or wide bar (stretch) appears in the middle of the icon while it's on. ### I can't find the button. Where is it? @@ -53,7 +55,7 @@ It's with YouTube's own buttons at the bottom-right of the video, between the se ### Will the video look stretched? -Crop mode doesn't stretch anything. It zooms in evenly from the center, so people and objects keep their normal shape; the trade-off is that a little of the edges gets trimmed. Stretch mode does stretch the picture to fill the player and will make it look wider or taller than it is. Nothing gets trimmed in stretch mode. Use crop if you care more about shape, and stretch if you care more about seeing the whole frame. +Crop mode doesn't stretch anything. It zooms in evenly from the center, so people and objects keep their normal shape; the trade-off is that a little of the edges gets trimmed. Stretch mode does stretch the picture to fill the player and will make it look wider or taller than it is. Nothing gets trimmed in stretch mode. Use crop if you care more about shape, and stretch if you care more about seeing the whole frame. The player button turns the selected mode off at any time. ### Why do some videos still have black bars? @@ -65,7 +67,7 @@ Yes. When you switch to theater mode or fullscreen, the scaling adjusts automati ### Do I have to click it for every video? -No. Pick a mode once and it stays selected as you watch more videos, refresh, or browse around YouTube. Change it the same way whenever you like. The setting applies to all of YouTube in that browser. +No. Pick a mode once and it stays selected as you watch more videos, refresh, or browse around YouTube. It also remembers whether it was on or off. Change either from the toolbar popup or the player button whenever you like. The setting applies to all of YouTube in that browser. ### Does it work on 21:9 and 32:9 ultrawide monitors? @@ -73,7 +75,7 @@ Yes. Fullorama works out the scaling from the shape of your player and the video ### Can I fill the screen and still see the whole picture? -Only if the video is already the same shape as your screen. Crop mode trims a little of the edges to fill it; stretch mode keeps everything but distorts the shape. You can turn the button off any time to see the original picture. +Only if the video is already the same shape as your screen. Crop mode trims a little of the edges to fill it; stretch mode keeps everything but distorts the shape. You can turn the selected mode off any time to see the original picture. ### Does it work on Netflix, other sites, or my phone? @@ -85,11 +87,11 @@ It just scales the video that's already playing, so it doesn't change the video' ### What's the toolbar icon for? -Clicking Fullorama's icon in your browser toolbar shows whether you're off, in crop, or in stretch, and has a link to send us feedback. To change the mode, use the button in the video player. +Clicking Fullorama's icon in your browser toolbar opens the mode picker. It shows whether the selected mode is on or off, has animated previews of Crop and Stretch, and lets you choose between them. Clicking a card selects that mode and turns it on. To turn the selected mode off, use the button in the video player. ### Does Fullorama collect my data? -No. It saves one thing in your browser: which mode is selected. It doesn't track what you watch, has no ads, and needs no account. +No. It saves two things in your browser: which mode you selected and whether it's on or off. It doesn't track what you watch, has no ads, and needs no account. Feedback is optional and goes through a separate form run by Tally. It opens if you choose "Share feedback" in the toolbar popup, or after you uninstall. The form link includes the extension's version and where you opened it from. On Firefox, those two details are only sent if you've allowed the optional data permission. See the [privacy policy](https://fullorama.com/privacy) for the full details. @@ -99,22 +101,32 @@ Yes, completely free and open source. The code is on GitHub under the [MIT licen ## How It Works -The extension stores `cropMode` — `off`, `crop`, or `stretch` — in extension -local storage (`chrome.storage.local` on Chrome and `browser.storage.local` on -Firefox). Upgrading from a version that stored `cropEnabled` translates the old -on/off value to `crop`/`off` on first load and removes the old key. - -A read-only toolbar popup displays the current mode by reading the stored value -once when opened. The popup cannot change it — only the player button can. A -tiny background script registers an uninstall survey URL so the browser can open -the optional feedback form if you remove the extension. - -When a mode is active, the content script adds a class to YouTube's -`#movie_player` element and sets CSS variables from the current player and video -aspect ratios. Crop scales both axes by the same amount and clips the overflow, -so the picture fills the player without changing shape. Stretch scales only the -shorter axis, so the picture fills the player but changes shape. `content.css` -applies both transforms from the center. +The extension stores `fillMode` (`crop` or `stretch`) and `fillEnabled` +(`true` or `false`) in extension local storage (`chrome.storage.local` on Chrome +and `browser.storage.local` on Firefox). Two values are needed because the +player can be off while still remembering which mode its button will turn back +on. Upgrading translates the older keys on first load and removes them: +`cropMode: "crop"` or `"stretch"` becomes that mode with fill enabled, +`cropMode: "off"` becomes crop with fill disabled, and `cropEnabled: true` or +`false` becomes crop enabled or disabled. + +The toolbar popup is interactive. It reads the state once, renders the status +line and the two cards (outline for selected, fill when on), and calls +`selectMode` when a card is clicked, which selects that mode and turns fill on. +The animated cards are CSS-only: a 21:9 box holds a 16:9 still, scaled uniformly +by `21 ÷ 16 = 1.3125` for crop or on the X axis only for stretch, looping between +normal and applied states. The player button calls `toggleEnabled`, so it only +turns the selected mode off and on. A tiny background script registers an +uninstall survey URL so the browser can open the optional feedback form if you +remove the extension. + +When enabled, the content script passes the on/off state and mode to the +renderer, which adds a class to YouTube's `#movie_player` element and sets CSS +variables from the current player and video aspect ratios. Crop scales both axes +by the same amount and clips the overflow, so the picture fills the player +without changing shape. Stretch scales only the shorter axis, so the picture +fills the player but changes shape. `content.css` applies both transforms from +the center. YouTube rebuilds parts of its player during normal navigation, so the extension uses YouTube navigation events, a controls-scoped `MutationObserver`, a diff --git a/package.json b/package.json index bea4f77..c442a62 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "fullorama", - "version": "1.3.0", + "version": "1.3.1", "description": "Fill your ultrawide screen with YouTube videos without distracting black bars.", "type": "module", "license": "MIT", diff --git a/scripts/build.ts b/scripts/build.ts index abcc2db..d1bebde 100644 --- a/scripts/build.ts +++ b/scripts/build.ts @@ -79,6 +79,7 @@ function copyStatic(target: BuildTarget): void { copyFileSync('src/content.css', `${target.distDir}/content.css`); copyFileSync('src/popup/popup.html', `${target.distDir}/popup.html`); copyFileSync('src/popup/popup.css', `${target.distDir}/popup.css`); + copyFileSync('src/popup/preview.jpg', `${target.distDir}/preview.jpg`); rmSync(`${target.distDir}/icons`, { recursive: true, force: true }); cpSync('icons', `${target.distDir}/icons`, { recursive: true }); } diff --git a/src/content.css b/src/content.css index 1f96115..1898767 100644 --- a/src/content.css +++ b/src/content.css @@ -16,11 +16,11 @@ display: none; } -.flrm-btn[data-flrm-mode="crop"] .flrm-crop { +.flrm-btn[aria-pressed="true"][data-flrm-mode="crop"] .flrm-crop { display: block; } -.flrm-btn[data-flrm-mode="stretch"] .flrm-stretch { +.flrm-btn[aria-pressed="true"][data-flrm-mode="stretch"] .flrm-stretch { display: block; } diff --git a/src/index.ts b/src/index.ts index 062d4bc..0f1f130 100644 --- a/src/index.ts +++ b/src/index.ts @@ -1,13 +1,13 @@ /** * Fullorama for YouTube™ * - * Adds a mode button to the YouTube player that cycles through off, crop, - * and stretch. Crop zooms the video to fill the player; stretch scales it - * to fill. The mode persists in chrome.storage.local across videos, - * refreshes, and navigation. + * Adds a button to the YouTube player that turns the selected fill mode on or + * off. The toolbar popup chooses crop (uniform zoom that trims edges) or + * stretch (scales one axis and distorts). The mode and on/off state persist in + * chrome.storage.local across videos, refreshes, and navigation. */ -import { getMode, loadState, onStorageChange } from './storage/state'; +import { getMode, isEnabled, loadState, onStorageChange } from './storage/state'; import { updateButton } from './player/button'; import { applyFit } from './player/fit'; import { getPlayer } from './player/dom'; @@ -25,10 +25,10 @@ async function init(): Promise { // Sync from other tabs onStorageChange(() => { updateButton(); - applyFit(getPlayer(), getMode()); + applyFit(getPlayer(), isEnabled(), getMode()); }); - // Apply crop immediately on resize and fullscreen + // Apply the selected mode immediately on resize and fullscreen window.addEventListener('resize', applyFitNow, { passive: true }); document.addEventListener('fullscreenchange', applyFitAndSync); document.addEventListener('yt-navigate-finish', retryBurst); diff --git a/src/player/button.ts b/src/player/button.ts index eb6c495..2ae4b9b 100644 --- a/src/player/button.ts +++ b/src/player/button.ts @@ -2,20 +2,13 @@ * Button — injects and manages the mode button in YouTube's player. */ -import { CropMode } from '../storage/mode'; -import { cycleMode, getMode } from '../storage/state'; +import { getMode, isEnabled, toggleEnabled } from '../storage/state'; import { applyFit } from './fit'; import { getPlayer } from './dom'; const BUTTON_ATTR = 'data-flrm-btn'; const SVG_NS = 'http://www.w3.org/2000/svg'; -const LABELS: Record = { - off: 'Fullorama: off', - crop: 'Fullorama: crop', - stretch: 'Fullorama: stretch', -}; - function svgElement( tagName: string, attributes: Record, @@ -82,8 +75,9 @@ function createIcon(): SVGSVGElement { function syncButtonState(button: HTMLElement): void { const mode = getMode(); - const label = LABELS[mode]; - const pressed = String(mode !== 'off'); + const enabled = isEnabled(); + const label = `Fullorama: ${mode} ${enabled ? 'on' : 'off'}`; + const pressed = String(enabled); if (button.dataset.flrmMode !== mode) { button.dataset.flrmMode = mode; @@ -102,9 +96,9 @@ function syncButtonState(button: HTMLElement): void { function onButtonClick(event: Event): void { event.preventDefault(); event.stopPropagation(); - cycleMode(); + toggleEnabled(); updateButton(); - applyFit(getPlayer(), getMode()); + applyFit(getPlayer(), isEnabled(), getMode()); } export function injectButton( diff --git a/src/player/fit.ts b/src/player/fit.ts index bb507b0..d0b07fd 100644 --- a/src/player/fit.ts +++ b/src/player/fit.ts @@ -1,10 +1,10 @@ /** - * Fit — applies the active mode to #movie_player. + * Fit — applies the selected fill mode to #movie_player when enabled. * Crop zooms the video uniformly to fill; stretch scales each axis to fill. * The actual transforms are defined in content.css. */ -import { CropMode } from '../storage/mode'; +import { FillMode } from '../storage/mode'; const CROP_CLASS = 'flrm-crop-on'; const STRETCH_CLASS = 'flrm-stretch-on'; @@ -62,12 +62,16 @@ function round(value: number): number { return Math.round(value * 10000) / 10000; } -export function applyFit(player: HTMLElement | null, mode: CropMode): void { +export function applyFit( + player: HTMLElement | null, + enabled: boolean, + mode: FillMode, +): void { if (!player) { return; } - if (mode === 'off') { + if (!enabled) { removeClass(player, CROP_CLASS); removeClass(player, STRETCH_CLASS); removeVar(player, SCALE_VAR); diff --git a/src/popup/popup.css b/src/popup/popup.css index 33e16b4..f921c02 100644 --- a/src/popup/popup.css +++ b/src/popup/popup.css @@ -85,6 +85,133 @@ body { color: var(--muted); } +.modes { + display: grid; + grid-template-columns: repeat(2, minmax(0, 1fr)); + gap: 10px; +} + +.mode { + display: flex; + flex-direction: column; + gap: 7px; + min-width: 0; + padding: 7px; + color: var(--text); + background: var(--surface); + border: 1px solid var(--border); + border-radius: 10px; + font: inherit; + text-align: left; + cursor: pointer; +} + +.mode:hover { + border-color: #4a4a4a; +} + +.mode:focus-visible { + outline: 2px solid var(--on); + outline-offset: 2px; +} + +.mode.is-selected { + border-color: var(--on); +} + +.mode.is-selected .mode-label { + color: var(--on); +} + +.mode.is-on { + background: rgba(43, 166, 64, 0.16); + box-shadow: inset 0 0 0 1px var(--on); +} + +.preview { + --preview-fill: 1.3125; + display: flex; + align-items: center; + justify-content: center; + width: 100%; + aspect-ratio: 21 / 9; + overflow: hidden; + background: #000; + border-radius: 6px; +} + +.preview-frame { + display: block; + width: auto; + height: 100%; + max-width: none; + transform-origin: center center; +} + +.mode[data-mode="crop"] .preview-frame { + animation: preview-crop 5s ease-in-out infinite; +} + +.mode[data-mode="stretch"] .preview-frame { + animation: preview-stretch 5s ease-in-out infinite; +} + +.mode-label { + padding: 0 2px 1px; + font-size: 11px; + font-weight: 600; + letter-spacing: 0.08em; + text-transform: uppercase; +} + +@keyframes preview-crop { + 0%, + 20% { + transform: scale(1); + } + + 30%, + 70% { + transform: scale(var(--preview-fill)); + } + + 80%, + 100% { + transform: scale(1); + } +} + +@keyframes preview-stretch { + 0%, + 20% { + transform: scaleX(1); + } + + 30%, + 70% { + transform: scaleX(var(--preview-fill)); + } + + 80%, + 100% { + transform: scaleX(1); + } +} + +@media (prefers-reduced-motion: reduce) { + .preview-frame { + animation: none; + } + + .mode[data-mode="crop"] .preview-frame { + transform: scale(var(--preview-fill)); + } + + .mode[data-mode="stretch"] .preview-frame { + transform: scaleX(var(--preview-fill)); + } +} + .links { display: flex; } diff --git a/src/popup/popup.html b/src/popup/popup.html index d9735f0..d1c4bb7 100644 --- a/src/popup/popup.html +++ b/src/popup/popup.html @@ -17,6 +17,22 @@

Fullorama

Loading… +
+ + + +
+ diff --git a/src/popup/popup.ts b/src/popup/popup.ts index 39c1bbe..77da4bb 100644 --- a/src/popup/popup.ts +++ b/src/popup/popup.ts @@ -1,15 +1,10 @@ /** - * Popup entrypoint — read-only mode status display. - * - * Reads `cropMode` from storage.local once when opened and reflects it. - * It never writes state: the only way to change the mode is the YouTube - * player button. The popup closes when focus returns to YouTube, so a live - * storage listener provides no practical benefit. + * Popup entrypoint — selects the fill mode and turns it on. */ import { canSendFeedbackMetadata, extensionApi } from '../platform/extension-api'; -import { STORAGE_KEY } from '../storage/state'; -import { CropMode, parseMode } from '../storage/mode'; +import { FillMode } from '../storage/mode'; +import { getMode, isEnabled, loadState, selectMode } from '../storage/state'; import { buildFeedbackUrl, FEEDBACK_URL } from '../feedback'; declare const TARGET_BROWSER: 'chrome' | 'firefox'; @@ -18,10 +13,9 @@ const feedbackSource = TARGET_BROWSER === 'firefox' ? 'firefox-popup' : 'chrome-popup'; -const STATUS: Record = { - off: { text: 'Off', stateClass: 'is-off' }, - crop: { text: 'Crop is on', stateClass: 'is-on' }, - stretch: { text: 'Stretch is on', stateClass: 'is-on' }, +const LABELS: Record = { + crop: 'Crop', + stretch: 'Stretch', }; function setStatus(text: string, stateClass: string): void { @@ -35,6 +29,31 @@ function setStatus(text: string, stateClass: string): void { status.classList.add(stateClass); } +function render(): void { + const mode = getMode(); + const enabled = isEnabled(); + + setStatus( + `${LABELS[mode]} is ${enabled ? 'on' : 'off'}`, + enabled ? 'is-on' : 'is-off', + ); + + for (const card of document.querySelectorAll('.mode')) { + const selected = card.dataset.mode === mode; + card.classList.toggle('is-selected', selected); + card.classList.toggle('is-on', selected && enabled); + card.setAttribute('aria-pressed', String(selected)); + } +} + +function onModeClick(event: Event): void { + const mode = (event.currentTarget as HTMLElement).dataset.mode; + if (mode === 'crop' || mode === 'stretch') { + selectMode(mode); + render(); + } +} + async function init(): Promise { const version = extensionApi.runtime.getManifest().version; @@ -50,11 +69,13 @@ async function init(): Promise { : FEEDBACK_URL; } + for (const card of document.querySelectorAll('.mode')) { + card.addEventListener('click', onModeClick); + } + try { - const result = await extensionApi.storage.local.get(STORAGE_KEY); - const mode = parseMode(result[STORAGE_KEY]) ?? 'off'; - const status = STATUS[mode]; - setStatus(status.text, status.stateClass); + await loadState(); + render(); } catch { setStatus('Status unavailable', 'is-unavailable'); } diff --git a/src/popup/preview.jpg b/src/popup/preview.jpg new file mode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Z-a}uvUUcL(WX>V z6(2WF8PEr|6GWe(R=FrJ?B@R%D%5_U+i?>3Kbnri4tdJOO=UlqbIAU%K)>1jz_LT)F_2N1wg^wnWJ_(+I2)x0rBxazKVUh?&AKr`?Ag5 zExl?f_~ZF6^Bw9IP_et_dzHm&t~1ayBq#A+Ck3K#O}X}MjdJ{0n|lf>E8~|xrvKPD zCD@IQ5dMOxs92)1Hhd@#oCRNFJ zr%n7PYAWPTug_Cc2i!Qj>nmDn9bNOyY(ywE@v_3+fC<~pq{3uCLdX+9yP|bZ;|m?A zavx83k?k?|{PB}&XxJ<_4gkypgaq$ildxGfuMt^Yetby2!WCPP_0Naft1g;4|Gtz&2wj<3vrXHdTpNGh125GUdV%O#1a>4%Lcrk;%DaSq6ZPRZDU2?3F@srFQ=yFk0&<< zmbZ8{ieXc0*KuEys>0SM_%FsITd?r)k=Re(^ktQ60 { const result = await extensionApi.storage.local.get([ - STORAGE_KEY, - LEGACY_STORAGE_KEY, + ENABLED_KEY, + MODE_KEY, + LEGACY_CROP_MODE_KEY, + LEGACY_CROP_ENABLED_KEY, ]); - const stored = parseMode(result[STORAGE_KEY]); - if (stored) { - mode = stored; + const storedEnabled = result[ENABLED_KEY]; + const storedMode = parseFillMode(result[MODE_KEY]); + + if (typeof storedEnabled === 'boolean' && storedMode) { + enabled = storedEnabled; + mode = storedMode; return; } - mode = result[LEGACY_STORAGE_KEY] === true ? 'crop' : 'off'; - await extensionApi.storage.local.set({ [STORAGE_KEY]: mode }); - await extensionApi.storage.local.remove(LEGACY_STORAGE_KEY); + const legacyMode = parseLegacyMode(result[LEGACY_CROP_MODE_KEY]); + if (legacyMode) { + enabled = legacyMode !== 'off'; + mode = legacyMode === 'stretch' ? 'stretch' : 'crop'; + } else { + enabled = result[LEGACY_CROP_ENABLED_KEY] === true; + mode = 'crop'; + } + + await extensionApi.storage.local.set({ + [ENABLED_KEY]: enabled, + [MODE_KEY]: mode, + }); + await extensionApi.storage.local.remove([ + LEGACY_CROP_MODE_KEY, + LEGACY_CROP_ENABLED_KEY, + ]); } -export function cycleMode(): void { - setMode(nextMode(mode)); +export function selectMode(next: FillMode): void { + mode = next; + enabled = true; + save(); +} + +export function toggleEnabled(): void { + enabled = !enabled; + save(); } export function onStorageChange( @@ -47,13 +82,28 @@ export function onStorageChange( if (area !== 'local') { return; } - const change = changes[STORAGE_KEY]; - if (change) { - const next = parseMode(change.newValue) ?? 'off'; - if (mode === next) { - return; + + let changed = false; + + const enabledChange = changes[ENABLED_KEY]; + if (enabledChange) { + const next = enabledChange.newValue === true; + if (next !== enabled) { + enabled = next; + changed = true; } - mode = next; + } + + const modeChange = changes[MODE_KEY]; + if (modeChange) { + const next = parseFillMode(modeChange.newValue); + if (next && next !== mode) { + mode = next; + changed = true; + } + } + + if (changed) { cb(); } }); diff --git a/src/sync/sync.ts b/src/sync/sync.ts index fed113b..119526c 100644 --- a/src/sync/sync.ts +++ b/src/sync/sync.ts @@ -3,7 +3,7 @@ * Watches for YouTube DOM changes, navigation events, and player resizes. */ -import { getMode } from '../storage/state'; +import { getMode, isEnabled } from '../storage/state'; import { applyFit } from '../player/fit'; import { injectButton } from '../player/button'; import { getPlayer, getControls } from '../player/dom'; @@ -60,7 +60,7 @@ function sync(): void { if (player && controls) { injectButton(player, controls); } - applyFit(player, getMode()); + applyFit(player, isEnabled(), getMode()); } export function scheduleSync(): void { @@ -111,10 +111,10 @@ export function onVideoMetadata(event: Event): void { } export function applyFitNow(): void { - applyFit(getPlayer(), getMode()); + applyFit(getPlayer(), isEnabled(), getMode()); } export function applyFitAndSync(): void { - applyFit(getPlayer(), getMode()); + applyFit(getPlayer(), isEnabled(), getMode()); scheduleSync(); } \ No newline at end of file diff --git a/tests/build.test.ts b/tests/build.test.ts index ab1f7a1..cb119fc 100644 --- a/tests/build.test.ts +++ b/tests/build.test.ts @@ -98,6 +98,11 @@ describe('generated build output', () => { expect(popup).not.toContain('firefox-popup'); }); + it('packages the popup preview image', () => { + expect(existsSync(join('dist-chrome', 'preview.jpg'))).toBe(true); + expect(existsSync(join('dist-firefox', 'preview.jpg'))).toBe(true); + }); + it('Firefox popup.js contains firefox-popup source', () => { const popup = readFileSync(join('dist-firefox', 'popup.js'), 'utf8'); expect(popup).toContain('firefox-popup'); diff --git a/tests/fit.test.ts b/tests/fit.test.ts index 50ada33..376f18c 100644 --- a/tests/fit.test.ts +++ b/tests/fit.test.ts @@ -44,7 +44,7 @@ function createPlayer( } describe('applyFit', () => { - it('clears crop and stretch state when off', () => { + it('clears crop and stretch state when disabled', () => { const { player, classes, styles } = createPlayer(); classes.add('flrm-crop-on'); classes.add('flrm-stretch-on'); @@ -52,7 +52,7 @@ describe('applyFit', () => { styles.set('--flrm-scale-x', '1.5'); styles.set('--flrm-scale-y', '1.5'); - applyFit(player, 'off'); + applyFit(player, false, 'stretch'); expect(classes.has('flrm-crop-on')).toBe(false); expect(classes.has('flrm-stretch-on')).toBe(false); @@ -64,7 +64,7 @@ describe('applyFit', () => { it('applies a uniform scale in crop mode', () => { const { player, classes, styles } = createPlayer(); - applyFit(player, 'crop'); + applyFit(player, true, 'crop'); expect(classes.has('flrm-crop-on')).toBe(true); expect(classes.has('flrm-stretch-on')).toBe(false); @@ -78,7 +78,7 @@ describe('applyFit', () => { classes.add('flrm-crop-on'); styles.set('--flrm-scale', '1.5'); - applyFit(player, 'stretch'); + applyFit(player, true, 'stretch'); expect(classes.has('flrm-stretch-on')).toBe(true); expect(classes.has('flrm-crop-on')).toBe(false); @@ -90,7 +90,7 @@ describe('applyFit', () => { it('stretches vertically when the video is wider than the player', () => { const { player, classes, styles } = createPlayer(1440, 1080, 1920, 1080); - applyFit(player, 'stretch'); + applyFit(player, true, 'stretch'); expect(classes.has('flrm-stretch-on')).toBe(true); expect(styles.get('--flrm-scale-x')).toBe('1'); @@ -103,7 +103,7 @@ describe('applyFit', () => { styles.set('--flrm-scale-x', '1.5'); styles.set('--flrm-scale-y', '1'); - applyFit(player, 'crop'); + applyFit(player, true, 'crop'); expect(classes.has('flrm-crop-on')).toBe(true); expect(classes.has('flrm-stretch-on')).toBe(false); @@ -111,4 +111,15 @@ describe('applyFit', () => { expect(styles.has('--flrm-scale-x')).toBe(false); expect(styles.has('--flrm-scale-y')).toBe(false); }); + + it('leaves the crop applied when stretch is disabled', () => { + const { player, classes, styles } = createPlayer(); + applyFit(player, true, 'crop'); + + applyFit(player, false, 'stretch'); + + expect(classes.has('flrm-crop-on')).toBe(false); + expect(classes.has('flrm-stretch-on')).toBe(false); + expect(styles.has('--flrm-scale')).toBe(false); + }); }); diff --git a/tests/mode.test.ts b/tests/mode.test.ts index 46d7720..94a0c9a 100644 --- a/tests/mode.test.ts +++ b/tests/mode.test.ts @@ -1,27 +1,36 @@ import { describe, expect, it } from 'bun:test'; -import { nextMode, parseMode } from '../src/storage/mode'; +import { parseFillMode, parseLegacyMode } from '../src/storage/mode'; -describe('parseMode', () => { - it('accepts the three known modes', () => { - expect(parseMode('off')).toBe('off'); - expect(parseMode('crop')).toBe('crop'); - expect(parseMode('stretch')).toBe('stretch'); +describe('parseFillMode', () => { + it('accepts crop and stretch', () => { + expect(parseFillMode('crop')).toBe('crop'); + expect(parseFillMode('stretch')).toBe('stretch'); }); it('rejects unknown values', () => { - expect(parseMode(undefined)).toBeNull(); - expect(parseMode(null)).toBeNull(); - expect(parseMode(true)).toBeNull(); - expect(parseMode('CROP')).toBeNull(); - expect(parseMode('on')).toBeNull(); - expect(parseMode(1)).toBeNull(); + expect(parseFillMode(undefined)).toBeNull(); + expect(parseFillMode(null)).toBeNull(); + expect(parseFillMode(true)).toBeNull(); + expect(parseFillMode('off')).toBeNull(); + expect(parseFillMode('CROP')).toBeNull(); + expect(parseFillMode('on')).toBeNull(); + expect(parseFillMode(1)).toBeNull(); }); }); -describe('nextMode', () => { - it('cycles off -> crop -> stretch -> off', () => { - expect(nextMode('off')).toBe('crop'); - expect(nextMode('crop')).toBe('stretch'); - expect(nextMode('stretch')).toBe('off'); +describe('parseLegacyMode', () => { + it('accepts the three legacy modes', () => { + expect(parseLegacyMode('off')).toBe('off'); + expect(parseLegacyMode('crop')).toBe('crop'); + expect(parseLegacyMode('stretch')).toBe('stretch'); + }); + + it('rejects unknown values', () => { + expect(parseLegacyMode(undefined)).toBeNull(); + expect(parseLegacyMode(null)).toBeNull(); + expect(parseLegacyMode(true)).toBeNull(); + expect(parseLegacyMode('CROP')).toBeNull(); + expect(parseLegacyMode('on')).toBeNull(); + expect(parseLegacyMode(1)).toBeNull(); }); }); diff --git a/tests/state.test.ts b/tests/state.test.ts index 5cee7f0..080ddd9 100644 --- a/tests/state.test.ts +++ b/tests/state.test.ts @@ -39,69 +39,141 @@ beforeEach(() => { const state = await import('../src/storage/state'); describe('loadState', () => { - it('migrates legacy enabled to crop and removes the old key', async () => { + it('keeps existing fill keys', async () => { + store.fillEnabled = false; + store.fillMode = 'stretch'; + + await state.loadState(); + + expect(state.getMode()).toBe('stretch'); + expect(state.isEnabled()).toBe(false); + expect(store.fillEnabled).toBe(false); + expect(store.fillMode).toBe('stretch'); + expect(removed).toEqual([]); + }); + + it('migrates the legacy tri-state crop', async () => { + store.cropMode = 'crop'; + + await state.loadState(); + + expect(state.getMode()).toBe('crop'); + expect(state.isEnabled()).toBe(true); + expect(store.fillMode).toBe('crop'); + expect(store.fillEnabled).toBe(true); + expect('cropMode' in store).toBe(false); + }); + + it('migrates the legacy tri-state stretch', async () => { + store.cropMode = 'stretch'; + + await state.loadState(); + + expect(state.getMode()).toBe('stretch'); + expect(state.isEnabled()).toBe(true); + expect(store.fillMode).toBe('stretch'); + expect(store.fillEnabled).toBe(true); + expect('cropMode' in store).toBe(false); + }); + + it('migrates the legacy tri-state off to a disabled crop', async () => { + store.cropMode = 'off'; + + await state.loadState(); + + expect(state.getMode()).toBe('crop'); + expect(state.isEnabled()).toBe(false); + expect(store.fillMode).toBe('crop'); + expect(store.fillEnabled).toBe(false); + }); + + it('migrates the legacy boolean on to crop on', async () => { store.cropEnabled = true; await state.loadState(); expect(state.getMode()).toBe('crop'); - expect(store.cropMode).toBe('crop'); + expect(state.isEnabled()).toBe(true); + expect(store.fillMode).toBe('crop'); + expect(store.fillEnabled).toBe(true); expect('cropEnabled' in store).toBe(false); - expect(removed).toContainEqual(['cropEnabled']); }); - it('migrates a legacy disabled value to off', async () => { + it('migrates the legacy boolean off to a disabled crop', async () => { store.cropEnabled = false; await state.loadState(); - expect(state.getMode()).toBe('off'); - expect(store.cropMode).toBe('off'); + expect(state.getMode()).toBe('crop'); + expect(state.isEnabled()).toBe(false); + expect(store.fillMode).toBe('crop'); + expect(store.fillEnabled).toBe(false); expect('cropEnabled' in store).toBe(false); }); - it('starts a fresh install at off', async () => { + it('starts a fresh install with crop off', async () => { await state.loadState(); - expect(state.getMode()).toBe('off'); - expect(store.cropMode).toBe('off'); + expect(state.getMode()).toBe('crop'); + expect(state.isEnabled()).toBe(false); + expect(store.fillMode).toBe('crop'); + expect(store.fillEnabled).toBe(false); }); - it('keeps an existing mode', async () => { - store.cropMode = 'stretch'; + it('falls back through legacy values when the new mode is invalid', async () => { + store.fillMode = 'zoom'; + store.fillEnabled = true; + store.cropEnabled = true; await state.loadState(); - expect(state.getMode()).toBe('stretch'); - expect(store.cropMode).toBe('stretch'); - expect(removed).toEqual([]); + expect(state.getMode()).toBe('crop'); + expect(state.isEnabled()).toBe(true); + expect(store.fillMode).toBe('crop'); + expect('cropEnabled' in store).toBe(false); }); +}); - it('falls back to migration when the stored mode is invalid', async () => { - store.cropMode = 'zoom'; - store.cropEnabled = true; +describe('selectMode', () => { + it('selects a mode and turns fill on', async () => { + await state.loadState(); + + state.selectMode('stretch'); + expect(state.getMode()).toBe('stretch'); + expect(state.isEnabled()).toBe(true); + expect(store.fillMode).toBe('stretch'); + expect(store.fillEnabled).toBe(true); + }); + + it('keeps fill on when re-selecting the active mode', async () => { + store.fillEnabled = true; + store.fillMode = 'crop'; await state.loadState(); + state.selectMode('crop'); + expect(state.getMode()).toBe('crop'); - expect(store.cropMode).toBe('crop'); + expect(state.isEnabled()).toBe(true); }); }); -describe('cycleMode', () => { - it('advances through off, crop, stretch and back', async () => { +describe('toggleEnabled', () => { + it('flips only the enabled flag', async () => { + store.fillEnabled = false; + store.fillMode = 'stretch'; await state.loadState(); - state.cycleMode(); - expect(state.getMode()).toBe('crop'); - expect(store.cropMode).toBe('crop'); + state.toggleEnabled(); - state.cycleMode(); + expect(state.isEnabled()).toBe(true); expect(state.getMode()).toBe('stretch'); - expect(store.cropMode).toBe('stretch'); + expect(store.fillEnabled).toBe(true); + expect(store.fillMode).toBe('stretch'); + + state.toggleEnabled(); - state.cycleMode(); - expect(state.getMode()).toBe('off'); - expect(store.cropMode).toBe('off'); + expect(state.isEnabled()).toBe(false); + expect(store.fillEnabled).toBe(false); }); }); From 45958523fc08ae14560a1760013b8c7e77f9746e Mon Sep 17 00:00:00 2001 From: Deepak Tripathy Date: Tue, 10 Nov 2026 09:40:30 +0300 Subject: [PATCH 3/7] added suggested improvements --- CHANGELOG.md | 57 ++++----- README.md | 26 +++-- src/popup/popup.css | 273 +++++++++++++++++++++++-------------------- src/popup/popup.html | 60 +++++++--- src/popup/popup.ts | 5 +- 5 files changed, 238 insertions(+), 183 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index e3059e1..652b017 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -14,9 +14,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Stretch mode. It fills the player by scaling the video unevenly on the shorter axis instead of trimming the edges. People who prefer seeing the whole frame can now choose distortion over cropping. -- The toolbar popup now has two large selectable cards, Crop and Stretch, each - with an animated preview of a 21:9 player. The previews loop between normal - and the mode applied, so the difference is visible before choosing. +- The toolbar popup is redesigned around an `Original` frame and two result + cards, Crop and Stretch. The header reports the current state, a branching + connector leads from the original to the results, and the selected card gets + a white outline, a filled radio, and a short mirrored reflection. +- The card previews are static: each shows its mode already applied. Crop is + zoomed in and clipped; stretch is widened without clipping. - The popup reports the selected mode and whether it is on: `Crop is off`, `Crop is on`, `Stretch is off`, `Stretch is on`. @@ -27,9 +30,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 selector; the player button is the only off switch. - Clicking a popup card selects that mode and turns it on. Clicking the active card keeps it on. -- The selected card is outlined; it fills in when the mode is on. The player - icon still distinguishes the active mode: a small square for crop, a wide bar - for stretch, and only while the selected mode is on. +- The selected card is white-outlined with a filled radio, and the header + status says whether it is on. The player icon still distinguishes the active + mode: a small square for crop, a wide bar for stretch, and only while it is + on. +- The popup is 360 px wide. The footer keeps only Share feedback and the + version; the "Built by" line and View source link are removed. - The popup is interactive instead of read-only. - State is stored as `fillMode` (`crop` or `stretch`) and `fillEnabled` (`true` or `false`) instead of a single `cropMode` tri-state or the older @@ -99,21 +105,19 @@ and why the popup can change modes without a separate toggle. it inside the player. On a live page the video was 649×365 at `left: 68px` inside a 784×365 player, and its `.html5-video-container` had zero height, so percentage sizing is unreliable. -- `src/popup/popup.html` — adds the two mode cards between the status line and - the feedback link. Each card is a button with a decorative 21:9 preview and a - visible Crop/Stretch label. -- `src/popup/popup.css` — two equal card columns that can shrink below the - image's intrinsic width (`minmax(0, 1fr)` plus `min-width: 0`). At the 300 px - popup width this yields 129 px cards and 48.7 px previews. Selected is an - accent outline; on is an accent-tinted fill. The preview starts as a 16:9 - image centred in a 21:9 box, so it has side bars. Crop scales both axes by - `21 ÷ 16 = 1.3125`; stretch scales only X by the same amount. Both run the - same 5-second loop: hold normal, transition, hold applied, transition back. - `prefers-reduced-motion: reduce` removes the animation and holds each card in - its applied state so the preview still explains the mode. -- `src/popup/popup.ts` — loads shared state, renders the status text and card - classes, and calls `selectMode` on a card click. `aria-pressed` marks the - selected mode; the status line and fill treatment communicate on/off. +- `src/popup/popup.html` — a header with the Fullorama lockup and status, an + `Original` preview, a branching connector, two result-card buttons with radio + controls and two-line captions, and a footer with feedback and version. +- `src/popup/popup.css` — a 360 px popup with 20 px padding, two equal + `minmax(0, 1fr)` card columns at a 14 px gap, and 21:9 previews holding a 16:9 + still. Crop scales both axes by `21 ÷ 16 = 1.3125`; stretch scales only X by + the same amount, so each card shows its mode already applied. The selected + card uses a white outline with a gap, a filled radio, and a clipped, masked + mirror under the preview that works in both Chromium and Firefox. No + animation or reduced-motion branch is needed. +- `src/popup/popup.ts` — loads shared state, renders the header status and the + selected card, and calls `selectMode` on a card click. `aria-pressed` marks + the selected mode; the header status communicates on/off. - `src/sync/sync.ts`, `src/index.ts` — pass `isEnabled()` and `getMode()` to `applyFit`. The navigation, mutation, resize, metadata, fullscreen, and retry logic is unchanged; that is what keeps the selected mode and on/off state @@ -122,7 +126,8 @@ and why the popup can change modes without a separate toggle. - `package.json` — version 1.3.1. The build reads it and writes it into both generated manifests. - `README.md` — documents choosing a mode in the popup, toggling it from the - player button, the previews, the two storage keys, and the migration path. + player button, the original/result previews, the two storage keys, and the + migration path. **Upgrade path:** no action is required from users. On first load the extension translates the first key it finds and removes the legacy keys: @@ -143,8 +148,8 @@ the popup. **Testing:** `bun run test` covers mode parsing, both migration chains, `selectMode`/`toggleEnabled`, the renderer's class and variable transitions, and the presence of `preview.jpg` in both packages. The popup was rendered in a -300 px stubbed-Chrome harness: the grid resolves to 129 px cards with 48.7 px -previews, and the selected/on state and status text update on click. The -stretch transform geometry was checked against a live YouTube player during -development. `web-ext lint` reports no errors; its one warning about +360 px stubbed-Chrome harness: the layout resolves to 320 px of content, 153 px +cards, and 66 px previews; the header status, selected card, and radio state +update on click; and the selected card shows its reflection. The stretch +transform geometry was checked against a live YouTube player during development. `web-ext lint` reports no errors; its one warning about `strict_min_version` and Android is pre-existing. diff --git a/README.md b/README.md index 29e0477..5809182 100644 --- a/README.md +++ b/README.md @@ -33,7 +33,7 @@ https://github.com/user-attachments/assets/3c62393f-5d82-4c7b-8543-0c3c0938f052 ## Features - Choose Crop or Stretch in the toolbar popup -- Animated previews show what each mode does +- An Original frame and two result previews show what each mode does - YouTube player button turns the selected mode on or off - Crop mode zooms evenly to fill the player and trims the edges - Stretch mode fills the player without trimming, at the cost of distortion @@ -47,7 +47,7 @@ https://github.com/user-attachments/assets/3c62393f-5d82-4c7b-8543-0c3c0938f052 ### How do I watch YouTube full screen on an ultrawide monitor? -Install Fullorama for [Chrome](https://chromewebstore.google.com/detail/fullorama-for-youtube/pacjdmdcmmnbpnjfhmjfgenbpedbakjg) or [Firefox](https://addons.mozilla.org/firefox/addon/fullorama/) and play any YouTube video. Click Fullorama's icon in your browser toolbar and choose Crop or Stretch from the two preview cards. Crop zooms the video in to fill the player; stretch fills it without trimming anything, at the cost of distortion. Then use the new button with four little corner brackets at the bottom-right of the player, next to the settings gear, to turn that mode on or off. A small square (crop) or wide bar (stretch) appears in the middle of the icon while it's on. +Install Fullorama for [Chrome](https://chromewebstore.google.com/detail/fullorama-for-youtube/pacjdmdcmmnbpnjfhmjfgenbpedbakjg) or [Firefox](https://addons.mozilla.org/firefox/addon/fullorama/) and play any YouTube video. Click Fullorama's icon in your browser toolbar and choose Crop or Stretch from the two result cards under the Original frame. Crop zooms the video in to fill the player; stretch fills it without trimming anything, at the cost of distortion. Then use the new button with four little corner brackets at the bottom-right of the player, next to the settings gear, to turn that mode on or off. A small square (crop) or wide bar (stretch) appears in the middle of the icon while it's on. ### I can't find the button. Where is it? @@ -87,7 +87,7 @@ It just scales the video that's already playing, so it doesn't change the video' ### What's the toolbar icon for? -Clicking Fullorama's icon in your browser toolbar opens the mode picker. It shows whether the selected mode is on or off, has animated previews of Crop and Stretch, and lets you choose between them. Clicking a card selects that mode and turns it on. To turn the selected mode off, use the button in the video player. +Clicking Fullorama's icon in your browser toolbar opens the mode picker. It shows whether the selected mode is on or off, alongside an Original frame and the two results: Crop keeps the shape and cuts off the edges; Stretch shows everything and pulls the video to fit. Clicking a card selects that mode and turns it on. To turn the selected mode off, use the button in the video player. ### Does Fullorama collect my data? @@ -110,15 +110,17 @@ on. Upgrading translates the older keys on first load and removes them: `cropMode: "off"` becomes crop with fill disabled, and `cropEnabled: true` or `false` becomes crop enabled or disabled. -The toolbar popup is interactive. It reads the state once, renders the status -line and the two cards (outline for selected, fill when on), and calls -`selectMode` when a card is clicked, which selects that mode and turns fill on. -The animated cards are CSS-only: a 21:9 box holds a 16:9 still, scaled uniformly -by `21 ÷ 16 = 1.3125` for crop or on the X axis only for stretch, looping between -normal and applied states. The player button calls `toggleEnabled`, so it only -turns the selected mode off and on. A tiny background script registers an -uninstall survey URL so the browser can open the optional feedback form if you -remove the extension. +The toolbar popup is interactive. It reads the state once, renders the status in +the header (`Crop is off`, `Crop is on`, `Stretch is off`, `Stretch is on`), and +outlines the selected card with a filled radio button. A static `Original` +preview sits above a branching connector; the two result cards show each mode +already applied. They are CSS-only: a 21:9 box holds a 16:9 still, scaled +uniformly by `21 ÷ 16 = 1.3125` for crop or on the X axis only for stretch. +Each selected card adds a short mirrored reflection under its preview. Clicking +a card calls `selectMode`, which selects that mode and turns fill on. The player +button calls `toggleEnabled`, so it only turns the selected mode off and on. A +tiny background script registers an uninstall survey URL so the browser can open +the optional feedback form if you remove the extension. When enabled, the content script passes the on/off state and mode to the renderer, which adds a class to YouTube's `#movie_player` element and sets CSS diff --git a/src/popup/popup.css b/src/popup/popup.css index f921c02..ca43d31 100644 --- a/src/popup/popup.css +++ b/src/popup/popup.css @@ -1,11 +1,10 @@ :root { color-scheme: dark; - --background: #181818; - --surface: #1f1f1f; - --border: #333; + --background: #1b1b1b; + --border: #3a3a3a; + --line: #4a4a4a; --text: #f2f2f2; - --muted: #ababab; - --accent: #ababab; + --muted: #a3a3a3; --on: #2ba640; --off: #717171; } @@ -21,7 +20,7 @@ body { } body { - width: 300px; + width: 360px; background: var(--background); color: var(--text); font-family: Roboto, Arial, sans-serif; @@ -33,20 +32,20 @@ body { display: flex; flex-direction: column; gap: 14px; - padding: 16px; + padding: 20px; } .header { display: flex; align-items: center; - gap: 10px; + justify-content: space-between; + gap: 12px; } .header img { display: block; width: auto; height: 24px; - mix-blend-mode: lighten; } .header h1 { @@ -60,18 +59,17 @@ body { .status { display: flex; align-items: center; - gap: 9px; - min-height: 42px; - padding: 10px 12px; - background: var(--surface); - border: 1px solid var(--border); - border-radius: 8px; + gap: 7px; + margin-left: auto; + color: var(--muted); + font-size: 13px; font-weight: 500; + white-space: nowrap; } .dot { - width: 8px; - height: 8px; + width: 6px; + height: 6px; flex: none; background: var(--off); border-radius: 50%; @@ -85,47 +83,88 @@ body { color: var(--muted); } -.modes { - display: grid; - grid-template-columns: repeat(2, minmax(0, 1fr)); - gap: 10px; +.original { + margin-top: 6px; +} + +.eyebrow { + margin: 0 0 9px; + color: var(--muted); + font-size: 13px; + text-align: center; } -.mode { +.original-frame { display: flex; - flex-direction: column; - gap: 7px; - min-width: 0; - padding: 7px; - color: var(--text); - background: var(--surface); + align-items: center; + justify-content: center; + width: 46%; + aspect-ratio: 21 / 9; + margin: 0 auto; + overflow: hidden; + background: #000; border: 1px solid var(--border); border-radius: 10px; - font: inherit; - text-align: left; - cursor: pointer; } -.mode:hover { - border-color: #4a4a4a; +.original-frame img { + display: block; + width: auto; + height: 100%; + max-width: none; } -.mode:focus-visible { - outline: 2px solid var(--on); - outline-offset: 2px; +.branch { + position: relative; + height: 20px; + margin: -6px 0 -4px; +} + +.branch::before { + content: ""; + position: absolute; + top: 0; + left: 50%; + width: 1px; + height: 10px; + background: var(--line); } -.mode.is-selected { - border-color: var(--on); +.branch::after { + content: ""; + position: absolute; + top: 10px; + left: 24%; + right: 24%; + height: 10px; + border: 1px solid var(--line); + border-bottom: 0; + border-radius: 8px 8px 0 0; +} + +.modes { + display: grid; + grid-template-columns: repeat(2, minmax(0, 1fr)); + gap: 14px; } -.mode.is-selected .mode-label { - color: var(--on); +.option { + display: flex; + flex-direction: column; + min-width: 0; + padding: 0; + color: var(--text); + background: transparent; + border: 0; + font: inherit; + text-align: left; + cursor: pointer; } -.mode.is-on { - background: rgba(43, 166, 64, 0.16); - box-shadow: inset 0 0 0 1px var(--on); +.option:focus-visible { + outline: 2px solid var(--on); + outline-offset: 4px; + border-radius: 12px; } .preview { @@ -137,7 +176,17 @@ body { aspect-ratio: 21 / 9; overflow: hidden; background: #000; - border-radius: 6px; + background-clip: padding-box; + border: 1px solid var(--border); + border-radius: 10px; +} + +.option[data-mode="crop"] .preview-frame { + transform: scale(var(--preview-fill)); +} + +.option[data-mode="stretch"] .preview-frame { + transform: scaleX(var(--preview-fill)); } .preview-frame { @@ -148,105 +197,85 @@ body { transform-origin: center center; } -.mode[data-mode="crop"] .preview-frame { - animation: preview-crop 5s ease-in-out infinite; +.option.is-selected .preview { + border-color: transparent; + outline: 2px solid #fff; + outline-offset: 2px; } -.mode[data-mode="stretch"] .preview-frame { - animation: preview-stretch 5s ease-in-out infinite; +.mirror { + display: block; + height: 20px; + margin-top: 4px; + overflow: hidden; + opacity: 0; } -.mode-label { - padding: 0 2px 1px; - font-size: 11px; - font-weight: 600; - letter-spacing: 0.08em; - text-transform: uppercase; +.option.is-selected .mirror { + opacity: 0.6; + -webkit-mask-image: linear-gradient(to bottom, #000, transparent); + mask-image: linear-gradient(to bottom, #000, transparent); } -@keyframes preview-crop { - 0%, - 20% { - transform: scale(1); - } - - 30%, - 70% { - transform: scale(var(--preview-fill)); - } - - 80%, - 100% { - transform: scale(1); - } +.preview--mirror { + transform: scaleY(-1); + transform-origin: top center; } -@keyframes preview-stretch { - 0%, - 20% { - transform: scaleX(1); - } - - 30%, - 70% { - transform: scaleX(var(--preview-fill)); - } - - 80%, - 100% { - transform: scaleX(1); - } +.option-body { + display: flex; + align-items: flex-start; + gap: 9px; + margin-top: 8px; } -@media (prefers-reduced-motion: reduce) { - .preview-frame { - animation: none; - } - - .mode[data-mode="crop"] .preview-frame { - transform: scale(var(--preview-fill)); - } - - .mode[data-mode="stretch"] .preview-frame { - transform: scaleX(var(--preview-fill)); - } +.radio { + width: 16px; + height: 16px; + flex: none; + margin-top: 1px; + border: 2px solid #6f6f6f; + border-radius: 50%; } -.links { - display: flex; +.option.is-selected .radio { + border-color: #fff; + background: radial-gradient(circle, #fff 0 4px, transparent 4.5px); } -a { - color: inherit; - text-decoration: none; +.option-copy { + display: flex; + flex-direction: column; + gap: 2px; + min-width: 0; } -.links a { - width: 100%; - padding: 9px 12px; - color: var(--text); - background: var(--surface); - border: 1px solid var(--border); - border-radius: 8px; - text-align: center; - font-weight: 500; +.option-label { + font-size: 16px; + font-weight: 600; + line-height: 1.2; } -.links a:hover, -.links a:focus-visible { - border-color: var(--accent); - outline: none; +.option-desc { + color: var(--muted); + font-size: 12.5px; + line-height: 1.5; } .footer { - display: grid; - grid-template-columns: auto auto 1fr auto; + display: flex; align-items: center; - gap: 6px; - padding-top: 12px; - color: var(--muted); + justify-content: space-between; + gap: 10px; + padding-top: 13px; border-top: 1px solid var(--border); - font-size: 11px; + color: var(--muted); + font-size: 12px; +} + +a { + color: inherit; + text-decoration: none; } .footer a:hover, @@ -255,7 +284,3 @@ a { outline: none; text-decoration: underline; } - -.version { - justify-self: end; -} diff --git a/src/popup/popup.html b/src/popup/popup.html index d1c4bb7..f937e1e 100644 --- a/src/popup/popup.html +++ b/src/popup/popup.html @@ -8,41 +8,65 @@
-
+

Fullorama

-
+
+ + Loading… +
+ -
- - Loading… -
+
+

Original

+ +
+ +
- -
- - - +
diff --git a/src/popup/popup.ts b/src/popup/popup.ts index 77da4bb..9eaa8d9 100644 --- a/src/popup/popup.ts +++ b/src/popup/popup.ts @@ -38,10 +38,9 @@ function render(): void { enabled ? 'is-on' : 'is-off', ); - for (const card of document.querySelectorAll('.mode')) { + for (const card of document.querySelectorAll('.option')) { const selected = card.dataset.mode === mode; card.classList.toggle('is-selected', selected); - card.classList.toggle('is-on', selected && enabled); card.setAttribute('aria-pressed', String(selected)); } } @@ -69,7 +68,7 @@ async function init(): Promise { : FEEDBACK_URL; } - for (const card of document.querySelectorAll('.mode')) { + for (const card of document.querySelectorAll('.option')) { card.addEventListener('click', onModeClick); } From 04ba7935c8ea4a08aa932d21edf7024167e82a5c Mon Sep 17 00:00:00 2001 From: Deepak Tripathy Date: Tue, 10 Nov 2026 09:52:24 +0300 Subject: [PATCH 4/7] added animated previews on popup --- CHANGELOG.md | 18 +++++++++------- README.md | 20 +++++++++-------- src/popup/popup.css | 52 +++++++++++++++++++++++++++++++++++++++++++-- 3 files changed, 71 insertions(+), 19 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 652b017..8accde9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -18,8 +18,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 cards, Crop and Stretch. The header reports the current state, a branching connector leads from the original to the results, and the selected card gets a white outline, a filled radio, and a short mirrored reflection. -- The card previews are static: each shows its mode already applied. Crop is - zoomed in and clipped; stretch is widened without clipping. +- The card previews loop between normal and the mode applied. Crop zooms in and + clips; stretch widens without clipping. The Original frame above stays still. - The popup reports the selected mode and whether it is on: `Crop is off`, `Crop is on`, `Stretch is off`, `Stretch is on`. @@ -111,10 +111,11 @@ and why the popup can change modes without a separate toggle. - `src/popup/popup.css` — a 360 px popup with 20 px padding, two equal `minmax(0, 1fr)` card columns at a 14 px gap, and 21:9 previews holding a 16:9 still. Crop scales both axes by `21 ÷ 16 = 1.3125`; stretch scales only X by - the same amount, so each card shows its mode already applied. The selected - card uses a white outline with a gap, a filled radio, and a clipped, masked - mirror under the preview that works in both Chromium and Firefox. No - animation or reduced-motion branch is needed. + the same amount. Both run the same 5-second loop: hold normal, transition, + hold applied, transition back. The selected card uses a white outline with a + gap, a filled radio, and a clipped, masked mirror under the preview that works + in both Chromium and Firefox. `prefers-reduced-motion: reduce` removes the + animation and holds each card in its applied state. - `src/popup/popup.ts` — loads shared state, renders the header status and the selected card, and calls `selectMode` on a card click. `aria-pressed` marks the selected mode; the header status communicates on/off. @@ -150,6 +151,7 @@ the popup. the presence of `preview.jpg` in both packages. The popup was rendered in a 360 px stubbed-Chrome harness: the layout resolves to 320 px of content, 153 px cards, and 66 px previews; the header status, selected card, and radio state -update on click; and the selected card shows its reflection. The stretch -transform geometry was checked against a live YouTube player during development. `web-ext lint` reports no errors; its one warning about +update on click; and the selected card shows its reflection. The previews loop +and hold the applied state under reduced motion. The stretch transform geometry +was checked against a live YouTube player during development. `web-ext lint` reports no errors; its one warning about `strict_min_version` and Android is pre-existing. diff --git a/README.md b/README.md index 5809182..7d6ee54 100644 --- a/README.md +++ b/README.md @@ -33,7 +33,7 @@ https://github.com/user-attachments/assets/3c62393f-5d82-4c7b-8543-0c3c0938f052 ## Features - Choose Crop or Stretch in the toolbar popup -- An Original frame and two result previews show what each mode does +- An Original frame and two looping result previews show what each mode does - YouTube player button turns the selected mode on or off - Crop mode zooms evenly to fill the player and trims the edges - Stretch mode fills the player without trimming, at the cost of distortion @@ -113,14 +113,16 @@ on. Upgrading translates the older keys on first load and removes them: The toolbar popup is interactive. It reads the state once, renders the status in the header (`Crop is off`, `Crop is on`, `Stretch is off`, `Stretch is on`), and outlines the selected card with a filled radio button. A static `Original` -preview sits above a branching connector; the two result cards show each mode -already applied. They are CSS-only: a 21:9 box holds a 16:9 still, scaled -uniformly by `21 ÷ 16 = 1.3125` for crop or on the X axis only for stretch. -Each selected card adds a short mirrored reflection under its preview. Clicking -a card calls `selectMode`, which selects that mode and turns fill on. The player -button calls `toggleEnabled`, so it only turns the selected mode off and on. A -tiny background script registers an uninstall survey URL so the browser can open -the optional feedback form if you remove the extension. +preview sits above a branching connector; the two result cards loop between +normal and the mode applied. They are CSS-only: a 21:9 box holds a 16:9 still, +scaled uniformly by `21 ÷ 16 = 1.3125` for crop or on the X axis only for +stretch, on the same 5-second loop. Under reduced motion the loop is removed and +each card holds its applied state. Each selected card adds a short mirrored +reflection under its preview. Clicking a card calls `selectMode`, which selects +that mode and turns fill on. The player button calls `toggleEnabled`, so it only +turns the selected mode off and on. A tiny background script registers an +uninstall survey URL so the browser can open the optional feedback form if you +remove the extension. When enabled, the content script passes the on/off state and mode to the renderer, which adds a class to YouTube's `#movie_player` element and sets CSS diff --git a/src/popup/popup.css b/src/popup/popup.css index ca43d31..854f927 100644 --- a/src/popup/popup.css +++ b/src/popup/popup.css @@ -182,11 +182,45 @@ body { } .option[data-mode="crop"] .preview-frame { - transform: scale(var(--preview-fill)); + animation: preview-crop 5s ease-in-out infinite; } .option[data-mode="stretch"] .preview-frame { - transform: scaleX(var(--preview-fill)); + animation: preview-stretch 5s ease-in-out infinite; +} + +@keyframes preview-crop { + 0%, + 20% { + transform: scale(1); + } + + 30%, + 70% { + transform: scale(var(--preview-fill)); + } + + 80%, + 100% { + transform: scale(1); + } +} + +@keyframes preview-stretch { + 0%, + 20% { + transform: scaleX(1); + } + + 30%, + 70% { + transform: scaleX(var(--preview-fill)); + } + + 80%, + 100% { + transform: scaleX(1); + } } .preview-frame { @@ -284,3 +318,17 @@ a { outline: none; text-decoration: underline; } + +@media (prefers-reduced-motion: reduce) { + .preview-frame { + animation: none; + } + + .option[data-mode="crop"] .preview-frame { + transform: scale(var(--preview-fill)); + } + + .option[data-mode="stretch"] .preview-frame { + transform: scaleX(var(--preview-fill)); + } +} From 02432f072099f25d6fb4022b959e1a426f3cfe81 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Tue, 10 Nov 2026 11:46:01 +0000 Subject: [PATCH 5/7] trimmed stretch mode docs and preview animation Co-authored-by: sudhz <61375120+sudhz@users.noreply.github.com> --- CHANGELOG.md | 157 -------------------------------------------- README.md | 85 +++++++++--------------- package.json | 2 +- src/popup/popup.css | 52 +-------------- 4 files changed, 33 insertions(+), 263 deletions(-) delete mode 100644 CHANGELOG.md diff --git a/CHANGELOG.md b/CHANGELOG.md deleted file mode 100644 index 8accde9..0000000 --- a/CHANGELOG.md +++ /dev/null @@ -1,157 +0,0 @@ -# Changelog - -All notable changes to this project are documented in this file. - -The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), -and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). - -## [Unreleased] - -## [1.3.1] - 2026-11-09 - -### Added - -- Stretch mode. It fills the player by scaling the video unevenly on the - shorter axis instead of trimming the edges. People who prefer seeing the - whole frame can now choose distortion over cropping. -- The toolbar popup is redesigned around an `Original` frame and two result - cards, Crop and Stretch. The header reports the current state, a branching - connector leads from the original to the results, and the selected card gets - a white outline, a filled radio, and a short mirrored reflection. -- The card previews loop between normal and the mode applied. Crop zooms in and - clips; stretch widens without clipping. The Original frame above stays still. -- The popup reports the selected mode and whether it is on: - `Crop is off`, `Crop is on`, `Stretch is off`, `Stretch is on`. - -### Changed - -- The player button no longer cycles through three states. It turns the mode - selected in the popup off and on. The popup card is now the only mode - selector; the player button is the only off switch. -- Clicking a popup card selects that mode and turns it on. Clicking the active - card keeps it on. -- The selected card is white-outlined with a filled radio, and the header - status says whether it is on. The player icon still distinguishes the active - mode: a small square for crop, a wide bar for stretch, and only while it is - on. -- The popup is 360 px wide. The footer keeps only Share feedback and the - version; the "Built by" line and View source link are removed. -- The popup is interactive instead of read-only. -- State is stored as `fillMode` (`crop` or `stretch`) and `fillEnabled` - (`true` or `false`) instead of a single `cropMode` tri-state or the older - boolean `cropEnabled`. Existing values are migrated once on first load and - the old keys are removed. -- The README features, FAQ, and How It Works sections describe the split - controls, the previews, and the two storage keys. - -### Implementation - -**Why two values instead of one:** the player can be off while still -remembering which mode its button should turn back on. A single -`off | crop | stretch` value cannot represent "stretch is selected but currently -off" without losing the last mode, and two independent booleans would allow the -impossible "crop and stretch both on" state. `fillMode` plus `fillEnabled` -models the interaction exactly: the popup picks the mode, the player button -toggles the boolean. - -**Interaction model:** clicking a card calls `selectMode`, which sets the mode -and sets `fillEnabled` to true. The player button calls `toggleEnabled`, which -changes only the boolean. This is why the player button is the only off switch -and why the popup can change modes without a separate toggle. - -**Files added:** - -- `src/storage/mode.ts` — `FillMode` (`crop | stretch`), `parseFillMode` for the - new key, and `parseLegacyMode` for the old `off | crop | stretch` form. - `parseLegacyMode` exists only for migration, so the removed three-state model - cannot leak into runtime code. -- `src/popup/preview.jpg` — a 560×315 JPEG cropped from - `store-assets/screenshots/screenshot-before-off-1280x800.png`, above the - player controls. It shows a real YouTube video frame, keeps the popup package - around 25 KB, and stays sharp at 2× and 3× display density. -- `tests/mode.test.ts` — accept/reject tables for both parsers. -- `tests/state.test.ts` — drives `loadState`, `selectMode`, and `toggleEnabled` - against an in-memory `chrome.storage.local` fake: both migration chains, fresh - install, valid keys untouched, malformed fallback, and writes. -- `tests/fit.test.ts` — drives the renderer with a fake player object (class - set, style map, fixed geometry), so no browser or `chrome` stub is needed. -- `CHANGELOG.md` — this file. - -**Files changed:** - -- `src/storage/state.ts` — holds `fillMode` and `fillEnabled` in memory and - persists both. `loadState` first accepts a valid pair of new keys, then falls - back through `cropMode` and `cropEnabled`, writes the new pair, and removes - the legacy keys. `onStorageChange` watches both keys and fires one callback - per change event, so a popup write and a player-button write both update open - YouTube tabs. -- `src/player/fit.ts` — now `applyFit(player, enabled, mode)`. Disabled clears - both mode classes and all scale variables. Crop keeps its original uniform - scale, `max(playerAspect / videoAspect, videoAspect / playerAspect)`, written - to `--flrm-scale`. Stretch writes `--flrm-scale-x` and `--flrm-scale-y`: the - shorter axis gets the ratio, the other stays `1`. Both round to four decimal - places and only write when the value changes. The mode math is unchanged; - only the enabled gate and the parameter list changed. -- `src/player/button.ts` — `syncButtonState` now writes the selected mode to - `data-flrm-mode`, the enabled state to `aria-pressed`, and a label such as - `Fullorama: crop off` or `Fullorama: stretch on`. Clicking toggles enabled - instead of advancing a cycle. The icon still contains both overlay shapes; - CSS reveals only the matching one while the button is pressed. -- `src/content.css` — the icon rules now require - `[aria-pressed="true"]` as well as the mode attribute, so the square and bar - disappear when off. The crop and stretch transforms are otherwise unchanged. - Transforms are used instead of `width`/`height` plus `object-fit` because - YouTube sizes `.html5-main-video` to the video's own aspect ratio and centers - it inside the player. On a live page the video was 649×365 at `left: 68px` - inside a 784×365 player, and its `.html5-video-container` had zero height, so - percentage sizing is unreliable. -- `src/popup/popup.html` — a header with the Fullorama lockup and status, an - `Original` preview, a branching connector, two result-card buttons with radio - controls and two-line captions, and a footer with feedback and version. -- `src/popup/popup.css` — a 360 px popup with 20 px padding, two equal - `minmax(0, 1fr)` card columns at a 14 px gap, and 21:9 previews holding a 16:9 - still. Crop scales both axes by `21 ÷ 16 = 1.3125`; stretch scales only X by - the same amount. Both run the same 5-second loop: hold normal, transition, - hold applied, transition back. The selected card uses a white outline with a - gap, a filled radio, and a clipped, masked mirror under the preview that works - in both Chromium and Firefox. `prefers-reduced-motion: reduce` removes the - animation and holds each card in its applied state. -- `src/popup/popup.ts` — loads shared state, renders the header status and the - selected card, and calls `selectMode` on a card click. `aria-pressed` marks - the selected mode; the header status communicates on/off. -- `src/sync/sync.ts`, `src/index.ts` — pass `isEnabled()` and `getMode()` to - `applyFit`. The navigation, mutation, resize, metadata, fullscreen, and retry - logic is unchanged; that is what keeps the selected mode and on/off state - across navigation, refresh, theater mode, and fullscreen. -- `scripts/build.ts` — copies `preview.jpg` into both package roots. -- `package.json` — version 1.3.1. The build reads it and writes it into both - generated manifests. -- `README.md` — documents choosing a mode in the popup, toggling it from the - player button, the original/result previews, the two storage keys, and the - migration path. - -**Upgrade path:** no action is required from users. On first load the extension -translates the first key it finds and removes the legacy keys: - -| Stored value | Result | -| --- | --- | -| `cropMode: "crop"` | mode crop, enabled | -| `cropMode: "stretch"` | mode stretch, enabled | -| `cropMode: "off"` | mode crop, disabled | -| `cropEnabled: true` | mode crop, enabled | -| `cropEnabled: false` | mode crop, disabled | -| nothing or malformed | mode crop, disabled | - -Someone who had crop on stays in crop with it on. Someone who had stretch on -stays in stretch with it on. A fresh install starts in crop, off, outlined in -the popup. - -**Testing:** `bun run test` covers mode parsing, both migration chains, -`selectMode`/`toggleEnabled`, the renderer's class and variable transitions, and -the presence of `preview.jpg` in both packages. The popup was rendered in a -360 px stubbed-Chrome harness: the layout resolves to 320 px of content, 153 px -cards, and 66 px previews; the header status, selected card, and radio state -update on click; and the selected card shows its reflection. The previews loop -and hold the applied state under reduced motion. The stretch transform geometry -was checked against a live YouTube player during development. `web-ext lint` reports no errors; its one warning about -`strict_min_version` and Android is pre-existing. diff --git a/README.md b/README.md index 7d6ee54..3fa3550 100644 --- a/README.md +++ b/README.md @@ -7,11 +7,9 @@ Website: https://fullorama.com [![Install from the Chrome Web Store](https://img.shields.io/badge/Get_it_on-Chrome_Web_Store-4285F4?style=for-the-badge&logo=googlechrome&logoColor=white)](https://chromewebstore.google.com/detail/fullorama-for-youtube/pacjdmdcmmnbpnjfhmjfgenbpedbakjg) [![Install from Firefox Add-ons](https://img.shields.io/badge/Get_it_on-Firefox_Add--ons-FF7139?style=for-the-badge&logo=firefoxbrowser&logoColor=white)](https://addons.mozilla.org/firefox/addon/fullorama/) -Fullorama for YouTube™ adds one button directly to YouTube's player. Choose Crop -or Stretch in the toolbar popup, then click the player button to turn that mode -on or off. Crop zooms in evenly to fill the player and trims the edges; stretch -widens the picture to fill it and leaves nothing out. The choice stays across -videos, refreshes, navigation, and fullscreen, until you change it. +Fullorama for YouTube™ adds one crop button directly to YouTube's player. Turn +it on once and videos stay zoomed to fill across videos, refreshes, navigation, +and fullscreen, until you turn it off. Built for 21:9 and other ultrawide displays. @@ -32,22 +30,18 @@ https://github.com/user-attachments/assets/3c62393f-5d82-4c7b-8543-0c3c0938f052 ## Features -- Choose Crop or Stretch in the toolbar popup -- An Original frame and two looping result previews show what each mode does -- YouTube player button turns the selected mode on or off -- Crop mode zooms evenly to fill the player and trims the edges -- Stretch mode fills the player without trimming, at the cost of distortion -- The selected mode and on/off state persist across videos, refreshes, and navigation +- YouTube player button for ultrawide crop / zoom-to-fill +- Global persistent on/off state across videos, refreshes, and navigation - Works with YouTube's single-page navigation - Works in theater mode and fullscreen -- Popup shows the selected mode and whether it's on or off +- Read-only popup shows current crop status - Optional feedback form (popup link and uninstall survey) ## FAQ ### How do I watch YouTube full screen on an ultrawide monitor? -Install Fullorama for [Chrome](https://chromewebstore.google.com/detail/fullorama-for-youtube/pacjdmdcmmnbpnjfhmjfgenbpedbakjg) or [Firefox](https://addons.mozilla.org/firefox/addon/fullorama/) and play any YouTube video. Click Fullorama's icon in your browser toolbar and choose Crop or Stretch from the two result cards under the Original frame. Crop zooms the video in to fill the player; stretch fills it without trimming anything, at the cost of distortion. Then use the new button with four little corner brackets at the bottom-right of the player, next to the settings gear, to turn that mode on or off. A small square (crop) or wide bar (stretch) appears in the middle of the icon while it's on. +Install Fullorama for [Chrome](https://chromewebstore.google.com/detail/fullorama-for-youtube/pacjdmdcmmnbpnjfhmjfgenbpedbakjg) or [Firefox](https://addons.mozilla.org/firefox/addon/fullorama/) and play any YouTube video. Look at the bottom-right of the player: there's a new button with four little corner brackets, next to the settings gear. Click it and the video zooms in to fill the player. A small square appears in the middle of the icon to show it's on. Click it again to go back to normal. ### I can't find the button. Where is it? @@ -55,27 +49,27 @@ It's with YouTube's own buttons at the bottom-right of the video, between the se ### Will the video look stretched? -Crop mode doesn't stretch anything. It zooms in evenly from the center, so people and objects keep their normal shape; the trade-off is that a little of the edges gets trimmed. Stretch mode does stretch the picture to fill the player and will make it look wider or taller than it is. Nothing gets trimmed in stretch mode. Use crop if you care more about shape, and stretch if you care more about seeing the whole frame. The player button turns the selected mode off at any time. +No. Fullorama zooms in evenly from the center, so people and objects keep their normal shape. The trade-off is that a little of the edges gets trimmed. ### Why do some videos still have black bars? -Some videos have the bars recorded into the picture itself, often old movies or re-uploads. Fullorama can't tell those apart from the real image, so they can stay even with a mode on. It also can't show picture that was never in the video. +Some videos have the bars recorded into the picture itself, often old movies or re-uploads. Fullorama can't tell those apart from the real image, so they can stay even with the button on. It also can't show picture that was never in the video. ### Does it work in theater mode and fullscreen? -Yes. When you switch to theater mode or fullscreen, the scaling adjusts automatically to fill the new size. +Yes. When you switch to theater mode or fullscreen, the zoom adjusts automatically to fill the new size. ### Do I have to click it for every video? -No. Pick a mode once and it stays selected as you watch more videos, refresh, or browse around YouTube. It also remembers whether it was on or off. Change either from the toolbar popup or the player button whenever you like. The setting applies to all of YouTube in that browser. +No. Turn it on once and it stays on as you watch more videos, refresh, or browse around YouTube. Turn it off the same way whenever you like. The setting applies to all of YouTube in that browser. ### Does it work on 21:9 and 32:9 ultrawide monitors? -Yes. Fullorama works out the scaling from the shape of your player and the video, so it fits 21:9, 32:9 and anything in between. In crop mode, wider screens trim a little more of the edges; stretch mode fills them without trimming. +Yes. Fullorama works out the zoom from the shape of your player and the video, so it fits 21:9, 32:9 and anything in between. On wider screens, a little more of the edges is trimmed. ### Can I fill the screen and still see the whole picture? -Only if the video is already the same shape as your screen. Crop mode trims a little of the edges to fill it; stretch mode keeps everything but distorts the shape. You can turn the selected mode off any time to see the original picture. +Only if the video is already the same shape as your screen. Otherwise a little of the edges is trimmed to fill it. You can turn the button off any time to see the whole picture. ### Does it work on Netflix, other sites, or my phone? @@ -83,15 +77,15 @@ No, only YouTube in a desktop browser (Chrome or Firefox). It doesn't work on Ne ### Will it slow YouTube down or make videos sharper? -It just scales the video that's already playing, so it doesn't change the video's quality or load anything extra. Scaling won't make it sharper, either. We haven't measured its effect on performance yet, but it does very little work. It only resizes the video you're watching. +It just zooms in on the video that's already playing, so it doesn't change the video's quality or load anything extra. Zooming in won't make it sharper, either. We haven't measured its effect on performance yet, but it does very little work. It only resizes the video you're watching. ### What's the toolbar icon for? -Clicking Fullorama's icon in your browser toolbar opens the mode picker. It shows whether the selected mode is on or off, alongside an Original frame and the two results: Crop keeps the shape and cuts off the edges; Stretch shows everything and pulls the video to fit. Clicking a card selects that mode and turns it on. To turn the selected mode off, use the button in the video player. +Clicking Fullorama's icon in your browser toolbar shows whether the zoom is on or off, and has a link to send us feedback. To turn it on or off, use the button in the video player. ### Does Fullorama collect my data? -No. It saves two things in your browser: which mode you selected and whether it's on or off. It doesn't track what you watch, has no ads, and needs no account. +No. It saves one thing in your browser: whether the zoom is on or off. It doesn't track what you watch, has no ads, and needs no account. Feedback is optional and goes through a separate form run by Tally. It opens if you choose "Share feedback" in the toolbar popup, or after you uninstall. The form link includes the extension's version and where you opened it from. On Firefox, those two details are only sent if you've allowed the optional data permission. See the [privacy policy](https://fullorama.com/privacy) for the full details. @@ -101,43 +95,24 @@ Yes, completely free and open source. The code is on GitHub under the [MIT licen ## How It Works -The extension stores `fillMode` (`crop` or `stretch`) and `fillEnabled` -(`true` or `false`) in extension local storage (`chrome.storage.local` on Chrome -and `browser.storage.local` on Firefox). Two values are needed because the -player can be off while still remembering which mode its button will turn back -on. Upgrading translates the older keys on first load and removes them: -`cropMode: "crop"` or `"stretch"` becomes that mode with fill enabled, -`cropMode: "off"` becomes crop with fill disabled, and `cropEnabled: true` or -`false` becomes crop enabled or disabled. - -The toolbar popup is interactive. It reads the state once, renders the status in -the header (`Crop is off`, `Crop is on`, `Stretch is off`, `Stretch is on`), and -outlines the selected card with a filled radio button. A static `Original` -preview sits above a branching connector; the two result cards loop between -normal and the mode applied. They are CSS-only: a 21:9 box holds a 16:9 still, -scaled uniformly by `21 ÷ 16 = 1.3125` for crop or on the X axis only for -stretch, on the same 5-second loop. Under reduced motion the loop is removed and -each card holds its applied state. Each selected card adds a short mirrored -reflection under its preview. Clicking a card calls `selectMode`, which selects -that mode and turns fill on. The player button calls `toggleEnabled`, so it only -turns the selected mode off and on. A tiny background script registers an -uninstall survey URL so the browser can open the optional feedback form if you -remove the extension. - -When enabled, the content script passes the on/off state and mode to the -renderer, which adds a class to YouTube's `#movie_player` element and sets CSS -variables from the current player and video aspect ratios. Crop scales both axes -by the same amount and clips the overflow, so the picture fills the player -without changing shape. Stretch scales only the shorter axis, so the picture -fills the player but changes shape. `content.css` applies both transforms from -the center. +The extension stores one boolean, `cropEnabled`, in extension local storage (`chrome.storage.local` on Chrome and `browser.storage.local` on Firefox). + +A read-only toolbar popup displays whether crop is currently on or off by +reading the stored value once when opened. The popup cannot toggle crop — only +the player button can. A tiny background script registers an uninstall survey +URL so the browser can open the optional feedback form if you remove the +extension. + +When crop is enabled, the content script adds a class to YouTube's +`#movie_player` element and sets a CSS scale variable based on the current +player aspect ratio and video aspect ratio. The CSS clips the player and scales +the rendered video from the center. YouTube rebuilds parts of its player during normal navigation, so the extension uses YouTube navigation events, a controls-scoped `MutationObserver`, a player-scoped `ResizeObserver`, video metadata events, window resize, fullscreen, -and short retry bursts to keep the button and mode state in sync. Player-size -changes automatically recalculate the scaling when entering or leaving theater -mode. +and short retry bursts to keep the button and crop state in sync. Player-size +changes automatically recalculate the crop when entering or leaving theater mode. ## Install Locally diff --git a/package.json b/package.json index c442a62..94d8f59 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "fullorama", - "version": "1.3.1", + "version": "1.2.1", "description": "Fill your ultrawide screen with YouTube videos without distracting black bars.", "type": "module", "license": "MIT", diff --git a/src/popup/popup.css b/src/popup/popup.css index 854f927..ca43d31 100644 --- a/src/popup/popup.css +++ b/src/popup/popup.css @@ -182,45 +182,11 @@ body { } .option[data-mode="crop"] .preview-frame { - animation: preview-crop 5s ease-in-out infinite; + transform: scale(var(--preview-fill)); } .option[data-mode="stretch"] .preview-frame { - animation: preview-stretch 5s ease-in-out infinite; -} - -@keyframes preview-crop { - 0%, - 20% { - transform: scale(1); - } - - 30%, - 70% { - transform: scale(var(--preview-fill)); - } - - 80%, - 100% { - transform: scale(1); - } -} - -@keyframes preview-stretch { - 0%, - 20% { - transform: scaleX(1); - } - - 30%, - 70% { - transform: scaleX(var(--preview-fill)); - } - - 80%, - 100% { - transform: scaleX(1); - } + transform: scaleX(var(--preview-fill)); } .preview-frame { @@ -318,17 +284,3 @@ a { outline: none; text-decoration: underline; } - -@media (prefers-reduced-motion: reduce) { - .preview-frame { - animation: none; - } - - .option[data-mode="crop"] .preview-frame { - transform: scale(var(--preview-fill)); - } - - .option[data-mode="stretch"] .preview-frame { - transform: scaleX(var(--preview-fill)); - } -} From c1fb128215031dc4800d7e6ffb8832688f9134c2 Mon Sep 17 00:00:00 2001 From: Sudhanshu Makwana <61375120+sudhz@users.noreply.github.com> Date: Tue, 10 Nov 2026 11:51:54 +0000 Subject: [PATCH 6/7] bump version to 1.3.0 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 94d8f59..bea4f77 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "fullorama", - "version": "1.2.1", + "version": "1.3.0", "description": "Fill your ultrawide screen with YouTube videos without distracting black bars.", "type": "module", "license": "MIT", From 542ba66279f1e38dc542c441be828611792eca53 Mon Sep 17 00:00:00 2001 From: Deepak Tripathy Date: Wed, 11 Nov 2026 10:04:19 +0300 Subject: [PATCH 7/7] address stretch mode review notes --- README.md | 87 ++++++++++++------ src/content.css | 13 +-- src/index.ts | 14 +-- src/player/button.ts | 4 +- src/player/{fit.ts => fill.ts} | 67 ++++++-------- src/popup/popup.css | 136 +++++++++++++++++++++++----- src/popup/popup.html | 21 ++--- src/popup/popup.ts | 3 +- src/popup/preview.jpg | Bin 25123 -> 170653 bytes src/storage/mode.ts | 17 ---- src/storage/state.ts | 36 ++++---- src/sync/sync.ts | 19 ++-- tests/{fit.test.ts => fill.test.ts} | 105 ++++++++++++--------- tests/helpers/storage.ts | 45 +++++++++ tests/mode.test.ts | 36 -------- tests/state.test.ts | 91 ++----------------- 16 files changed, 357 insertions(+), 337 deletions(-) rename src/player/{fit.ts => fill.ts} (53%) delete mode 100644 src/storage/mode.ts rename tests/{fit.test.ts => fill.test.ts} (53%) create mode 100644 tests/helpers/storage.ts delete mode 100644 tests/mode.test.ts diff --git a/README.md b/README.md index 3fa3550..694951a 100644 --- a/README.md +++ b/README.md @@ -7,9 +7,11 @@ Website: https://fullorama.com [![Install from the Chrome Web Store](https://img.shields.io/badge/Get_it_on-Chrome_Web_Store-4285F4?style=for-the-badge&logo=googlechrome&logoColor=white)](https://chromewebstore.google.com/detail/fullorama-for-youtube/pacjdmdcmmnbpnjfhmjfgenbpedbakjg) [![Install from Firefox Add-ons](https://img.shields.io/badge/Get_it_on-Firefox_Add--ons-FF7139?style=for-the-badge&logo=firefoxbrowser&logoColor=white)](https://addons.mozilla.org/firefox/addon/fullorama/) -Fullorama for YouTube™ adds one crop button directly to YouTube's player. Turn -it on once and videos stay zoomed to fill across videos, refreshes, navigation, -and fullscreen, until you turn it off. +Fullorama for YouTube™ adds one button directly to YouTube's player. Choose Crop +or Stretch in the toolbar popup, then click the player button to turn that mode +on or off. Crop zooms in evenly to fill the player and trims the edges; stretch +widens the picture to fill it and leaves nothing out. The choice stays across +videos, refreshes, navigation, and fullscreen, until you change it. Built for 21:9 and other ultrawide displays. @@ -30,18 +32,22 @@ https://github.com/user-attachments/assets/3c62393f-5d82-4c7b-8543-0c3c0938f052 ## Features -- YouTube player button for ultrawide crop / zoom-to-fill -- Global persistent on/off state across videos, refreshes, and navigation +- Choose Crop or Stretch in the toolbar popup +- An Original frame and two looping result previews show what each mode does +- YouTube player button turns the selected mode on or off +- Crop mode zooms evenly to fill the player and trims the edges +- Stretch mode fills the player without trimming, at the cost of distortion +- The selected mode and on/off state persist across videos, refreshes, and navigation - Works with YouTube's single-page navigation - Works in theater mode and fullscreen -- Read-only popup shows current crop status +- Popup shows the selected mode and whether it's on or off - Optional feedback form (popup link and uninstall survey) ## FAQ ### How do I watch YouTube full screen on an ultrawide monitor? -Install Fullorama for [Chrome](https://chromewebstore.google.com/detail/fullorama-for-youtube/pacjdmdcmmnbpnjfhmjfgenbpedbakjg) or [Firefox](https://addons.mozilla.org/firefox/addon/fullorama/) and play any YouTube video. Look at the bottom-right of the player: there's a new button with four little corner brackets, next to the settings gear. Click it and the video zooms in to fill the player. A small square appears in the middle of the icon to show it's on. Click it again to go back to normal. +Install Fullorama for [Chrome](https://chromewebstore.google.com/detail/fullorama-for-youtube/pacjdmdcmmnbpnjfhmjfgenbpedbakjg) or [Firefox](https://addons.mozilla.org/firefox/addon/fullorama/) and play any YouTube video. Click Fullorama's icon in your browser toolbar and choose Crop or Stretch from the two result cards under the Original frame. Crop zooms the video in to fill the player; stretch fills it without trimming anything, at the cost of distortion. Then use the new button with four little corner brackets at the bottom-right of the player, next to the settings gear, to turn that mode on or off. A small square (crop) or wide bar (stretch) appears in the middle of the icon while it's on. ### I can't find the button. Where is it? @@ -49,27 +55,27 @@ It's with YouTube's own buttons at the bottom-right of the video, between the se ### Will the video look stretched? -No. Fullorama zooms in evenly from the center, so people and objects keep their normal shape. The trade-off is that a little of the edges gets trimmed. +Crop mode doesn't stretch anything. It zooms in evenly from the center, so people and objects keep their normal shape; the trade-off is that a little of the edges gets trimmed. Stretch mode does stretch the picture to fill the player and will make it look wider or taller than it is. Nothing gets trimmed in stretch mode. Use crop if you care more about shape, and stretch if you care more about seeing the whole frame. The player button turns the selected mode off at any time. ### Why do some videos still have black bars? -Some videos have the bars recorded into the picture itself, often old movies or re-uploads. Fullorama can't tell those apart from the real image, so they can stay even with the button on. It also can't show picture that was never in the video. +Some videos have the bars recorded into the picture itself, often old movies or re-uploads. Fullorama can't tell those apart from the real image, so they can stay even with a mode on. It also can't show picture that was never in the video. ### Does it work in theater mode and fullscreen? -Yes. When you switch to theater mode or fullscreen, the zoom adjusts automatically to fill the new size. +Yes. When you switch to theater mode or fullscreen, the scaling adjusts automatically to fill the new size. ### Do I have to click it for every video? -No. Turn it on once and it stays on as you watch more videos, refresh, or browse around YouTube. Turn it off the same way whenever you like. The setting applies to all of YouTube in that browser. +No. Pick a mode once and it stays selected as you watch more videos, refresh, or browse around YouTube. It also remembers whether it was on or off. Change either from the toolbar popup or the player button whenever you like. The setting applies to all of YouTube in that browser. ### Does it work on 21:9 and 32:9 ultrawide monitors? -Yes. Fullorama works out the zoom from the shape of your player and the video, so it fits 21:9, 32:9 and anything in between. On wider screens, a little more of the edges is trimmed. +Yes. Fullorama works out the scaling from the shape of your player and the video, so it fits 21:9, 32:9 and anything in between. In crop mode, wider screens trim a little more of the edges; stretch mode fills them without trimming. ### Can I fill the screen and still see the whole picture? -Only if the video is already the same shape as your screen. Otherwise a little of the edges is trimmed to fill it. You can turn the button off any time to see the whole picture. +Only if the video is already the same shape as your screen. Crop mode trims a little of the edges to fill it; stretch mode keeps everything but distorts the shape. You can turn the selected mode off any time to see the original picture. ### Does it work on Netflix, other sites, or my phone? @@ -77,15 +83,15 @@ No, only YouTube in a desktop browser (Chrome or Firefox). It doesn't work on Ne ### Will it slow YouTube down or make videos sharper? -It just zooms in on the video that's already playing, so it doesn't change the video's quality or load anything extra. Zooming in won't make it sharper, either. We haven't measured its effect on performance yet, but it does very little work. It only resizes the video you're watching. +It just scales the video that's already playing, so it doesn't change the video's quality or load anything extra. Scaling won't make it sharper, either. We haven't measured its effect on performance yet, but it does very little work. It only resizes the video you're watching. ### What's the toolbar icon for? -Clicking Fullorama's icon in your browser toolbar shows whether the zoom is on or off, and has a link to send us feedback. To turn it on or off, use the button in the video player. +Clicking Fullorama's icon in your browser toolbar opens the mode picker. It shows whether the selected mode is on or off, alongside an Original frame and the two results: Crop keeps the shape and cuts off the edges; Stretch shows everything and pulls the video to fit. Clicking a card selects that mode and turns it on. To turn the selected mode off, use the button in the video player. ### Does Fullorama collect my data? -No. It saves one thing in your browser: whether the zoom is on or off. It doesn't track what you watch, has no ads, and needs no account. +No. It saves two things in your browser: which mode you selected and whether it's on or off. It doesn't track what you watch, has no ads, and needs no account. Feedback is optional and goes through a separate form run by Tally. It opens if you choose "Share feedback" in the toolbar popup, or after you uninstall. The form link includes the extension's version and where you opened it from. On Firefox, those two details are only sent if you've allowed the optional data permission. See the [privacy policy](https://fullorama.com/privacy) for the full details. @@ -95,24 +101,45 @@ Yes, completely free and open source. The code is on GitHub under the [MIT licen ## How It Works -The extension stores one boolean, `cropEnabled`, in extension local storage (`chrome.storage.local` on Chrome and `browser.storage.local` on Firefox). - -A read-only toolbar popup displays whether crop is currently on or off by -reading the stored value once when opened. The popup cannot toggle crop — only -the player button can. A tiny background script registers an uninstall survey -URL so the browser can open the optional feedback form if you remove the -extension. - -When crop is enabled, the content script adds a class to YouTube's -`#movie_player` element and sets a CSS scale variable based on the current -player aspect ratio and video aspect ratio. The CSS clips the player and scales -the rendered video from the center. +The extension stores `fillMode` (`crop` or `stretch`) and `fillEnabled` +(`true` or `false`) in extension local storage (`chrome.storage.local` on Chrome +and `browser.storage.local` on Firefox). Two values are needed because the +player can be off while still remembering which mode its button will turn back +on. Upgrading from a version before 1.3.0 moves the older `cropEnabled` boolean +to `fillEnabled` and removes the old key. That migration is temporary and will +be removed in the release after 1.3.0. + +The toolbar popup is interactive. It reads the state once and shows the status in +the header (`Crop is off`, `Crop is on`, `Stretch is off`, `Stretch is on`) with +a green dot when on. A static `Original` frame above a branching connector shows +the square video inside a 21:9 player with side bars. The two result cards loop +between the original frame and the mode applied. They are CSS-only: each card +holds the square still in a 21:9 box, scaled uniformly by `21 ÷ 9 = 2.3333` for +crop or on the X axis only for stretch, on the same 5-second loop. The selected +card gets a white outline and a filled radio, and the selected Crop card shows +the cut-off parts as a faded overflow above and below the frame. Under +`prefers-reduced-motion: reduce` the loop stops and each card holds its applied +state. Clicking a card calls `selectMode`, which selects that mode and turns fill +on. The player button calls `toggleEnabled`, so it only turns the selected mode +off and on. A tiny background script registers an uninstall survey URL so the +browser can open the optional feedback form if you remove the extension. + +When enabled, `applyFill` reads the state itself and adds `flrm-fill-on` to +YouTube's `#movie_player` element, setting `--flrm-scale-x` and `--flrm-scale-y` +from the current player and video aspect ratios. Crop sets both variables to the +same scale and clips the overflow, so the picture fills the player without +changing shape. Stretch sets the shorter axis to 1 and the longer axis to the +fill scale, so the picture fills the player but changes shape. `content.css` +applies one transform from the center. If the player size is not known yet, +`applyFill` clears the previous fill so changing modes early cannot leave stale +geometry behind. YouTube rebuilds parts of its player during normal navigation, so the extension uses YouTube navigation events, a controls-scoped `MutationObserver`, a player-scoped `ResizeObserver`, video metadata events, window resize, fullscreen, -and short retry bursts to keep the button and crop state in sync. Player-size -changes automatically recalculate the crop when entering or leaving theater mode. +and short retry bursts to keep the button and mode state in sync. Player-size +changes automatically recalculate the scaling when entering or leaving theater +mode. ## Install Locally diff --git a/src/content.css b/src/content.css index 1898767..4e5e59c 100644 --- a/src/content.css +++ b/src/content.css @@ -24,20 +24,11 @@ display: block; } -#movie_player.flrm-crop-on { +#movie_player.flrm-fill-on { overflow: hidden !important; } -#movie_player.flrm-crop-on video.html5-main-video { - transform: scale(var(--flrm-scale, 1)) !important; - transform-origin: center center !important; -} - -#movie_player.flrm-stretch-on { - overflow: hidden !important; -} - -#movie_player.flrm-stretch-on video.html5-main-video { +#movie_player.flrm-fill-on video.html5-main-video { transform: scale(var(--flrm-scale-x, 1), var(--flrm-scale-y, 1)) !important; transform-origin: center center !important; } diff --git a/src/index.ts b/src/index.ts index 0f1f130..7272dd2 100644 --- a/src/index.ts +++ b/src/index.ts @@ -7,13 +7,13 @@ * chrome.storage.local across videos, refreshes, and navigation. */ -import { getMode, isEnabled, loadState, onStorageChange } from './storage/state'; +import { loadState, onStorageChange } from './storage/state'; import { updateButton } from './player/button'; -import { applyFit } from './player/fit'; +import { applyFill } from './player/fill'; import { getPlayer } from './player/dom'; import { - applyFitAndSync, - applyFitNow, + applyFillAndSync, + applyFillNow, onVideoMetadata, resetObserver, retryBurst, @@ -25,12 +25,12 @@ async function init(): Promise { // Sync from other tabs onStorageChange(() => { updateButton(); - applyFit(getPlayer(), isEnabled(), getMode()); + applyFill(getPlayer()); }); // Apply the selected mode immediately on resize and fullscreen - window.addEventListener('resize', applyFitNow, { passive: true }); - document.addEventListener('fullscreenchange', applyFitAndSync); + window.addEventListener('resize', applyFillNow, { passive: true }); + document.addEventListener('fullscreenchange', applyFillAndSync); document.addEventListener('yt-navigate-finish', retryBurst); document.addEventListener('yt-navigate-start', resetObserver); document.addEventListener('loadedmetadata', onVideoMetadata, true); diff --git a/src/player/button.ts b/src/player/button.ts index 2ae4b9b..d331276 100644 --- a/src/player/button.ts +++ b/src/player/button.ts @@ -3,7 +3,7 @@ */ import { getMode, isEnabled, toggleEnabled } from '../storage/state'; -import { applyFit } from './fit'; +import { applyFill } from './fill'; import { getPlayer } from './dom'; const BUTTON_ATTR = 'data-flrm-btn'; @@ -98,7 +98,7 @@ function onButtonClick(event: Event): void { event.stopPropagation(); toggleEnabled(); updateButton(); - applyFit(getPlayer(), isEnabled(), getMode()); + applyFill(getPlayer()); } export function injectButton( diff --git a/src/player/fit.ts b/src/player/fill.ts similarity index 53% rename from src/player/fit.ts rename to src/player/fill.ts index d0b07fd..d335994 100644 --- a/src/player/fit.ts +++ b/src/player/fill.ts @@ -1,14 +1,12 @@ /** - * Fit — applies the selected fill mode to #movie_player when enabled. + * Fill — applies the selected fill mode to #movie_player when enabled. * Crop zooms the video uniformly to fill; stretch scales each axis to fill. - * The actual transforms are defined in content.css. + * The actual transform is defined in content.css. */ -import { FillMode } from '../storage/mode'; +import { getMode, isEnabled } from '../storage/state'; -const CROP_CLASS = 'flrm-crop-on'; -const STRETCH_CLASS = 'flrm-stretch-on'; -const SCALE_VAR = '--flrm-scale'; +const PLAYER_CLASS = 'flrm-fill-on'; const SCALE_X_VAR = '--flrm-scale-x'; const SCALE_Y_VAR = '--flrm-scale-y'; @@ -62,19 +60,13 @@ function round(value: number): number { return Math.round(value * 10000) / 10000; } -export function applyFit( - player: HTMLElement | null, - enabled: boolean, - mode: FillMode, -): void { +export function applyFill(player: HTMLElement | null): void { if (!player) { return; } - if (!enabled) { - removeClass(player, CROP_CLASS); - removeClass(player, STRETCH_CLASS); - removeVar(player, SCALE_VAR); + if (!isEnabled()) { + removeClass(player, PLAYER_CLASS); removeVar(player, SCALE_X_VAR); removeVar(player, SCALE_Y_VAR); return; @@ -82,36 +74,33 @@ export function applyFit( const aspects = readAspects(player); if (!aspects) { + // The size is not known yet. Clear any previous fill so a mode change + // cannot leave stale geometry on the player. + removeClass(player, PLAYER_CLASS); + removeVar(player, SCALE_X_VAR); + removeVar(player, SCALE_Y_VAR); return; } - if (mode === 'stretch') { - removeClass(player, CROP_CLASS); - removeVar(player, SCALE_VAR); + let scaleX: number; + let scaleY: number; + if (getMode() === 'stretch') { const wider = aspects.player >= aspects.video; - const scaleX = wider ? aspects.player / aspects.video : 1; - const scaleY = wider ? 1 : aspects.video / aspects.player; - - setVar(player, SCALE_X_VAR, String(round(scaleX))); - setVar(player, SCALE_Y_VAR, String(round(scaleY))); - if (!player.classList.contains(STRETCH_CLASS)) { - player.classList.add(STRETCH_CLASS); - } - return; + scaleX = wider ? aspects.player / aspects.video : 1; + scaleY = wider ? 1 : aspects.video / aspects.player; + } else { + const scale = Math.max( + aspects.player / aspects.video, + aspects.video / aspects.player, + ); + scaleX = scale; + scaleY = scale; } - removeClass(player, STRETCH_CLASS); - removeVar(player, SCALE_X_VAR); - removeVar(player, SCALE_Y_VAR); - - const scale = Math.max( - aspects.player / aspects.video, - aspects.video / aspects.player, - ); - - setVar(player, SCALE_VAR, String(round(scale))); - if (!player.classList.contains(CROP_CLASS)) { - player.classList.add(CROP_CLASS); + setVar(player, SCALE_X_VAR, String(round(scaleX))); + setVar(player, SCALE_Y_VAR, String(round(scaleY))); + if (!player.classList.contains(PLAYER_CLASS)) { + player.classList.add(PLAYER_CLASS); } } diff --git a/src/popup/popup.css b/src/popup/popup.css index ca43d31..074c445 100644 --- a/src/popup/popup.css +++ b/src/popup/popup.css @@ -167,8 +167,15 @@ body { border-radius: 12px; } +.preview-wrap { + --preview-fill: 2.3333; + position: relative; + display: block; +} + .preview { - --preview-fill: 1.3125; + position: relative; + z-index: 1; display: flex; align-items: center; justify-content: center; @@ -181,14 +188,6 @@ body { border-radius: 10px; } -.option[data-mode="crop"] .preview-frame { - transform: scale(var(--preview-fill)); -} - -.option[data-mode="stretch"] .preview-frame { - transform: scaleX(var(--preview-fill)); -} - .preview-frame { display: block; width: auto; @@ -197,29 +196,99 @@ body { transform-origin: center center; } -.option.is-selected .preview { - border-color: transparent; - outline: 2px solid #fff; - outline-offset: 2px; -} - -.mirror { - display: block; - height: 20px; - margin-top: 4px; +.preview-bleed { + --bleed: 14px; + position: absolute; + top: calc(-1 * var(--bleed)); + right: 0; + bottom: calc(-1 * var(--bleed)); + left: 0; + display: flex; + align-items: center; + justify-content: center; overflow: hidden; opacity: 0; + pointer-events: none; + -webkit-mask-image: linear-gradient( + to bottom, + transparent, + #000 20%, + #000 80%, + transparent + ); + mask-image: linear-gradient( + to bottom, + transparent, + #000 20%, + #000 80%, + transparent + ); +} + +.preview-bleed::before { + content: ""; + flex: none; + width: auto; + height: calc(100% - 2 * var(--bleed) - 2px); + aspect-ratio: 1; + background: url("preview.jpg") center / cover no-repeat; + transform-origin: center center; +} + +.option[data-mode="crop"] .preview-bleed::before { + animation: preview-crop 5s ease-in-out infinite; } -.option.is-selected .mirror { +.option[data-mode="crop"].is-selected .preview-bleed { opacity: 0.6; - -webkit-mask-image: linear-gradient(to bottom, #000, transparent); - mask-image: linear-gradient(to bottom, #000, transparent); } -.preview--mirror { - transform: scaleY(-1); - transform-origin: top center; +.option[data-mode="crop"] .preview-frame { + animation: preview-crop 5s ease-in-out infinite; +} + +.option[data-mode="stretch"] .preview-frame { + animation: preview-stretch 5s ease-in-out infinite; +} + +@keyframes preview-crop { + 0%, + 20% { + transform: scale(1); + } + + 30%, + 70% { + transform: scale(var(--preview-fill)); + } + + 80%, + 100% { + transform: scale(1); + } +} + +@keyframes preview-stretch { + 0%, + 20% { + transform: scaleX(1); + } + + 30%, + 70% { + transform: scaleX(var(--preview-fill)); + } + + 80%, + 100% { + transform: scaleX(1); + } +} + +.option.is-selected .preview { + border-color: transparent; + outline: 2px solid #fff; + outline-offset: 2px; } .option-body { @@ -284,3 +353,20 @@ a { outline: none; text-decoration: underline; } + +@media (prefers-reduced-motion: reduce) { + .option[data-mode="crop"] .preview-frame, + .option[data-mode="crop"] .preview-bleed::before, + .option[data-mode="stretch"] .preview-frame { + animation: none; + } + + .option[data-mode="crop"] .preview-frame, + .option[data-mode="crop"] .preview-bleed::before { + transform: scale(var(--preview-fill)); + } + + .option[data-mode="stretch"] .preview-frame { + transform: scaleX(var(--preview-fill)); + } +} diff --git a/src/popup/popup.html b/src/popup/popup.html index f937e1e..1dffb67 100644 --- a/src/popup/popup.html +++ b/src/popup/popup.html @@ -19,7 +19,7 @@

Fullorama

Original

@@ -27,12 +27,10 @@

Fullorama