|
(→Actualizar Acumulados del Empleado)
|
(→Actualizar Acumulados del Empleado)
|
| Line 8: | |||
| ---- | ---- | ||
| - | <div class="youtube" id="fsrJWUVoXeM"></div> | + | <div id="video"></div> |
| + | <script> | ||
| + | var container = document.getElementById("video"); | ||
| + | var frame = document.createElement("iframe"); | ||
| + | frame.style.width = "600px"; | ||
| + | frame.style.height = "400px"; | ||
| - | <script> | + | frame.onload = function () { |
| - | + | if (frame.contentDocument) { | |
| - | function r(f){/in/.test(document.readyState)?setTimeout('r('+f+')',9):f()} | + | var fdoc = frame.contentDocument; |
| - | r(function(){ | + | var vframe = fdoc.createElement("iframe"); |
| - | if (!document.getElementsByClassName) { | ||
| - | // IE8 support | ||
| - | var getElementsByClassName = function(node, classname) { | ||
| - | var a = []; | ||
| - | var re = new RegExp('(^| )'+classname+'( |$)'); | ||
| - | var els = node.getElementsByTagName("*"); | ||
| - | for(var i=0,j=els.length; i<j; i++) | ||
| - | if(re.test(els[i].className))a.push(els[i]); | ||
| - | return a; | ||
| - | } | ||
| - | var videos = getElementsByClassName(document.body,"youtube"); | ||
| - | } else { | ||
| - | var videos = document.getElementsByClassName("youtube"); | ||
| - | } | ||
| - | var nb_videos = videos.length; | + | vframe.src = "https://www.youtube.com/embed/NEIwl93Yr8o"; |
| - | for (var i=0; i<nb_videos; i++) { | + | vframe.setAttribute("frameborder", "0"); |
| - | // Based on the YouTube ID, we can easily find the thumbnail image | + | vframe.setAttribute("allowfullscreen", ""); |
| - | videos[i].style.backgroundImage = 'url(http://i.ytimg.com/vi/' + videos[i].id + '/sddefault.jpg)'; | + | vframe.style.width = "500px"; |
| + | vframe.style.height = "281px"; | ||
| - | // Overlay the Play icon to make it look like a video player | + | fdoc.body.appendChild(vframe); |
| - | var play = document.createElement("div"); | + | } |
| - | play.setAttribute("class","play"); | + | } |
| - | videos[i].appendChild(play); | + | container.appendChild(frame); |
| - | videos[i].onclick = function() { | ||
| - | // Create an iFrame with autoplay set to true | ||
| - | var iframe = document.createElement("iframe"); | ||
| - | var iframe_url = "https://www.youtube.com/embed/" + this.id + "?autoplay=1&autohide=1"; | ||
| - | if (this.getAttribute("data-params")) iframe_url+='&'+this.getAttribute("data-params"); | ||
| - | iframe.setAttribute("src",iframe_url); | ||
| - | iframe.setAttribute("frameborder",'0'); | ||
| - | // The height and width of the iFrame should be the same as parent | ||
| - | iframe.style.width = this.style.width; | ||
| - | iframe.style.height = this.style.height; | ||
| - | // Replace the YouTube thumbnail with YouTube Player | ||
| - | this.parentNode.replaceChild(iframe, this); | ||
| - | } | ||
| - | } | ||
| - | }); | ||
| </script> | </script> | ||