360百科中那个回复的编辑器是什么编辑器,是什么产品,可以在网上下载吗http://baike.360.cn/4066573/vote_11368867.html,网易论坛的编辑器好像与这相似,这是一个可以公共使用的编辑器产品吗

解决方案 »

  1.   

    从页面html源码来看,这是个定制的UBB编辑器,载入的代码是:
    <script type="text/javascript">
    $(function(){qihoo_module_ubbEditor.init("content" , "controlPanel" , "/img");});
    </script>另外,根据qihoo_module_ubbEditor.init搜索到下面一篇博文,是不是奇虎用的编辑器的代码就不得而知了..一个基于jquery的简易ubb编辑器【支持IE&FF】
    http://liuguanyu.blog.hexun.com/14906123_d.html
    var qihoo_module_ubbEditor = {
        _codeContainer : {},    _controllBar : {},    _imagePath : "." ,    _defaultConfigData : [
        {"imgFile":"bold.gif" , "replaceText":"加粗" , "eventFun":function (){qihoo_module_ubbEditor.onBold();} , "idName":"ctlBold"},
        {"imgFile":"italic.gif" , "replaceText":"斜体" , "eventFun":function (){qihoo_module_ubbEditor.onItalic();}, "idName":"ctlItalic"},
        {"imgFile":"under.gif" , "replaceText":"下划线" , "eventFun":function (){qihoo_module_ubbEditor.onUnderLine();}, "idName":"ctlUnder"},
        {"imgFile":"link.gif" , "replaceText":"加入链接" , "eventFun":function (){qihoo_module_ubbEditor.onLink();}, "idName":"ctlLink"},
        {"imgFile":"image.gif" , "replaceText":"插入图片" , "eventFun":function (){qihoo_module_ubbEditor.onImage();}, "idName":"ctlImg"},
        {"imgFile":"rm.gif" , "replaceText":"插入视频" , "eventFun":function (){qihoo_module_ubbEditor.onVideo();}, "idName":"ctlVideo"},
        {"replaceText":"自动排版" , "eventFun":function (){qihoo_module_ubbEditor.onFormat();}, "idName":"ctlFormat"}
        ],    _clientVer : parseInt(navigator.appVersion) ,
        _isIe : ((navigator.userAgent.toLowerCase().indexOf("msie") != -1) && (navigator.userAgent.toLowerCase().indexOf("opera") == -1)) ,    init : function (containerId , controlBarlId  ,imagePath ,configData) {
            this._codeContainer = $("#"+containerId);        this._controlBar = $("#"+controlBarlId);        if (typeof(imagePath) != "undefined") this._imagePath = imagePath;        if (typeof(configData) == "undefined") configData = this._defaultConfigData;        for( var i in configData){
                tmp = $("#"+configData["idName"]);
                if (typeof(configData[i]["imgFile"]) != "undefined" ){
                    tmp.attr("src" , this._imagePath+"/"+configData[i]["imgFile"]);
                    if (typeof(configData[i]["replaceText"]) != "undefined")  tmp.attr("alt" , configData[i]["replaceText"]);
                }
                else{
                    tmp.html(configData[i]["replaceText"]);
                }            eventKey = (typeof(configData[i]["eventKey"]) == "undefined") ? "click" : configData[i]["eventKey"];            tmp.bind(eventKey , configData[i]["eventFun"]);
            }        this._controlBar.insertBefore(this._codeContainer);
        } ,    getControlBar : function(){
            return this._controlBar;
        } ,    setSelectionText : function (openTag , closeTag ){
            this._codeContainer[0].focus();
            if ((this._clientVer >= 4) && this._isIe){
                theSelection = document.selection.createRange().text;            if (theSelection != ''){
                    document.selection.createRange().text = openTag + theSelection + closeTag;
                }
                else{
                    this.insertAtCursor(openTag + closeTag);
                }
            }
            else {
                if (this._codeContainer[0].selectionEnd &&  (this._codeContainer[0].selectionEnd - this._codeContainer[0].selectionStart > 0)) {
                    var startPos = this._codeContainer[0].selectionStart;
                    var endPos =  this._codeContainer[0].selectionEnd;
                    var prevValue = this._codeContainer.val();                this._codeContainer.val(prevValue.substring( 0 , startPos ) + openTag + prevValue.substring(startPos,endPos) + closeTag + prevValue.slice(endPos));
                }            else{
                    this.insertAtCursor(openTag + closeTag);
                }
            }
        },    getSelectionText : function (){
            this._codeContainer[0].focus();
            if ((this._clientVer >= 4) && this._isIe){
                return document.selection.createRange().text;
            }
            else {
                if (this._codeContainer[0].selectionEnd &&  (this._codeContainer[0].selectionEnd - this._codeContainer[0].selectionStart > 0)) {
                    var startPos = this._codeContainer[0].selectionStart;
                    var endPos =  this._codeContainer[0].selectionEnd;
                    var prevValue = this._codeContainer.val();                return prevValue.substring(startPos,endPos) + closeTag + prevValue.slice(endPos);
                }
            }        return "";    },    insertAtCursor : function (text){
            this._codeContainer[0].focus();
            if( document.selection ){
                sel = document.selection.createRange();
                sel.text = text ;
            }
            else if( this._codeContainer[0].selectionStart || this._codeContainer[0].selectionStart == '0' ){
                var startPos = this._codeContainer[0].selectionStart;
                var endPos = this._codeContainer[0].selectionEnd;
                var prevValue = this._codeContainer.val();
               
                this._codeContainer.val(prevValue.substring(0, startPos) + text + prevValue.substring(endPos, prevValue.length));
            }
            else{
                this._codeContainer.val( this._codeContainer.val() + text);
            }
        },    onFormat : function (){
            this._codeContainer.val("\n"+ this._codeContainer.val().replace(/ |  /ig,"").replace(/\r\n/ig,"\n").replace(/\n{2,}/ig,"\n").replace(/\n/ig,"\n\n   ").replace("\n\n",""));
        },    onBold : function (){
            this.setSelectionText("","");
        },    onItalic : function (){
            this.setSelectionText("[i]","
    ");
        },    onUnderLine : function () {
            this.setSelectionText("","");
        },    onLink : function (){
            var myUrl = prompt("请输入超链接地址):",  "http:\/\/");        if (( myUrl != null ) && ( myUrl != "http://" )){
                selectText = this.getSelectionText();
                if (selectText){
                    this.setSelectionText ( "","");
                }
                else{
                    this.insertAtCursor(""+myUrl+"");
                }
            }
        },
       
        onImage : function () {
            var myPic = prompt("输入图片的地址", "http:\/\/");
       
            if ((myPic != null) && (myPic != "http://")){
                myPic = "\n\n";
               
                this.insertAtCursor(myPic);
            }
        },
       
        onVideo : function (){
            var myVideo = prompt("输入视频的超链接", "http:\/\/");        if ((myVideo != null) && (myVideo != "http://")){
                myVideo = "\n[swf]"+myVideo+"[/swf]\n";
               
                this.insertAtCursor(myVideo);
            }  
        }    
    }