imfunction_utf8.js

来自「这篇文章主要用来说明获取设备表述的情况,希望大家可以得到帮助」· JavaScript 代码 · 共 1,274 行 · 第 1/5 页

JS
1,274 行
字号
        im_global.cfg.chatHeight       = 452;
        im_global.cfg.IMWidth          = 295;
        im_global.cfg.IMHeight         = 490;
        im_global.win.fonttext = "聚友聊聊";
        im_global.win.fontcolor        = "#FFFFFF";
        im_global.win.tbfontcolor      = "#004499";
    }
    else if(_siteid=="ntalkerbbs"  || _siteid=="bbs50gbk" || _siteid=="yeeyoo"){//亿友测试
        im_global.cache.source += "yeeyoo/";
        im_global.cache.init();
        //自定义工具条按钮
        im_global.cfg.customtoolbarButtons = [
            {id:"im_music",_class:"im_music",con:"",url:"http://my.yeeyoo.com/admin/music/searchInit.action",tip:"音乐盒"},
            {id:"im_xingyun",_class:"im_xingyun",con:"",url:"http://my.yeeyoo.com/admin/starFortune/starFortune.action",tip:"星运"},
            {id:"im_youxi",_class:"im_youxi",con:"",url:"http://my.yeeyoo.com/admin/game/sg.action",tip:"亿友三国"}
        ];
        im_global.cfg.toolbarOverColor = "#FFE1FF";
        im_global.cfg.bgColor          = "#FFCCFF";
        im_global.cfg.broderColor      = "#FF43C8";
        im_global.cfg.chatWidth        = 472;
        im_global.cfg.chatHeight       = 452;
        im_global.cfg.IMWidth          = 295;
        im_global.cfg.IMHeight         = 490;
        im_global.win.fonttext         = "亿友聊聊";
    }
    else if(_siteid=="csdn" || _siteid=="csdn_test" || _siteid=="discuz60utf8dzy" ){
        im_global.cache.source += "csdn/";
        im_global.cache.init();
        im_global.cache.img["im_logo"].width = 41;
        im_global.cfg.customtoolbarButtons = [
            {id:"im_space",_class:"im_space",con:"",url:"http://hi.csdn.net/my.html",tip:"空间"},
            {id:"im_blog",_class:"im_blog",con:"",url:"http://blog.csdn.net/",tip:"博客"},
            {id:"im_bbs",_class:"im_bbs",con:"",url:"http://community.csdn.net/",tip:"论坛"}
        ];
        im_global.cfg.toolbarOverColor = "#C3F0FF";
        im_global.cfg.bgColor          = "#E8FbFF";
        im_global.cfg.broderColor      = "#3374C4";
        im_global.cfg.chatWidth        = 472;
        im_global.cfg.chatHeight       = 452;
        im_global.cfg.IMWidth          = 295;
        im_global.cfg.IMHeight         = 490;
        im_global.win.fonttext         = "实时信息通讯平台";
        im_global.win.fontcolor        = "#FFFFFF";
        im_global.win.tbfontcolor      = "#3374C4";
    }
    else{
        im_global.cache.source += "ntalker/";
        im_global.cache.init();
        im_global.cache.img["im_logo"].width = 53;
        im_global.cfg.toolbarOverColor = "#C3F0FF";
        im_global.cfg.bgColor          = "#E8FbFF";
        im_global.cfg.broderColor      = "#3374C4";
        im_global.cfg.chatWidth        = 472;
        im_global.cfg.chatHeight       = 452;
        im_global.cfg.IMWidth          = 295;
        im_global.cfg.IMHeight         = 490;
        im_global.win.fonttext         = "";
        im_global.win.fontcolor        = "#FFFFFF";
        im_global.win.tbfontcolor      = "#3374C4";
        im_global.cfg.General          = true;
    }
    var userStatusServer = null;
    if(im_global.cfg.customparams["cache_serverinfo"])
        userStatusServer = im_wdkUtil.GetCookie("userstatusserver");
    if(!userStatusServer){
        var getServerUrl = im_global.cfg.customparams["getserverurl"]?im_global.cfg.customparams["getserverurl"]:(im_global.variable.scriptPath+"/func/getflashserver.php");
        im_wdkUtil.createScript(getServerUrl+"?siteid="+siteid+"&resulttype=2&rand="+Math.random());
    }
    else{
        im_onGetFlashServer(userStatusServer, '2', true);
    }
}

