Detach video bookmarklet: javascript:(function (src) {var s;s=document.createElement('script');s.src=src;document.body.appendChild(s);}('https://gist.githubusercontent.com/abernier/9730666/raw/detachvideo.js'));)
✓ Published0🌍 Public
Aabernier
Last edited May 10, 2014
Created on Mar 23, 2014
This bookmarklet detaches the largest video element from a webpage and reopens it in a separate pop-up window sized to its original dimensions, preserving the viewer’s context while hiding the surrounding page. The code uses the DOM API (`querySelectorAll`, `getBoundingClientRect`) to sort all `video`, `object`, and `iframe` tags by area, then opens the video’s URL (or the iframe’s `src`) via `window.open`. After load, it scrolls the pop-up to match the original video’s position and sets `overflow` to `hidden` on both the body and its parent, isolating the playback. The script relies on plain JavaScript, with no external libraries.
AI-generated description