YouTube でリピート再生(ループ)させるブックマークレット

※ 現在は公式の右クリックメニューに「ループ再生」がある

↓をブックマークレットとして登録しておいて、YouTube の動画再生画面で実行すると、リピート再生(ループ)するモードに入る。

javascript:(function(){ if (location.href.match(/https?:\/\/www\.youtube\.com\/watch\?v=([^&]+)/)) { var url = "http://www.youtube.com/v/" + RegExp.$1 + "?version=3&loop=1&autoplay=1&playlist=" + RegExp.$1; console.dir("location.href=" + location.href + ", url=" + url); var html = '<html><head><style type="text/css">body { margin: 0; padding: 0; }</style></head><body><iframe id="ytplayer" type="text/html" width="100%" height="100%" src="' + url + '" frameborder="0" scrolling="0" /></body>'; top.location.href = 'data:text/html;charset=utf-8,'+encodeURIComponent(html); }})()


↓古い版

javascript:(function(){ if (location.href.match(/http:\/\/www\.youtube\.com\/watch\?v=([^&]+)/)) { var url = "http://youtube.googleapis.com/v/" + RegExp.$1 + "&loop=1&autoplay=1"; console.dir("location.href=" + location.href + ", url=" + url); var html = '<html><head><script type="text/javascript"><!--\n' + 'document.write(\'<meta http-equiv="refresh" content="0;url='+url+'">\');' + '// --><'+'/script></head><body></body></html>'; top.location.href = 'data:text/html;charset=utf-8,'+encodeURIComponent(html); }})()