Large

YouTube HD Ultimate

By Avindra V.G. Last update Dec 10, 2010 — Installed 401,935 times.

Loop

in
Subscribe to Loop 13 posts, 6 voices



DanyDanman Scriptwright

Is it possible to add a loop function to it ?

If so whit a button integration like in this script as you can see in the Screen Shots section.
http://userscripts.org/scripts/show/32861
Or if you install this script you will see Pop out text under video maybe you can place next to it and whit text Loop.
http://userscripts.org/scripts/show/11058

Dany

 
Avindra V.G. Script's Author

sorry, but what do you mean? To add a loop video option?

If you wanted that, I'd have to use the older YouTube player (the ugly one) or one that has a YouTube logo. Either way, its kinda stinky... Request this feature on YousableTubeFix. That has a collection of YouTube fixes.

This script is for people who like YouTube's layout, but want HD videos and highest quality without messing things up.

 
DanyDanman Scriptwright

Yeah but i see your point.

 
Avindra V.G. Script's Author

If you want, I can make a separate script for this option that's compatible with this script. You want that?

 
zornn User

I, for one, would like that! I tried your script together with http://userscripts.org/scripts/show/28832 but the two are not compatible. The loop script only works on normal quality videos anyway, but even when I set them to normal quality with your script, it doesn't loop, leading me to believe the two are not compatible...

 
Avindra V.G. Script's Author

Loop is implemented (not on-off in page though, must configure with text editor). Hmm.. maybe I should add a GUI for options.

 
zornn User

Thank you! It would be nice to have an on/off option on the page, yes.

 
Markus Schne... User

The script is brilliant but the loop is annoying. lol
It seems you can't please everyone.

 
f3tus User

Bumping for a button/text or something on the main page to enable/disable looping. Center of the watch-ratings-views div or over/under "Download this video as" would be nice. :D

 
DanyDanman Scriptwright

I for got about this topic reg.
I thank you for adding loop function.
A on/off link/button would be nice.

 
zornn User

For an on/off option on the page change

handleWatchPagePlayerStateChange=function(state) {
 if (state == 0) {
   if(loop) {
    player.seekTo(0,true);
    player.playVideo();
   } 
   if (watchIsPlayingAll) {
    gotoNext();
   }
 }
};
player.addEventListener("onStateChange","handleWatchPagePlayerStateChange");

to

handleWatchPagePlayerStateChange=function(state) {
 if (state == 0) {
   if(loop) {
    player.seekTo(0,true);
    player.playVideo();
   }
	else {
	 player.clearVideo();
		if (watchIsPlayingAll) {
		gotoNext(); }
	}
 }
};
player.addEventListener("onStateChange","handleWatchPagePlayerStateChange");

And then add this in the function showDownloads() at the beginning

function toggle_loop(e)
  {
    if (loop)
      {
        loop=false;
        e.target.firstChild.nodeValue = 'Loop=Off ';
		looping();
      }
    else
      {
        loop=true;
        e.target.firstChild.nodeValue = 'Loop=On ';
		looping();
      }
  }
  
function looping() {
handleWatchPagePlayerStateChange=function(state) {
 if (state == 0) {
   if(loop) {
    player.seekTo(0,true);
    player.playVideo();
   }
	else {
	 player.clearVideo();
		if (watchIsPlayingAll) {
		gotoNext(); }
	}
 }
};
player.addEventListener("onStateChange","handleWatchPagePlayerStateChange");
}

 var link = document.createElement('a');
 
  if (loop)
    var text = document.createTextNode('Loop=On ');
  else
    var text = document.createTextNode('Loop=Off ');	
  
    link.appendChild(text);
    link.setAttribute("href", "#watch-vid-title");
    link.addEventListener("click", toggle_loop, false);

And then add block.appendChild(link); before block.appendChild(document.createTextNode("Download this video as: "));

That's how I implemented it. I bet someone will find something wrong/redundant with it, because, well, I can't code in JS, but I gave it a shot and it does work. Can someone make it so that the text colour is red when off and green when on? I don't know how...

Edit: playlists now autoplay normally if loop is turned off.

 
qwertgb1 User

The loop function is broken I think. Can someone confirm this?

I also tried x0rnn's tweak but I couldn't make it work.

 
zornn User

Works fine for me.

Cross
Presentational HTML allowed.
Use <code> for inline code and <pre> for code blocks. Use &lt; and &gt; for literal < and >.
We help break paragraphs and link your links.
or cancel