'+ ''+ ''+ ''+ '' ]; html[ 1] = button_color; html[ 3] = button_color; html[ 5] = button_color; html[ 7] = button_color; html[ 9] = button_color; html[11] = provider_url; html[13] = provider_name; html[15] = url; html[17] = url; html[19] = settings[0] ? ' checked' : ''; html[21] = settings[1] ? ' checked' : ''; html[23] = iframes.length; html[25] = iframes.length; html[27] = src; html[29] = data_convert; html[31] = api; html[33] = background_img; }; var createOembed = function(api, url) { return api+encodeURIComponent(url); }; // var createNOembed = function(api, url) { return createOembed("https://noembed.com/embed?url=", url); }; var createJOembed = function(api, url) { return createOembed("https://json2jsonp.com/?url=", createOembed(api, url)); }; var createLazyVideo = function(elem) { var id, args = "", url, src = a.href = elem.src || elem.data || elem.dataset.src; if(!a.hostname || elem.dataset.lazyVideo) return; elem.dataset.lazyVideo = 1; switch(a.hostname.match(/([^.]+)\.[^.]+$/)[1]) { case "youtube" : case "youtube-nocookie" : if(/\/(?:p\/|embed\/videoseries)([^&]*)/i.test(a.pathname)) { id = RegExp.$1 || (/[?&]list=([^&]+)/i.test(a.search) && RegExp.$1); if(!id || (settings[0] && a.search.includes("autoplay=1"))) return; if(/[?&](v=[^&]+)/i.test(a.search)) args += "&"+RegExp.$1; if(/[?&](index=[^&]+)/i.test(a.search)) args += "&"+RegExp.$1; if(/[?&](start=[^&]+)/i.test(a.search)) args += "&"+RegExp.$1; createHtml( url = /[?&]v=([^&]+)/i.test(a.search) ? "https://www.youtube.com/watch?list="+id+args : "https://www.youtube.com/playlist?list="+id, src = "https://www.youtube-nocookie.com/embed/videoseries?autoplay=1&list="+id+args, "https://www.googleapis.com/youtube/v3/playlists?part=snippet&fields=items/snippet(channelId,title,thumbnails,channelTitle)&key=AIzaSyDLowtdhRBblJhyDhtiPaIbwRKT_PSyHWE&id="+id, /[?&]v=([^&]+)/i.test(a.search) ? "url(https://i.ytimg.com/vi/"+RegExp.$1+"/hqdefault.jpg)" : null ); } else { if(/\/(?:v|embed)\/([^&]*)/i.test(a.pathname)) id = RegExp.$1 || (/[?&]v=([^&]+)/i.test(a.search) && RegExp.$1); if(!id || (settings[0] && a.search.includes("autoplay=1"))) return; if(/[?&](start=[^&]+)/i.test(a.search)) args += "&"+RegExp.$1; createHtml( url = "https://www.youtube.com/watch?v="+id+args, src = "https://www.youtube-nocookie.com/embed/"+id+"?autoplay=1"+args, // createNOembed("https://www.youtube.com/oembed?format=json&url=", url), "https://www.googleapis.com/youtube/v3/videos?part=snippet,contentDetails&fields=items(snippet(channelId,title,thumbnails,channelTitle),contentDetails/duration)&key=AIzaSyDLowtdhRBblJhyDhtiPaIbwRKT_PSyHWE&id="+id, "url(https://i.ytimg.com/vi/"+id+"/hqdefault.jpg)" ); } break; case "dailymotion" : if(/\/(?:swf|embed)\/(?:video\/)?([^&_]+)/i.test(a.pathname)) id = RegExp.$1; if(!id || (settings[0] && a.search.includes("autoplay=1"))) return; // if(/[?&](mute=[^&]+)/i.test(a.search)) args += "&"+RegExp.$1; if(/[?&](start=[^&]+)/i.test(a.search)) args += "&"+RegExp.$1; createHtml( url = "https://www.dailymotion.com/video/"+id+"?"+args, src = "https://www.dailymotion.com/embed/video/"+id+"?autoplay=1"+args, // createOembed("https://www.dailymotion.com/services/oembed?format=json&url=", url), "https://api.dailymotion.com/video/"+id+"?fields=owner.screenname,owner.url,title,url,duration,thumbnail_url", "url(https://www.dailymotion.com/thumbnail/video/"+id+")" ); break; case "vimeo" : if(/\/(?:moogaloop\.swf|video\/)([^&]*)/i.test(a.pathname)) id = RegExp.$1 || (/[?&]clip_id=([^&]+)/i.test(a.search) && RegExp.$1); if(!id || (settings[0] && a.search.includes("autoplay=1"))) return; if(/[?&](loop=[^&]+)/i.test(a.search)) args += "&"+RegExp.$1; if(/(\#t=[\dhms]+)/i.test(a.hash)) args += RegExp.$1; createHtml( url = "https://vimeo.com/"+id+"?"+args, src = "https://player.vimeo.com/video/"+id+"?autoplay=1"+args, createOembed("https://vimeo.com/api/oembed.json?url=", url) ); break; case "rutube" : if(/(?:\/play)?\/embed\/([^&.\/]+)/i.test(a.pathname)) id = RegExp.$1; else if(/[?&]pl_video=([^&]+)/i.test(a.search)) id = RegExp.$1; if(!id || (settings[0] && a.search.includes("autoStart=1"))) return; if(/[?&](bmstart=[^&]+)/i.test(a.search)) args += "&"+RegExp.$1; createHtml( url = "https://rutube.ru/"+(isNaN(id) ? "video/"+id+"/" : "tracks/"+id+".html"), src = "https://rutube.ru/"+(a.pathname.includes("/embed/") ? "play/embed/"+id+"?autoStart=1"+args : "pl/?pl_video="+id), createJOembed("https://rutube.ru/api/oembed/?format=json&url=", url) ); break; case "twitch" : if(/[?&](channel|video)=([^&]+)/i.test(a.search)) {args = RegExp.$1; id = RegExp.$2;} else if(/[?&](stream=.+&channelId)=([^&]+)/i.test(a.search)) {args = RegExp.$1; id = RegExp.$2;} else if(/\/(.+)\/embed/i.test(a.pathname)) {args = "channel"; id = RegExp.$1;} if(!id || (settings[0] && a.search.includes("autoplay=true"))) return; createHtml( url = "https://www.twitch.tv/"+(args=="video" ? id.replace("v","c/v/") : args=="channel" ? id : args.replace("stream=", "streams/").replace("&channelId", "/channel/")+id), src = "https://player.twitch.tv/?autoplay=true&"+args+"="+id+"&parent="+location.hostname, "https://api.twitch.tv/kraken/{api}?client_id=du8sn5luinquldpeh4e2hy8le87fdo&api_version=5", args=="channel" ? "url(https://static-cdn.jtvnw.net/previews-ttv/live_user_"+id+"-0x0.jpg)" : null ); break; case "ustream" : if(/(?:\/embed)?\/(channel\/|recorded\/)?([^&]+)/i.test(a.pathname)) {args = RegExp.$1 || "channel/"; id = RegExp.$2;} if(!id || (settings[0] && a.search.includes("autoplay=1"))) return; createHtml( url = "https://www.ustream.tv/"+args+id, src = "https://www.ustream.tv/embed/"+(args=="channel/" ? "" : args)+id+"?html5ui=1&autoplay=1", createJOembed("https://www.ustream.tv/oembed?format=json&url=", url), args=="channel/" && !isNaN(id) ? "url(https://static-cdn1.ustream.tv/i/channel/live/1_"+id+",640x360,b:0.jpg)" : null ); break; case "coub" : if(/\/embed\/([^&]+)/i.test(a.pathname)) id = RegExp.$1; if(!id || (settings[0] && a.search.includes("autostart=true"))) return; createHtml( url = "https://coub.com/view/"+id, src = "https://coub.com/embed/"+id+"?startWithHD=true&autostart=true", createJOembed("https://coub.com/api/oembed.json?url=", url) ); break; case "vine" : if(/\/v\/([^&]+)\/embed\/([^&]+)/i.test(a.pathname)) {args = RegExp.$2; id = RegExp.$1;} if(!id) return; createHtml( url = "https://vine.co/v/"+id, src = "https://vine.co/v/"+id+"/embed/"+args+"?audio=1", createOembed("https://vine.co/oembed.json?url=", url) ); break; case "facebook" : if(a.pathname.endsWith("/plugins/video.php") && /[?&]href=([^&]+)/i.test(a.search)) { url = location.protocol+decodeURIComponent(RegExp.$1).replace(/^[a-z]+:/i, ''); if(/\/videos.*?\/(\d+)/i.test(url)) id = RegExp.$1; } if(!id || (settings[0] && a.search.includes("autoplay=1"))) return; createHtml( url, src = "https://www.facebook.com/plugins/video.php?autoplay=1&href="+encodeURIComponent(url), createOembed("https://www.facebook.com/plugins/video/oembed.json/?url=", url), "url(https://graph.facebook.com/"+id+"/picture)" ); break; default : return; } if(elem.tagName != "IFRAME") { if(elem.parentNode.tagName == "OBJECT") elem = elem.parentNode; var iframe = document.createElement("IFRAME"); iframe.src = src; iframe.id = elem.id; iframe.name = elem.name; iframe.className = elem.className; iframe.style.cssText = elem.style.cssText; iframe.width = elem.width; iframe.height = elem.height; iframe.frameBorder = elem.border; iframe.align = elem.align; elem.parentNode.replaceChild(iframe, elem); elem = iframe; } elem.dataset.lazyVideo = 2; elem.allowFullscreen = true; elem.srcdoc = html.join(""); iframes.push(elem); setTimeout(function() { if(elem.dataset.lazyVideo != 3) elem.removeAttribute("srcdoc"); }, 15000); }; var observer, animation; var update = function() { if(!document.body) { animation = requestAnimationFrame(update); } else if(!observer) { observer = new MutationObserver(function() { if(!animation) animation = requestAnimationFrame(update); }); observer.observe(document.body, {childList: true, attributes: false, characterData: false, subtree: true}); animation = requestAnimationFrame(update); } else { var nodes = document.querySelectorAll(settings[1] ? "IFRAME, EMBED, OBJECT" : "IFRAME"); for(var i = 0; i < nodes.length; i++) createLazyVideo(nodes[i]); animation = null; } }; update(); })(); }); suite.on('start', pageController.onStartHandler); suite.on('cycle', pageController.onCycleHandler); suite.on('abort', pageController.onAbortHandler); suite.on('error', pageController.onErrorHandler); suite.on('reset', pageController.onResetHandler); suite.on('complete', pageController.onCompleteHandler); suite.run({ 'async': true });