[UserJS] Youtube Video Screen

Forums » General Opera topics » User JavaScript

You need to be logged in to post in the forums. If you do not have an account, please sign up first.

Go to last post

18. June 2008, 07:57:02

l815

Posts: 92

[UserJS] Youtube Video Screen

I made this simple script which allows you to set a black screen behind youtube videos.
I don't think it's perfect, but I'm willing to improve it if people would like.

Features:
-Makes a copy of the video, and makes a new centered [width only] copy
-Hides and stops [to my knowledge] the default loaded video
-Black back screen with transparency set to 90% [Changeable]
-Only shows when Youtube is loaded
-Displays a 'Screen Off, Screen On' link at the top left of the screen

The latest version of this script can be found later in this thread


With Screen OFF:
off2.jpg

With Screen ON:
on.jpg

File:

ytS.js

PS: Don't mind the spelling errors in the code, it's late. I'll fix them tomorrow probably p

Leave comments & Suggestions!
I hope you enjoy smile

18. June 2008, 19:30:37

Doliprane

Posts: 509

I love it yes
If it could be launched right from the beginning (instead of actually pressing screen on) that would be perfect!
My wish-list:
  1. Content Blocker: Managed Sites: Display Number of Hits Seems to be a cool and nice feature. Do not hesitate to bump the thread pirate .
  2. Search engine sorting (move search engines up/down): An old basic need, HAS to be fixed bomb
  3. New Opera Preferences layout idea w\ Mockup: the current one is in dire need of change monkey

18. June 2008, 23:58:23

l815

Posts: 92

bigsmile Thanks.I can modify it to do it automatically.
I'll work on it tonight.

27. June 2008, 07:38:30

Dava

Posts: 802

Nice script - works as described.

