THIS IS A STATIC MIRROR OF USERSCRIPTS.ORG - LOGINS DO NOT WORK

Resize Youtube Player To Window Size

By Zren Last update May 14, 2014 — Installed 2,787 times.
5 stars
Awesome script; a must-have for any youtube power user! , Jul 30, 2013
Review written by LouisTakePILLz - see all my reviews (1)

This script works flawlessly as of 2013-07-30, top notch!

Although, I had to manually add a piece of code to hide the horizontal scroll bar; it had become a (minor) annoyance when watching videos inside a window resized small enough to trigger it (i.e. appendStyle('body', 'overflow-x', 'hidden'); at the end of the resizeVideoPlayer function).
This is not a reproach but a request: would it be possible to implement a function to automatically hide the x-scrollbar as soon as the video element covers up all the available space (verifiable by checking the scrolling perhaps?).

4 comments |

You could comment on this review if you were logged in.

2 points
login to vote
FirefoxWindows LouisTakePILLz review's author
Posted Jul 31, 2013

For the sake of the code and our sanity, I first tried to do it using events.
Unfortunately, the function linked to a DOMMouseScroll event (bad combo maybe?) would not be triggered in all cases and ended up being a not very reliable solution, which explains why I opted for the horrifying setInterval solution urgh.

Edit:

I just tested your new update and I haven't encountered any issue (yet?).

> I was considering having it like that (only hidden when fully scrolled to the top). Right now it's hidden until you scroll past the header.

- Oh I see what you did there, in that case, it would probably not really matter if, once in a while the the event call gets tossed because the next one would be there to "take the relay".

- I have noticed that you in fact do not use the "DOMMouseScroll" event (which is the legacy Gecko event for mouse the mouse wheel, not cross-browser compatible?) but simply the "Scroll" event. I don't know how reliable it is compared to the one I previously tested but it seems to do its job, hurray!

> Why on earth are review comments sorted by date descending. o.O

Is it causing a problem? O.o?

2 points
login to vote
Posted Jul 31, 2013

Just fixed the Firefox bug.

> window.pageYOffset == 0 ? 'hidden' : 'visible'

I was considering having it like that (only hidden when fully scrolled to the top). Right now it's hidden until you scroll past the header.

> setInterval(fixScrollbars, 1000);

Events are cooler!

Edit: Why on earth are review comments sorted by date descending. o.O

2 points
login to vote
FirefoxWindows LouisTakePILLz review's author
Posted Jul 31, 2013

Hmmm, since I happen to use Mozilla Firefox, those webkit attributes/values won't be of any help.

I've made a quick modification to your script (based on the version 1.11) to implement the feature I've suggested in my review: http://pastebin.com/bbfW8uru

Tell me what you think :)

Edit: I have just realized that your appendStyle function seems to leave LOTS of obsolete overridden CSS rules behind, at least, on my client; you might want to check your code to make sure it works the way you intended it to work. IMO, it would be easier to use jQuery, but that's up to you :P

Edit 2: I've just seen the new revision you just put online and, after a quick essay, it no longer seems to work (I run Firefox 22).

2 points
login to vote
Posted Jul 31, 2013

Neat idea. It'll be really easy to add too as I already have to check the scroll position for the header and guide (as they are normally fixed position elements).

appendStyle(scriptBodyClassSelector + '.' + viewingVideoClassId, 'overflow-x', 'hidden');

`overflow: hidden;` prevents scrolling with the scrollwheel, otherwise I'd use it for the y axis as well.

I use a userstyle to hide both scrollbars completely.

html::-webkit-scrollbar,
body::-webkit-scrollbar {
width: 0px;
height: 0px;
}

It will still allow scrolling, though it only works 50% of the time in Chrome + Stylish. It's very finicky.