Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <script type="text/javascript">
- function embedMOV(evt){
- // Check for video/quicktime plugin support
- if (!navigator.mimeTypes['video/quicktime']) return;
- // Derive target element
- var movLink = evt.target;
- // Build object
- var obj = document.createElement('object');
- obj.setAttribute('type', "video/quicktime");
- obj.setAttribute('data', movLink.href);
- obj.setAttribute('autoplay', 'true');
- obj.setAttribute('style', 'width:95%; height:90%; margin-left:auto; margin-right:auto;');
- // Write to the target frame
- if(window.parent != window.self){
- var w = window.parent.frames[movLink.target];
- var t = '<p>Video: <a href="' + movLink.href + '">' + movLink.href + '</a></p>';
- } else { // Not framed, write to this tab
- var w = window.self;
- var t = '<p>Index: <a href="' + location.href + '" target="_self">' + location.href + '</a></p>';
- }
- var b = w.document.body;
- b.innerHTML = t;
- b.insertBefore(obj, b.firstChild);
- // Cancel link navigation
- evt.preventDefault();
- evt.stopPropagation();
- return false;
- }
- function prepLinks(){
- // Find links to .mov files
- var movs = document.querySelectorAll('a[href*=".mov"], area[href*=".mov"]');
- // Add click handler to embed the plugin
- for (var i=0; i<movs.length; i++){
- movs[i].addEventListener('click', embedMOV, false);
- }
- }
- if (navigator.userAgent.indexOf('Firefox') > -1){
- window.addEventListener('load', prepLinks, false);
- }
- </script>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement