///import core ///import plugins/inserthtml.js ///commands 视频 ///commandsName InsertVideo ///commandsTitle 插入视频 ///commandsDialog dialogs\video UE.plugins['video'] = function (){ var me =this, div; /** * 创建插入视频字符窜 * @param url 视频地址 * @param width 视频宽度 * @param height 视频高度 * @param align 视频对齐 * @param toEmbed 是否以flash代替显示 * @param addParagraph 是否需要添加P 标签 */ function creatInsertStr(url,width,height,align,toEmbed,addParagraph){ return !toEmbed ? (addParagraph? ('

'): '') + '' + (addParagraph?'

':'') : ''; } function switchImgAndEmbed(img2embed){ var tmpdiv, nodes =domUtils.getElementsByTagName(me.document, !img2embed ? "embed" : "img"); for(var i=0,node;node = nodes[i++];){ if(node.className!="edui-faked-video"){ continue; } tmpdiv = me.document.createElement("div"); //先看float在看align,浮动有的是时候是在float上定义的 var align = domUtils.getComputedStyle(node,'float'); align = align == 'none' ? (node.getAttribute('align') || '') : align; tmpdiv.innerHTML = creatInsertStr(img2embed ? node.getAttribute("_url"):node.getAttribute("src"),node.width,node.height,align,img2embed); node.parentNode.replaceChild(tmpdiv.firstChild,node); } } me.addListener("beforegetcontent",function(){ switchImgAndEmbed(true); }); me.addListener('aftersetcontent',function(){ switchImgAndEmbed(false); }); me.addListener('aftergetcontent',function(cmdName){ if(cmdName == 'aftergetcontent' && me.queryCommandState('source')){ return; } switchImgAndEmbed(false); }); me.commands["insertvideo"] = { execCommand: function (cmd, videoObjs){ videoObjs = utils.isArray(videoObjs)?videoObjs:[videoObjs]; var html = []; for(var i=0,vi,len = videoObjs.length;i