SHOW:
|
|
- or go back to the newest paste.
1 | <script type="text/javascript"> | |
2 | function embedMOV(evt){ | |
3 | // Check for video/quicktime plugin support | |
4 | if (!navigator.mimeTypes['video/quicktime']) return; | |
5 | // Derive target element | |
6 | var movLink = evt.target; | |
7 | // Build object | |
8 | var obj = document.createElement('object'); | |
9 | obj.setAttribute('type', "video/quicktime"); | |
10 | obj.setAttribute('data', movLink.href); | |
11 | obj.setAttribute('autoplay', 'true'); | |
12 | - | obj.setAttribute('style', 'width:95%; height:95%; margin-left:auto; margin-right:auto;'); |
12 | + | obj.setAttribute('style', 'width:95%; height:90%; margin-left:auto; margin-right:auto;'); |
13 | // Write to the target frame | |
14 | - | var w = window.frames[movLink.target]; |
14 | + | if(window.parent != window.self){ |
15 | var w = window.parent.frames[movLink.target]; | |
16 | - | b.innerHTML = '<p><a href="' + movLink.href + '">' + movLink.href + '</a></p>'; |
16 | + | var t = '<p>Video: <a href="' + movLink.href + '">' + movLink.href + '</a></p>'; |
17 | } else { // Not framed, write to this tab | |
18 | var w = window.self; | |
19 | var t = '<p>Index: <a href="' + location.href + '" target="_self">' + location.href + '</a></p>'; | |
20 | } | |
21 | var b = w.document.body; | |
22 | b.innerHTML = t; | |
23 | b.insertBefore(obj, b.firstChild); | |
24 | // Cancel link navigation | |
25 | evt.preventDefault(); | |
26 | evt.stopPropagation(); | |
27 | return false; | |
28 | } | |
29 | function prepLinks(){ | |
30 | // Find links to .mov files | |
31 | var movs = document.querySelectorAll('a[href*=".mov"], area[href*=".mov"]'); | |
32 | // Add click handler to embed the plugin | |
33 | for (var i=0; i<movs.length; i++){ | |
34 | movs[i].addEventListener('click', embedMOV, false); | |
35 | } | |
36 | } | |
37 | if (navigator.userAgent.indexOf('Firefox') > -1){ | |
38 | window.addEventListener('load', prepLinks, false); | |
39 | } | |
40 | </script> |