I developed a small plugin commonly known as bookmarklet . This result is almost satisfactory for my case, however, there is an empencilho. For me to start it I have to double click otherwise, it does not launch the player on the page. Since the entire function contains the dynamic mode elements, that is, it will be included at runtime in the HTML document.
My Bookmarklet
javascript:(function(){ var head=document.getElementsByTagName('head')[0]; var scriptA=document.createElement('script'); scriptA.setAttribute('type', "text/javascript"); scriptA.setAttribute('src', "http://releases.flowplayer.org/js/flowplayer-3.2.13.min.js"); head.appendChild(scriptA); var link=document.createElement('a'); link.setAttribute('class', "player"); link.setAttribute('id', "player"); link.setAttribute('href', "http://www.hdwplayer.com/videos/2012.mp4"); link.setAttribute('style', "display:block;width:1280px;height:720px;margin:10px auto"); document.getElementById('video').appendChild(link); var body=document.getElementsByTagName('body')[0]; var scriptB=document.createElement('script'); scriptB.setAttribute('type', "text/javascript"); scriptB.innerHTML='flowplayer("player", "http://releases.flowplayer.org/swf/flowplayer-3.2.18.swf")'; body.appendChild(scriptB); }())
Below is the structure of the HTML document, to perform Test (s) where plugin bookmarklet will apply the "flowplayer":
<html> <head> <title>Video</title> <style> #video { background-color: black; border: 1px solid red; width: 1280px; height: 720px; } </style> </head> <body> <center> <div id='video'></div> </center> </body> </html>
Summary
It does not appear to insert the html element (s) and / or script in the first insertion with just one click. This shows that only part of the function is included in the HTML page with a second click missing to complement the first one, thus making the insertion of the flowplayer. But why does this occur ???
I think something around
innerHTML
If I just clicked, the output in console displayed the following alert:
After clicking again, there is no alert in console . Everything flows normally.
Attention - FlowPlayer requires FlashPlayer.