Large

YouTube HD Ultimate

By Avindra V.G. Last update Dec 10, 2010 — Installed 402,063 times.

[REQ] add loop settings under player

in
Subscribe to [REQ] add loop settings under player 2 posts, 2 voices



V@no Scriptwright

Hi!
Here is another request for your consideration:
Add loop toggle button under player, with immediate, but with temporary effect.
What I mean is when this loop button pressed only current video will be affected, refreshing the page will use loop from the settings.

Thanks.

 
zornn User

Add:

var link = document.createElement('a'),
	font = document.createElement('font');
	
	if(opts.loop) {
	var text = document.createTextNode('Loop=On');
	font.setAttribute('color', '#008000');
	}
	else {
	var text = document.createTextNode('Loop=Off');
	font.setAttribute('color', '#ff0000');
	}
	
	font.appendChild(text);
	link.appendChild(font);
	link.setAttribute("href", "javascript:void(0)");
      link.setAttribute("onclick", "document.getElementById('watch-vid-title').scrollIntoView(true)");
      link.addEventListener("click", toggle_loop, false);
	
function toggle_loop(e)
{
    if (opts.loop)
      {
        opts.loop=false;
        e.target.firstChild.nodeValue = 'Loop=Off';
		font.setAttribute('color', '#ff0000');
      }
    else
      {
        opts.loop=true;
        e.target.firstChild.nodeValue = 'Loop=On';
		font.setAttribute('color', '#008000');
      }
}

before var downloads={"3gp":"17", mp4:"18"}; and then add block.appendChild(link); before block.appendChild(document.createTextNode("Download this video as: ")); Also add a space before " Download this video as"

Also, if you change:

		if (state == 0) {
			if (unsafeWindow.watchIsPlayingAll) {
				unsafeWindow.gotoNext();
			} else if(opts.loop) {
				player.seekTo(0, true);
				player.playVideo();
			}
			return;
		}

to
		if (state == 0) {
			if (opts.loop) {
				player.seekTo(0, true);
				player.playVideo();
				}
			else {
				player.clearVideo();
				if (unsafeWindow.watchIsPlayingAll) {
					unsafeWindow.gotoNext();
					}
				}
			return;
		}

You'll loop a video in a playlist even if you have clicked "Play All" which automatically goes to the next video in a playlist when one finishes. I forget to click on "Stop Autoplaying" sometimes and even though I chose to loop the current video, it goes to the next one when it finishes.

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