/**
* $Id: editor_plugin_src.js 126 2006-10-22 16:19:55Z spocke $
*
* @author Moxiecode
* @copyright Copyright © 2004-2006, Moxiecode Systems AB, All rights reserved.
*/
/* Import plugin specific language pack */
tinyMCE.importPluginLanguagePack('media');
var TinyMCE_MediaPlugin = {
getInfo : function() {
return {
longname : 'Media',
author : 'Moxiecode Systems AB',
authorurl : 'http://tinymce.moxiecode.com',
infourl : 'http://tinymce.moxiecode.com/tinymce/docs/plugin_media.html',
version : tinyMCE.majorVersion + "." + tinyMCE.minorVersion
};
},
initInstance : function(inst) {
if (!tinyMCE.settings['media_skip_plugin_css'])
tinyMCE.importCSS(inst.getDoc(), tinyMCE.baseURL + "/plugins/media/css/content.css");
},
getControlHTML : function(cn) {
switch (cn) {
case "media":
return tinyMCE.getButtonHTML(cn, 'lang_media_desc', '{$pluginurl}/images/media.gif', 'mceMedia');
}
return "";
},
execCommand : function(editor_id, element, command, user_interface, value) {
// Handle commands
switch (command) {
case "mceMedia":
tinyMCE.openWindow({
file : '../../plugins/media/media.htm',
width : 430 + tinyMCE.getLang('lang_media_delta_width', 0),
height : 470 + tinyMCE.getLang('lang_media_delta_height', 0)
}, {
editor_id : editor_id,
inline : "yes"
});
return true;
}
// Pass to next handler in chain
return false;
},
cleanup : function(type, content, inst) {
var nl, img, i, ne, d, s, ci;
switch (type) {
case "insert_to_editor":
img = tinyMCE.getParam("theme_href") + '/images/spacer.gif';
content = content.replace(/';
}
// Insert embed/object chunk
chunkBefore = content.substring(0, startPos);
chunkAfter = content.substring(endPos);
content = chunkBefore + embedHTML + chunkAfter;
}
break;
}
return content;
},
handleNodeChange : function(editor_id, node, undo_index, undo_levels, visual_aid, any_selection) {
if (node == null)
return;
do {
if (node.nodeName == "IMG" && /mceItem(Flash|ShockWave|WindowsMedia|QuickTime|RealMedia)/.test(tinyMCE.getAttrib(node, 'class'))) {
tinyMCE.switchClass(editor_id + '_media', 'mceButtonSelected');
return true;
}
} while ((node = node.parentNode));
tinyMCE.switchClass(editor_id + '_media', 'mceButtonNormal');
return true;
},
_createImgFromEmbed : function(n, d, cl) {
var ne, at, i, ti = '', an;
ne = d.createElement('img');
ne.src = tinyMCE.getParam("theme_href") + '/images/spacer.gif';
ne.width = tinyMCE.getAttrib(n, 'width');
ne.height = tinyMCE.getAttrib(n, 'height');
ne.className = cl;
at = n.attributes;
for (i=0; i 0 ? ti.substring(0, ti.length - 1) : ti;
ne.title = ti;
n.parentNode.replaceChild(ne, n);
},
_createImg : function(cl, d, n) {
var i, nl, ti = "", an, av, al = new Array();
ne = d.createElement('img');
ne.src = tinyMCE.getParam("theme_href") + '/images/spacer.gif';
ne.width = tinyMCE.getAttrib(n, 'width');
ne.height = tinyMCE.getAttrib(n, 'height');
ne.className = cl;
al.id = tinyMCE.getAttrib(n, 'id');
al.name = tinyMCE.getAttrib(n, 'name');
al.width = tinyMCE.getAttrib(n, 'width');
al.height = tinyMCE.getAttrib(n, 'height');
al.bgcolor = tinyMCE.getAttrib(n, 'bgcolor');
al.align = tinyMCE.getAttrib(n, 'align');
al.class_name = tinyMCE.getAttrib(n, 'mce_class');
nl = n.getElementsByTagName('div');
for (i=0; i 0 ? ti.substring(0, ti.length - 1) : ti;
ne.title = ti;
return ne;
},
_getEmbed : function(cls, cb, mt, p, at) {
var h = '', n;
p.width = at.width ? at.width : p.width;
p.height = at.height ? at.height : p.height;
h += '';
return h;
},
_parseAttributes : function(attribute_string) {
var attributeName = "";
var attributeValue = "";
var withInName;
var withInValue;
var attributes = new Array();
var whiteSpaceRegExp = new RegExp('^[ \n\r\t]+', 'g');
if (attribute_string == null || attribute_string.length < 2)
return null;
withInName = withInValue = false;
for (var i=0; i