/*
* Media Plugin for FCKeditor 2.5 SVN
* Copyright (C) 2007 Riceball LEE (riceballl@hotmail.com)
*
* == BEGIN LICENSE ==
*
* Licensed under the terms of any of the following licenses at your
* choice:
*
* - GNU General Public License Version 2 or later (the "GPL")
* http://www.gnu.org/licenses/gpl.html
*
* - GNU Lesser General Public License Version 2.1 or later (the "LGPL")
* http://www.gnu.org/licenses/lgpl.html
*
* - Mozilla Public License Version 1.1 or later (the "MPL")
* http://www.mozilla.org/MPL/MPL-1.1.html
*
* == END LICENSE ==
*
* Plugin to insert "Media" in the editor.
*/
// Register the related command.
FCKCommands.RegisterCommand( 'Media', new FCKDialogCommand( 'Media', FCKLang.DlgMediaTitle, FCKPlugins.Items['Media'].Path + 'fck_media.html', 450, 428 ) ) ;
// Create the "Media" toolbar button.
var oMediaItem = new FCKToolbarButton( 'Media', FCKLang.MediaBtn, FCKLang.MediaBtnTooltip) ;
oMediaItem.IconPath = FCKPlugins.Items['Media'].Path + 'images/media.gif' ;
FCKToolbarItems.RegisterItem( 'Media', oMediaItem ) ;
//--------------------------------------------------
function _Import(aSrc) {
//document.write('');
var vElement = document.createElement("script");
vElement.type= "text/javascript";
vElement.src= aSrc;
var head=document.getElementsByTagName("head")[0];
head.appendChild(vElement);
};
function _ImportCSS(aSrc) {
var vElement = document.createElement("link");
vElement.rel = "stylesheet";
vElement.type = "text/css";
vElement.href = aSrc;
//vElement.title= 'ddd';
//vElement.disabled=false;
var head=document.getElementsByTagName("head")[0];
head.appendChild(vElement);
};
_Import(FCKPlugins.Items['Media'].Path + 'js/fck_media_inc.js');
var FCKMediaProcessor = FCKDocumentProcessor.AppendNew() ;
//hack to add the media css to FCKEditingArea.
FCKMediaProcessor.EditingArea_StartBefore = function ( html, secondCall )
{
var sHeadExtra = '' ;
html = html.replace( FCKRegexLib.HeadCloser, sHeadExtra + '$&' ) ;
return arguments;
}
FCKEditingArea.prototype.Start = Inject(FCKEditingArea.prototype.Start, FCKMediaProcessor.EditingArea_StartBefore);
//hack and rewrite FCKConfig.ProtectedSource.Protect, for i do not wanna walk through twice.
FCKConfig.ProtectedSource.Protect = function( html )
{
var codeTag = this._CodeTag ;
function _Replace( protectedSource )
{
//check if it is the media object:
if (protectedSource.match(/