One point - I have the youtube downloader script videoscript.user.js which places a yellow toolbar across the top of the page with a download link. This yellow toolbar obscures the Screen Off link (strangely it doesn't obscure the Screen On link). Perhaps you should force the Screen On/off links to the front of the page to prevent them being covered.

Also you have the Screen On option available on the YouTube homepage and search results - clicking just brings up the screen overlay with no vid (as expected). Perhaps you could restrict the Screen On/Off links to videos where it has some relevance.

Dava monkey

27. June 2008, 14:20:59

pdarko

/dev/random

Posts: 284

Add
// ==UserScript==
// @include       http://www.youtube.com/watch?*
// ==/UserScript==

at beginning of the file and you can remove checkYoutube function
Poor man is not one who have little, but one who desires more.

27. June 2008, 14:36:13

Dava

Posts: 802

Originally posted by pdarko:

Add

// ==UserScript==
// @include       http://www.youtube.com/watch?*
// ==/UserScript==

at beginning of the file and you can remove checkYoutube function



You mean change it from:

/**
 * @author L815
 * Feel free to use as you please
 */


//Elemtns for the buttons & black background
//To change transparency, where it says "opacity", change the value you wish [higher = darker]
var the_div = document.createElement("div");
	the_div.style = "opacity:.90;width:100%;height:100%;background-color: #000;position:absolute;top:0;display:none;";


To:

// ==UserScript==
// @include       http://www.youtube.com/watch?*
// ==/UserScript==

/**
 * @author L815
 * Feel free to use as you please
 */


//Elemtns for the buttons & black background
//To change transparency, where it says "opacity", change the value you wish [higher = darker]
var the_div = document.createElement("div");
	the_div.style = "opacity:.90;width:100%;height:100%;background-color: #000;position:absolute;top:0;display:none;";


???

Dava monkey

27. June 2008, 22:25:19

pdarko

/dev/random

Posts: 284

Yes. It will tell Opera to run script just on http://www.youtube.com/watch?* pages.
See this.
Poor man is not one who have little, but one who desires more.

28. June 2008, 00:28:57

Dava

Posts: 802

Originally posted by pdarko:

Yes. It will tell Opera to run script just on http://www.youtube.com/watch?* pages.
See this.



Thanks for the info.

Dava monkey

28. June 2008, 19:04:43

Moderator

larskl

~ moderator ~

Posts: 22500

I made some changes to your script, rewrote some stuff, added some, moved some, ...

Changes:
- added option to choose the default mode
- moved the toggle button to upper right and made it images instead of text links
- added proper userjs header

If you like the changes I made feel free to use it, if you don't like them, well, just ignore this script smile

youtube_screen.js

28. June 2008, 19:32:19

Deass

Posts: 67

Thank you very much l815 and larskl! Both scripts are fantastic, but I choose the last one, cause it's more refined. up

28. June 2008, 20:16:01 (edited)

rfudk

Godlike!

Posts: 114

nice, thanks alot! Is there a way to halt the video after "closing" the "window"?
Wise men talk because they have something to say; fools, because they have to say something.

28. June 2008, 23:54:01

Moderator

larskl

~ moderator ~

Posts: 22500

Originally posted by rfudk:

nice, thanks alot! Is there a way to halt the video after "closing" the "window"?


afaik there's no scripting API allowing control over the playback functions in youtube

29. June 2008, 17:37:13

Doliprane

Posts: 509

Oh men it's so great headbang , thanks a lot yes
My wish-list:
  1. Content Blocker: Managed Sites: Display Number of Hits Seems to be a cool and nice feature. Do not hesitate to bump the thread pirate .
  2. Search engine sorting (move search engines up/down): An old basic need, HAS to be fixed bomb
  3. New Opera Preferences layout idea w\ Mockup: the current one is in dire need of change monkey

9. July 2008, 12:45:00 (edited)

Moderator

larskl

~ moderator ~

Posts: 22500

version 1.21

changelog:
* YouTube Auto-Pause compatibility
* added option to adjust video size in screen mode
* code cleanup

youtube_screen.js

9. July 2008, 14:27:45 (edited)

rfudk

Godlike!

Posts: 114

larskl: thanks for the new version! I'd love it

*edit* really nice, tried it for some hours! Great update!
Wise men talk because they have something to say; fools, because they have to say something.

10. July 2008, 14:43:56

Doliprane

Posts: 509

Yeah very nice, we need guys like you as we can't do this
My wish-list:
  1. Content Blocker: Managed Sites: Display Number of Hits Seems to be a cool and nice feature. Do not hesitate to bump the thread pirate .
  2. Search engine sorting (move search engines up/down): An old basic need, HAS to be fixed bomb
  3. New Opera Preferences layout idea w\ Mockup: the current one is in dire need of change monkey

12. July 2008, 00:55:53

skye11

Posts: 437

nice feature up

a few minor issues:
- in partial screen mode, the left part of the video screen gets hidden by the videos list on the left
- the screen 'on'/'off' link on upper left and 'close' button on upper right get hidden by other userJS buttons
(ie. showiconsaslinks.js - but not your fault)

suggestions:
- do not activate 'play' when clicking 'on' or 'off' screen (very annoying) - at least make it an option

12. July 2008, 10:42:21

Moderator

larskl

~ moderator ~

Posts: 22500

Originally posted by skye11:

- in partial screen mode, the left part of the video screen gets hidden by the videos list on the left
- the screen 'on'/'off' link on upper left and 'close' button on upper right get hidden by other userJS buttons
(ie. showiconsaslinks.js - but not your fault)


Try my script, posted 4 posts above yours, instead of one in first post

Originally posted by skye11:

suggestions:
- do not activate 'play' when clicking 'on' or 'off' screen (very annoying) - at least make it an option


use YouTube Auto-Pause

6. August 2008, 00:19:02 (edited)

l815

Posts: 92

Sorry I haven't posted or updated this code in a while. I see many things have happened compared to my original thought.

I'm glad this has become a useful script.

Also @ larski, I really like your updates/changes. Thanks for contributing bigsmile
Thanks to everyone else as well for submitting change requests, and so on...

10. August 2008, 15:08:51

wilhelmrahn

Posts: 45

Works like a charm in 9.27, thanks a lot smile

25. August 2008, 23:35:06

nobug

Banned user

It conflicts with FlashBlocker userjs. Without one or another they both work well, but when both are activated I can´t play movies.

It also prevents me from expanding the description of the movie among others actions from buttons on the page .

I am on opera 9.52 by the way.

It is a wonderful script so i wanted to say my feedback to make it even better. Thanks

25. August 2008, 23:40:06

Moderator

larskl

~ moderator ~

Posts: 22500

this script doesn't influence anything but the actual video, description and all other buttons are working just fine.
it's probably some other script that breaks it

4. November 2008, 13:12:20

scatbin

Posts: 119

This is probably the best JS I've found! Nice work

19. January 2009, 17:56:34

Moderator

larskl

~ moderator ~

Posts: 22500

Updated: http://files.myopera.com/larskl/files/youtube_screen.js
Changes:
- Hide the "Upload" and username buttons
- Add auto-pause feature
- Add feature to load high-quality videos

19. January 2009, 21:57:26

RedSaint

Posts: 14

Awesome. Took me a while to change the script to redirect to uk.youtube.com, but once I had that going for me, I started loving this script. Absolutely brilliant love

Big thanks to creator l815 and current coder larskl.
do we live to watch anime, or do we watch anime to live?

21. January 2009, 20:31:27

scatbin

Posts: 119

Excellent work, nicely done.

22. January 2009, 11:15:56

alienyd

Posts: 18

hi,
could you please re-enable the centralize function of this scrip? Since the upload button is hidden, the video screen is not shown at the center any more. I think it would be nice to have this thing back!
Thanks

22. January 2009, 15:51:09

Moderator

larskl

~ moderator ~

Posts: 22500

the video is still centered. there were no changes regarding the position in the latest update

22. January 2009, 22:31:45 (edited)

alienyd

Posts: 18

sorry, but that doesn't seem to be happening to me, adding the lines for removing Upload button and the video stands in its place, no centerlization!
Youtube uncentered.jpg

Oh, don't bother, I figured it out! I moved the hidding code down after the video resizing code and also same thing for the showing code. It's back to normal now.

Youtube backagain.jpg
And by the way, when I tried to reload an opened-and-played youtube video, the auto-pause feature seemed to randomly break, sometimes the video was paused, sometimes not. Probably just a small bug.
Could you also add the animation so that the black screen fade in before the video placeholder appears? I just fancy some effects for such 'cinema' place!p
Anyway, this script is great! Thanks to all helped building it! Such a good combination!

23. January 2009, 00:05:17

Moderator

larskl

~ moderator ~

Posts: 22500

ah, you're not logged in. didn't realize that one button only appears if you're logged in. fixed: youtube_screen.js 1.33

Originally posted by alienyd:

Could you also add the animation so that the black screen fade in before the video placeholder appears?


I don't like animations and the video appears pretty instantly here so no.

23. January 2009, 03:33:16

Perryking

Posts: 713

Don't work on http://es.youtube.com , only on www.youtube.com sad

23. January 2009, 10:29:17

Moderator

larskl

~ moderator ~

Posts: 22500

please provide details when reporting problems! "don't work" is not a useful statement!

Originally posted by Perryking:

Don't work on http://es.youtube.com , only on www.youtube.com


you did read the comment in the file about redirecting to www.youtube.com? if you don't want that just remove that part of the script

23. January 2009, 11:34:20

alienyd

Posts: 18

hi, me again! I seem to constantly have problem with this scrip!sad
when I typed www.youtube.com and hit 'Enter', I would be redirect to de. version (I'm in Germany), same thing when I used a direct link to a specific video page (i.e. http://www.youtube.com/watch?v=MyShkaAwbR8) it then repeatedly tried to redirect to the de. site version, resulting an endless redirect, not until I opened (in another tab) the youtube homepage, and cancel the stupid localized option, does the video page (in the previous tab, automatically jump to the www one). Could you please help me fixing this thing?! I hope that's understandable!
Thanks!

23. January 2009, 11:36:51

Moderator

larskl

~ moderator ~

Posts: 22500

read what i said before:

Originally posted by larskl:

you did read the comment in the file about redirecting to www.youtube.com? if you don't want that just remove that part of the script


or just accept cookies from youtube so you can always get the international version

23. January 2009, 11:44:05

alienyd

Posts: 18

I'd love to have the international version, it's just that what comes to me always the localized, even with the script (what I changed in it has nothing to do with the localized part). And when I restart Opera, the stupid thing is back to localized (cookies delted during turing off of Opera)
Any idea?

23. January 2009, 13:20:17

Moderator

larskl

~ moderator ~

Posts: 22500

Originally posted by alienyd:

Any idea?


don't delete cookies or remove the line from the script

27. January 2009, 12:28:13 (edited)

scatbin

Posts: 119

hi, just found a couple of issues with the updated script. First of all, youtubes playlist function doesn't work. It's not just the playnext feature, the entire playlist , which usually shows up above the related videos list, is missing. Secondly, if you wish to go back a screen you have to double tap the back button. I think the double tap problem is being caused by the watch in high quality function of the script

27. January 2009, 15:52:40

Moderator

larskl

~ moderator ~

Posts: 22500

Originally posted by scatbin:

First of all, youtubes playlist function doesn't work


Adding/removing/playing videos from that list works just fine here. Tested in clean installs of 9.63 and latest 10.00 weekly

Originally posted by scatbin:

Secondly, if you wish to go back a screen you have to double tap the back button


That's indeed caused by the high quality thing. If you don't like it you'll have to remove the high quality lines in the .js

27. January 2009, 16:35:19

scatbin

Posts: 119

so when you select "play all" you have no issues with the next video in the list starting up?

27. January 2009, 17:24:33

Moderator

larskl

~ moderator ~

Posts: 22500

nope, that doesn't work. but you didn't mention that in your original description either. It's probably caused by the high quality redirect as well. As said, if you don't like it just remove it.

29. January 2009, 22:31:47 (edited)

alienyd

Posts: 18

Hi, I've just found this one http://userscripts.org/scripts/show/36453
Would you please combine it with yours to:
- remove elements on youtube page (mostly annoying!)
- keep the video centered, showed in a black screen
- remove auto jump-to middle page (from the above js), where the screen automatically jumps to the middle of the page, to auto vertically center the video area
Besides, how to resize video? I saw you mentioned but never manage to work it out:(
Oh yeah, also, I'd love to lock youtube page - disable scrolling (vertically) when the dark screen is on to always keep the video in sight, or maybe vice versa, let the video float at a relative position while the page is being scrolled, could you please show me how?!
Thanks

29. January 2009, 22:48:30

alienyd

Posts: 18

Aww:( so what about my other questions? Would you add them in the script, I mean YOUR script?

29. January 2009, 23:37:55

Moderator

larskl

~ moderator ~

Posts: 22500

the video is already centered on a black screen. due to the black screen removing of other elements isn't needed as you don't see them anyway. and it doesn't auto-jump anywhere. so nothing to add there

10. February 2009, 22:07:02

Opera Software

d.i.z.

bug hunter

Posts: 3029

Lars, you could do location.replace(url) instead of location.href=url to get rid of additional history entry.

14. February 2009, 17:56:23

Moderator

larskl

~ moderator ~

Posts: 22500

Updated to 1.5

Changelog:
* Easier to configure (all settings in the first few lines of the file)
* Options to disable redirects to high quality and international versions
* Option to disable auto-pause
* New button to toggle between 4:3 and 16:9 mode

Download: youtube_screen.js v1.5

20. February 2009, 07:47:36

scatbin

Posts: 119

youtube have once again changed their site and broken this amazing script

20. February 2009, 11:05:08

Moderator

larskl

~ moderator ~

Posts: 22500

Updated to 1.52

Changelog:
* Fix for the new Upload button
* Performance optimization
* Make sure that upload button failure doesn't halt script execution

Download: youtube_screen.js v1.52

20. February 2009, 16:49:04

Barthezdeleted

Banned user

There seems to be something wrong with the upload button hiding in new version (1.52), see for yourself:
opera_youtubescreen152bug.png

Non of the settings in script was changed. I wasn't logged in @ YouTube.

20. February 2009, 17:00:00

Moderator

larskl

~ moderator ~

Posts: 22500

Updated to 1.53

Changelog:
* Fixed the fix for the new Upload button

Download: youtube_screen.js v1.53

21. February 2009, 07:18:59

Barthezdeleted

Banned user

Great job larskl! up

It's working fine now smile

Forums » General Opera topics » User JavaScript