I'm attempting to write a YouTube plugin for 2.6+. I've gotten it functioning perfectly well in FF, but of course, IE is being problematic. I simply can't get it to handle the EMBED and PARAM tags appropriately. I want to create a fake IMG in the editor, tied to the actual OBJECT in the EditorDocument. Here's the pertinent code from my Ok function:
function Ok() { // Just a sample of the YouTube video ID that is entered into the dialog via the embed code or url var videoId = 'RXJKdh1KZ0w'; oEditor.FCKUndo.SaveUndoStep(); var toInsert = ''; toInsert += '<param name="movie" value="http://www.youtube.com/v/' + videoId + '&hl=en"></param>'; toInsert += '<param name="wmode" value="transparent"></param>'; toInsert += '<embed src="http://www.youtube.com/v/' + videoId + '&hl=en" type="application/x-shockwave-flash" wmode="transparent" width="425" height="355"></embed>'; if (!oObject) { oObject = FCK.EditorDocument.createElement('OBJECT'); oObject.innerHTML = toInsert; oFakeImage = null; } if (!oFakeImage) { oFakeImage = oEditor.FCKDocumentProcessor_CreateFakeImage('FCK__UnknownObject', oObject); oFakeImage.style.height = '355'; oFakeImage.style.width = '425'; oFakeImage.style.border = '1px solid black'; oFakeImage.style.background = 'center center url("' + FCK.Plugins.Items['youtube'].Path + 'youtube_logo.png' + '") no-repeat'; oFakeImage = FCK.InsertElement(oFakeImage); } return true; }
The issue is IE doesn't seem to allow the innerHTML call on the newly created OBJECT. What are the appropriate FCK methods to use in order to get this done?
Utilizing the DOM methods like this, also fails:
var param1 = FCK.EditorDocument.createElement('PARAM'); SetAttribute(param1, "name", "movie"); SetAttribute(param1, "value", "http://www.youtube.com/v/" + videoId + "&hl=en"); var param2 = FCK.EditorDocument.createElement('PARAM'); SetAttribute(param2, "name", "wmode"); SetAttribute(param2, "value", "transparent"); var embed = FCK.EditorDocument.createElement('EMBED'); SetAttribute(embed, "src", "http://www.youtube.com/v/" + videoId + "&hl=en"); SetAttribute(embed, "type", "application/x-shockwave-flash"); SetAttribute(embed, "wmode", "transparent"); SetAttribute(embed, "width", 425); SetAttribute(embed, "height", 355); el.appendChild(param1); el.appendChild(param2); el.appendChild(embed);
IE bails on the last appendChild (for the EMBED). I've also tried FCK's InsertElement and InsertHtml methods, but can't get that to work either. Are there appropriate methods to use with the EditorDocument?
If anyone could offer suggestions, I'd really appreciate it. I, of course, plan on making this plugin publicly available as soon as it's functional.
Thanks in advance for any help.
-TeddyG
Re: [Plugin] YouTube plugin problems with IE
Based on that idea, and the need to use this plugin for the flash objects that are in reality movies (instead of being handled by the default flash command), my idea about this kind of plugin was to generate a script block that with the help of SwfObject inserts the code and with a comment it's easy to recognize that the code is related to this plugin (see the GoogleMaps plugin).
Re: [Plugin] YouTube plugin problems with IE
Have you been able to make this plugin work? Is it available anywhere?
Re: [Plugin] YouTube plugin problems with IE
Thanks again for your help and suggestions.
Re: [Plugin] YouTube plugin problems with IE
Hey Teddy,
Any luck and/or desire to post what you've gotten working?
(Of course, would be great if, like another WYSWYG there were simply a button we could add to add YouTube... But, I digress.)
Re: [Plugin] YouTube plugin problems with IE
Re: [Plugin] YouTube plugin problems with IE
No problem, I completely understand. In fact it's been a long time since I've been back as well! As for the embed, you're right - it works great. Unfortunately, my users don't quite get source code and a wrapper would be wonderful - if anyone would like to take on the challenge?
Re: [Plugin] YouTube plugin problems with IE
Re: [Plugin] YouTube plugin problems with IE
There's already this project: http://sourceforge.net/projects/youtubepluginfo/ (I don't know why they haven't added it to the plugins tracker) and this one is a generic dialog to insert html http://sourceforge.net/tracker/index.ph ... tid=737639