function im_runPresence(userparam, siteid, userid, username, sessionid, flashserver, webchatpageurl, Params) {
	  if(typeof(userparam)=='undefined' || !userparam || userparam.length==0){
	     userparam = username;
	  }
    if(siteid=="csdn" || siteid=="csdn_test")im_global.cfg.customtoolbarButtons[1].url += username;
    im_global.variable.userparam = userparam;
    im_global.variable.siteid = siteid;
    im_global.variable.user_id = userid;
    im_global.variable.user_name = username;
    im_global.variable.user_sid = sessionid;
    //flashserver
    im_global.variable.webchatURL = webchatpageurl;
    
    if(Params && typeof Params =="object"){
        for(var k in Params){
            if(typeof(im_global.cfg.customparams[k]) != "undefined"){
                im_global.cfg.customparams[k] = Params[k];
        }
        }
    }else if(Params && typeof Params == "string"){//string
        var aParam = Params.split(";")
        for(var i in aParam){
            if(aParam[i] && aParam[i].indexOf(":")){
                var a = aParam[i].split(":");
                k = a[0];v = a[1];
                if(typeof(im_global.cfg.customparams[k]) != "undefined")
                    im_global.cfg.customparams[k] = v=="false" ? false : v=="true"  ? true : v;
            }
        }
    }
    im_global.cfg.customparams["layout"] =  im_global.cfg.customparams["entrytype"]=="toolbar" ? "toolbar" : 
                                            (im_global.cfg.customparams["entrytype"]=="tianyatoolbar" ? "tianyatoolbar" : im_global.cfg.customparams["layout"]);
    
    var pageurl = "nodata";
    document.write("<div id=\"wdk_mini_state\" style=\"display:none; \"></div>");
    flashvars = '?sessionid='+encodeURIComponent(im_global.variable.user_sid)+'&userid='+encodeURIComponent(im_global.variable.user_id)+'&username='+encodeURIComponent(im_global.variable.user_name)
                +'&siteid='+encodeURIComponent(im_global.variable.siteid)+"&version="+im_global.version.presence_flash;
    if(im_global.variable.userparam)
        flashvars += "&userparam="+encodeURIComponent(im_global.variable.userparam);
    var flashurl = im_global.variable.scriptPath+"/impresence.swf"+flashvars;

    im_divY = -200;
    if (im_global.variable.user_sid != "") {
          var flashnodehtml = '<div id="im_presence_div" style=\"position:absolute;z-index:9996; top: -200px;\">';
          if(im_wdkUtil.Browser.msie){
            flashnodehtml +='<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0" '
                          +'id="impresenceflash"  width="10" height="10" title="在线状态"> '
                          +'    <param name="movie" value="'+flashurl+'" /> '
                          +'    <param name="allowscriptaccess" value="always" /> '
                          +'  </object>' ;
          }
          else{
                  flashnodehtml +='<embed src="'+flashurl
                                +  '" id="impresenceflash" name="在线状态" width="10" height="10" allowscriptaccess="always" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash"> '
                                +'</embed>';
        }
        flashnodehtml += '</div>' ;
        document.write(flashnodehtml);
    }
    try{//动态装载imchat_utf8.js
        if(im_global.cfg.DebugType==1){
            im_wdkUtil.createScript(im_global.variable.scriptPath+"/log4javascript/log4javascript.js");
        }else if(im_global.cfg.DebugType==2){
            dzy_debug.init();
        }
        //im_wdkUtil.createScript("http://10.1.62.68/csdn/imchat_utf8.js");
        im_wdkUtil.createScript("http://www.csdn.net/xnim/imchat_utf8.js");
    }
    catch(e){}
}
function presenceFlashReady(){
    setFlashServerToPresence();
    return true;
}
function setFlashServerToPresence(){
    if(!im_global.temp.flashServers || im_global.temp.bHaveSetFlashServers)
        return;

    im_global.temp.presenceFlash = document.getElementById("impresenceflash");
    var _presenceFlash = im_global.temp.presenceFlash;
    if(_presenceFlash){
        if(_presenceFlash.setFlashServerInfo){
            _presenceFlash.setFlashServerInfo(im_global.temp.flashServers[0],im_global.temp.flashServers[1],im_global.temp.flashServers[2],im_global.temp.flashServers[3],im_global.temp.flashServers[4],im_global.temp.flashServers[5],im_global.temp.flashServers[6],im_global.temp.flashServers[7],im_global.temp.flashServers[8]);
            im_global.temp.bHaveSetFlashServers = true;       
        }
        if(_presenceFlash.setPageFocus && typeof(promptwindow)!="undefined" && promptwindow.isfocus){
            _presenceFlash.setPageFocus(true);
            if(im_global.cfg.DebugType==2) dzy_debug.debug("presenceFlash.setPageFocus(true)", true);
        }
    }
}
/*-----*/
function im_initim(){
    var scriptobjs = window.document.getElementsByTagName("script");
    var scriptobj = scriptobjs[scriptobjs.length - 1];
    var scriptpath = scriptobj.getAttribute("src");
    if(scriptpath && scriptpath.length>0){
        var pos = scriptpath.lastIndexOf("/");
        if(pos>=0)
            im_global.variable.scriptPath = scriptpath.substring(0,pos);
        else
            im_global.variable.scriptPath = "";

        var pos = scriptpath.indexOf("//");
        if(pos>0){
            var pos2 = scriptpath.indexOf("/", pos+2);
            if(pos2>pos)
                im_global.variable.serverPath = scriptpath.substring(0,pos2);
        }
        else
            im_global.variable.serverPath = "";
    }
    else{
        im_global.variable.scriptPath = "";
        im_global.variable.serverPath = "";
    }
    if(!im_global.cache.source)
        im_global.cache.source = im_global.variable.scriptPath+"/images/";
    im_wdkUtil = new WdkUtil();
}
function im_initPopMenu(){
    document.write("<div id='im_popMenuid' style='display:none;text-align:left;position:absolute;z-index:10001;'></div>");

    var cssTag = im_wdkUtil.$('im_popmenu_css');
    var head = document.getElementsByTagName('head').item(0);
    if(cssTag)
        return;
    im_wdkUtil.createCSS(im_global.variable.scriptPath+"/impopmenu.css");
}

/*----[im_ToolTip]----*/
var im_ToolTip = {
        FONTCOLOR        : '#000044',
        FONTFACE        : 'Verdana,Geneva,sans-serif',
        FONTSIZE        : '12px',
        FONTWEIGHT        : 'normal',
        TEXTALIGN        : 'left',
        PADDING            : 2,
        tipElements        : ['img','abbr','acronym'],
        IMG:[],
        _elmCss    : [],
        _Obj    : {},
        _Tips    : [],
        _Time    : [],
        _opac    : [],
        _step    : [],
        _iTimerID:[],
        loadImage: function(){
            var asrc = ["tip_bg", "tip_lt", "tip_t", "tip_rt", "tip_r", "tip_rb", "tip_b", "tip_lb", "tip_l", "tip_stemt", "tip_stemb"],
            n = asrc.length,
            aImg = new Array(n),
            img;
            while(n){
                --n;
                img = aImg[n] = new Image();
                img.src = im_global.cache.source + asrc[n] + ".gif";
            }
            this.IMG = aImg;return;
        }
};

/*---- Function ------*/
function im_onGetFlashServer(responseText, type, iscookievalue){
    if(responseText=="-1" || responseText=="-2")
        return;

    if(type=="2"){
        im_global.temp.userStatusServer = responseText;
        if(typeof(iscookievalue)=="undefined" || !iscookievalue)//从服务器端返回的数据才写cookie
            im_wdkUtil.SetCookie("userstatusserver", im_global.temp.userStatusServer, im_global.cfg.cookieTimeout);
        StartGetUsersStatus(im_global.temp.userStatusServer);
    }
    else if(type=="1"){
        im_global.temp.presenceFlash =  im_wdkUtil.$("impresenceflash");
        im_global.temp.flashServers = responseText.split(",");
        if(typeof(iscookievalue)=="undefined" || !iscookievalue)//从服务器端返回的数据才写cookie
            im_wdkUtil.SetCookie("flashservers", responseText, im_global.cfg.cookieTimeout);
        //startGetMyIMStatus(im_global.temp.flashServers[8]);/*??注释掉*/
        setFlashServerToPresence();
    }
}
function StartGetUsersStatus(userStatusServer){

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?