Discuz!官方免费开源建站系统

 找回密码
 立即注册

QQ登录

只需一步,快速开始

搜索

[求助] 日记支持youtube引用

[复制链接]
watchina 发表于 2010-9-1 15:57:08 | 显示全部楼层 |阅读模式
找到editor_base.js,替换以下函数,测试完毕,写的比较匆忙,有啥错误,包涵:效果如下:http://uchome.watchina.net/space-363-do-blog-id-435.html

下次写如何在编辑器里增加删除线。

function createFlash(e, show) {
/**
* 视频FLASH(支持youtube引用)
* by www.watchina.net
*/


if(typeof show == 'undefined') {

var flashtag = '';

var vObj = $('videoUrl');

var sFlash = vObj.value;

if ((sFlash!=null) && (sFlash!="http://")){

setCaret();

var sFlashType = $('vtype').value;

if(sFlashType==1) {

flashtag = '[flash=media]';

} else if(sFlashType==2) {

flashtag = '[flash=real]';

} else {

flashtag = '[flash]';

}
//modi by admin 2010-09-01 judege youtube case Start

if(sFlash.indexOf("youtube.com")> 0){

var sFlashTemp=sFlash.replace('watch?v=','v/' );//替换成实际的形式

//整个的场合,第二个参数不知道为什么不能被替换,用2个来实现

var templateUrl1 = '<object width="425" height="350"><param name="movie" value="{1}"></param><param name="wmode" value="transparent"></param>';

var templateUrl2 = '<embed src="{1}" type="application/x-shockwave-flash" wmode="transparent" width="425" height="350"></embed></object>';


var stringFlash1 = templateUrl1.replace('{1}',sFlashTemp);

var stringFlash2 = templateUrl2.replace('{1}',sFlashTemp);


//相结合后,填入insertHTML

var stringFlash =
stringFlash1 + stringFlash2;

format("insertHTML", stringFlash);


} else {//flash case 原来的部分

format("insertHTML", flashtag + sFlash + '[/flash]');

}
//modi by admin 2010-09-01 judege youtube case End

}

fHide($('createSwf'));

vObj.value = 'http://';

} else {

if(gIsIE){

var e = window.event;

}

getCaret();

var dvSwfBox = $("createSwf");

var iX = e.clientX;

var iY = e.clientY;

dvSwfBox.style.display = "";

dvSwfBox.style.left = (iX-350) + "px";

dvSwfBox.style.top = 33 + "px";

}
}





您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

手机版|小黑屋|Discuz! 官方站 ( 皖ICP备16010102号 )star

GMT+8, 2024-10-7 05:25 , Processed in 0.108715 second(s), 16 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2023, Tencent Cloud.

快速回复 返回顶部 返回列表