Hide non-youtube videos on Google video search r###lts. Add toggle.
This is a userscript that modifies the Google Video search r###lts to only display videos from youtube.com.
When the script is activated (on a Google Video search r###lts page), it scans the page and selectively hides search r###lts that are not from the youtube.com domain. The r###lts are hidden by setting the display property of the search r###lt div to 'none'.
It adds a small message to the "r###lt-stats" div (usually located on the top of the r###lts) indicating that non-youtube items have been hidden. Clicking this message will toggle the visibility of hidden items, alternately showing and hiding non-youtube videos each time you click.
The script uses MutationObserver to monitor the search r###lts container. This allows it to respond dynamically when new r###lts are loaded, such as when the user scrolls down, and to hide non-youtube videos from the new r###lts as well.
The script will only run on Google Video search r###lts pages, as specified by the @match line in the metadata block. It looks for tbm=vid to tell it is on the videos tab. Modify the match statement for other google domains besides .ca/.com