Hello all newb here
I'm working on a plugin and I'm wondering how I can run javascript on the content of the editor
nuts and bolts I want to use swfobject i got it to write the code to the editor but I want the user to be able to see the results of the embed.
HERE is my code so far
I'm working on a plugin and I'm wondering how I can run javascript on the content of the editor
nuts and bolts I want to use swfobject i got it to write the code to the editor but I want the user to be able to see the results of the embed.
HERE is my code so far
(function() {
CKEDITOR.dialog.add( 'youtube', function( editor ) {
var count = 0;
return {
title : editor.lang.youtube.title,
resizable : CKEDITOR.DIALOG_RESIZE_BOTH,
minWidth : 200,
minHeight : 100,
onShow : function() {
},
onOk : function() {
var yt_id = this.getValueOf("youtube","youtube_id");
var ytplayer = "ytapiplayer"+ count
var theurl = "" // the url would go here
var yt =
'var params = { allowScriptAccess: "always", wmode: "transparent" };'+
'var atts = { id: "myytplayer" };'+
'swfobject.embedSWF(theurl, null, null, params, atts);';
var yt_box =
'<div id="ytapiplayer'+count+'">'+
'<p><!--googleoff: all-->You need Flash Player 8 or higher and javascript enabled or an iPhone or iPod Touch to view this video.<!--googleon: all--></p>'+
'</div>';
this._.editor.insertHtml('<script type="text/javascript">' + yt + '</script>' + yt_box);
CKEDITOR.scriptLoader.load( '/path/to/swfobject.js', function( success ) {
CKEDITOR.scriptLoader.loadCode( 'var params = { allowScriptAccess: "always", wmode: "transparent" };'+
'var atts = { id: "myytplayer" };'+
'swfobject.embedSWF(theurl,"'+ytplayer+'", "689", "400", "8", null, null, params, atts);' );
});
},
onCancel : function() {
},
contents : [
{
id : 'youtube',
label : 'YouTube ID',
title : 'YouTube ID',
accessKey : 'Y',
elements : [
{
type : 'text',
label : 'YouTube ID',
id : 'youtube_id',
'default' : 'replace with youtube id'
}
]
}
]
};
});
})();