2009年08月13日

让FCKEditor 2.6.4.1 能插入 视频和音频

Filed under: JS » 未分类 — 标签:, — cmpan @ 2009-08-13 14:17:10
一、分别打开:editor/js/fckeditorcode_ie_1.js和/editor/js/fckeditorcode_gecko_1.js
找到程序代码 .swf
改成 .(swf|mov|qt|avi|wmv|asf|wma|mid|mp3|mpg|rm|ra|rmvb|ram)

二、打开/editor/dialog/fck_flash/fck_flash.js

1、增加程序代码

// DP 20090813
function WinPlayer(url){
    var r, re;
    re = /.(avi|wmv|asf|wma|mid|mp3|mpg)$/i;
    r = url.match(re);
    return r;
}

function RealPlayer(url){
    var r, re;
    re = /.(rm|ra|rmvb|ram)$/i;
    r = url.match(re);
    return r;
}

function QuickTime(url){
    var r, re;
    re = /.(mov|qt)$/i;
    r = url.match(re);
    return r;
}

function FlashPlayer(url){
    var r, re;
    re = /.swf$/i;
    r = url.match(re);
    return r;
}

2、替换程序代码
    SetAttribute( e, 'type'         , 'application/x-shockwave-flash' ) ;
    SetAttribute( e, 'pluginspage'  , 'http://www.macromedia.com/go/getflashplayer' ) ;
为

    if(WinPlayer(GetE('txtUrl').value)!=null){
        SetAttribute( e, 'type'     , 'application/x-mplayer2' ) ;
        SetAttribute( e, 'autostart', GetE('chkAutoPlay').checked ? 'true' : 'false' ) ;
    }
    if(RealPlayer(GetE('txtUrl').value)!=null){
        SetAttribute( e, 'type'     , 'audio/x-pn-realaudio-plugin' ) ;
        SetAttribute( e, 'autostart', GetE('chkAutoPlay').checked ? 'true' : 'false' ) ;
    }
    if(QuickTime(GetE('txtUrl').value)!=null){
        SetAttribute( e, 'type'     , 'video/quicktime' ) ;
        SetAttribute( e, 'autostart', GetE('chkAutoPlay').checked ? 'true' : 'false' ) ;
    }
    if(FlashPlayer(GetE('txtUrl').value)!=null){
        SetAttribute( e, 'type' , 'application/x-shockwave-flash' ) ;
        SetAttribute( e, 'scale', GetE('cmbScale').value ) ;
        SetAttribute( e, 'menu',  GetE('chkMenu').checked ? 'true' : 'false' );
        SetAttribute( e, 'play',  GetE('chkAutoPlay').checked ? 'true' : 'false' ) ;
        SetAttribute( e, 'pluginspage'  , 'http://www.macromedia.com/go/getflashplayer' ) ;
    }

替换程序代码
    SetAttribute( e, 'type'     , 'application/x-shockwave-flash' ) ;
为

    if(WinPlayer(GetE('txtUrl').value)!=null){
        SetAttribute( e, 'type' , 'application/x-mplayer2' ) ;
    }
    if(RealPlayer(GetE('txtUrl').value)!=null){
        SetAttribute( e, 'type' , 'audio/x-pn-realaudio-plugin' ) ;
    }
    if(QuickTime(GetE('txtUrl').value)!=null){
        SetAttribute( e, 'type' , 'video/quicktime' ) ;
    }

    if(FlashPlayer(GetE('txtUrl').value)!=null){
        SetAttribute( e, 'type' , 'application/x-shockwave-flash' ) ;
    } 

三、修改D:\yulans\web\js\fckeditor\editor\filemanager\connectors\php\config.php

$Config['AllowedExtensions']['Flash']   = array('swf','flv') ;

改成

$Config['AllowedExtensions']['Flash']   = array('swf','flv','mov','qt','avi','wmv','asf','wma','mid','mp3','mpg','rm','ra','rmvb','ram') ;

Views – 2632

分享到:
Copyright © 2009 流水孟春 版权所有
Web技术,LAMP,Nginx,Web2.0,前端技术
Powered by WordPress & UI Designed by 流水孟春