imfunction_utf8.js

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

JS
1,274
字号
var im_global = new Object();

im_global.version = {
    presence_flash : "2.4.2",
    buddylist_flash: "2.4.2",
    webchat_flash  : "2.4.2"
};
im_global.win = {//聊窗
    fontsize : '12px',
    fontcolor: '#000000',
    tbfontcolor:'#000000',
    fonttext: ''
};
im_global.variable = {
    siteid: null,
    user_id  : null,
    user_name: null,
    user_sid : null,
    userparam: null,
    webchatURL: "",
    onlineuserURL: "",
    scriptPath: "",
    serverPath: "",
    setingItems: [
        {title:"接收所有人消息",name:"autoacceptmessage",type:"radio",value:1},
        {title:"只接受好友消息",name:"autoacceptmessage",type:"radio",value:2},
        {title:"-"},
        {title:"好友上线提示",  name:"buddyonlinenotify",type:"checkbox",value:true},
        {title:"系统声音提示",  name:"notifysound",type:"checkbox",value:true}]
};
        //{title:"拒绝所有人消息",name:"autoacceptmessage",type:"radio",value:3},
im_global.temp = {//临时
    menuTimer: -1,
    at: null,
    uid_display:"",
    divY:null,
    flashServers:null,
    userStatusServer:null,
    presenceFlashGoUrl:null,
    buddylistFlashGoUrl:null,
    presenceFlash:null,
    la: new Array(),
    ow: new Object(),
    notify_id: 0,
    userSpanArray: null,
    bHaveSetFlashServers:false,
    resetwintop: new Array(),
    imSid:null,
    logo:null
};
im_global.cfg = {//配置
    not_showfloat_sites: new Array("haiguinet","cnmyspace"),
    notShowFloat:   false,
    customtoolbarButtons:[],//自定义工具条按钮
    bgColor:    "#DFDFDF",
    broderColor:"#92918D",
    toolbarOverColor:  "#CDD3E9",
    chatWidth: 452,
    chatHeight:471,
    IMWidth:190,
    IMHeight:450,
    General: false,
    customparams:   [],
    cookieTimeout: 3600, //一小时    
    DebugType: 0,                                          /*0:关闭|1:log4javascript|2:dzy*/
    init: function(){
        this.customparams["cache_serverinfo"] = false;     /**/
        this.customparams["getserverurl"]     = "http://download.wdknet.com/wdkchat/func/getflashserver.php";
        /*-----------------以下参数可在客户端调用----------------*/
        this.customparams["enblebuddyentry"]  = 1;         /*0:关闭|1:开启|2:开启(不显示浮动Logo,无固定SPAN时不显示Logo)*/
        this.customparams["floatpos"]         = "right";
        this.customparams["entrytype"]        = "toolbar";
        this.customparams["layout"]           = "cascade"; /*cascade:层叠|free :自由(toolbar专属参数)*/
        this.customparams["intact"]           = false;     /*true   :完整|false:精简(toolbar专属参数)*/
        this.customparams["webchat_inpage"]   = true;      /*页内|页外打开聊窗*/
        this.customparams["alway_notify"]     = false;     /*alway_notify*/
        this.customparams["show_popmenu"]     = true;      /**/
        this.customparams["show_tooltip"]     = true;      /**/
        this.customparams["hiddenmode"]       = false;     /**/
    }
};
im_global.cache = {
    source: "",
    _images:  ["logo_mini","im_logo","notify_userhead","online","offline","tools_min","tools_min_over","tools_min_click"],
    img:[],
    init:function(){
        if(this.source.length <= 0) alert("缓存图片失败");
        
        for(var i=0; i<this._images.length;i++){
            var image = new Image();
            image.src = this.source + this._images[i] + ".gif";
            this.img[this._images[i]] = image;
        }
        this.img["im_logo"].width = 20;
    }
};
im_global.cfg.init();

var im_wdkUtil = null;
var im_toolbar = null;
var im_toolBar_Menu = null;
var im_notify_manager = null;
var im_chat_window_manager = null;
var wdkApplication = null;
var im_myIMWindow = null;
var im_notshow_ad = false;
//var im_webchat_url = "http://wdknet.vicp.net/wdkchat/func/imwebchat.php";
//var im_buddylist_url = "http://wdknet.vicp.net/wdkchat/func/getflashserver.php";
var im_logger = null;

/*---------config end ---------*/

var im_uAgent = navigator.userAgent.toLowerCase();
im_browser = function(){
    this.version=(im_uAgent.match( /.+(?:firefox|rv|it|ra|ie)[\/: ]([\d.]+)/ ) || [])[1];
    this.safari= /webkit/.test( im_uAgent );
    this.opera= /opera/.test( im_uAgent );
    this.msie= /msie/.test( im_uAgent ) && !/opera/.test( im_uAgent );
    this.msie56= parseFloat(im_uAgent.substring(im_uAgent.indexOf("msie") + 5)) >= 5.5 && parseFloat(im_uAgent.substring(im_uAgent.indexOf("msie") + 5))<7;
    this.mozilla= /mozilla/.test( im_uAgent ) && !/(compatible|webkit)/.test( im_uAgent );
    this.firefox=/firefox/.test(im_uAgent);
    this.firefox2=/firefox/.test(im_uAgent) && this.version.indexOf("2.") > -1;
    this.chrome=/chrome/.test(im_uAgent);
    this.boxModel= !(/msie/.test( im_uAgent ) && !/opera/.test( im_uAgent )) || document.compatMode == "CSS1Compat";//?
    this.oldModel = /msie/.test( im_uAgent ) && !/opera/.test( im_uAgent ) && document.compatMode=="BackCompat";
    this.scroll = null;
};
/*-----class WdkUtil start-----*/
WdkUtil = function(){
    this.Browser = new im_browser();
    this.Domain  = location.hostname;
    this.Path    = "/";
}
_p = WdkUtil.prototype;
_p.setDomain = function(domain){
    if(domain){
        var _ed     = domain.indexOf("/");
        var _len    = domain.length;
        if(_ed>=0){
            this.Domain = domain.substr(0, _ed);
            this.Path   = domain.substr(_ed, _len);
        }else{
            this.Domain = domain.substr(0, _len);
        }
    }
}
_p.GetCookieVal = function(offset){
    var endstr = document.cookie.indexOf (";", offset);
    if (endstr == -1)
    endstr = document.cookie.length;
    return unescape(document.cookie.substring(offset, endstr));
}
_p.SetCookie = function(name, value){
    var expdate = new Date();
    var argv = arguments;
    var argc = arguments.length;
  var expires = (argc > 2) ? argv[2] : null;
  var path = (argc > 3) ? argv[3] : null;
  var domain = (argc > 4) ? argv[4] : null;
    var secure = (argc > 5) ? argv[5]  : false;
    if(expires!=null) expdate.setTime(expdate.getTime() + ( expires * 1000 ));
    document.cookie = name + "=" + escape (value) +((expires == null) ? "" : ("; expires="+ expdate.toGMTString()))
    +((path == null) ? "" : ("; path=" + path)) +((domain == null) ? "" : ("; domain=" + domain))
    +((secure == true) ? "; secure" : "");
}
_p.GetCookie = function(name){
  var arg = name + "=";
  var alen = arg.length;
  var clen = document.cookie.length;
  var i = 0;
  while (i < clen)
  {
    var j = i + alen;
    if (document.cookie.substring(i, j) == arg)
    return this.GetCookieVal(j);
    i = document.cookie.indexOf(" ", i) + 1;
    if (i == 0) break;
  }
  return null;
}
_p.DelCookie = function(name){
  var exp = new Date();
  exp.setTime (exp.getTime() - 1);
  var domain = this.Domain ? this.Domain : "";
  var path = this.Path ? this.Path : "";
  var cval = this.GetCookie (name);
  document.cookie = name + "=" + cval + "; expires="+ exp.toGMTString() +
    "; path=" + path + "; domain=" + domain;
}
_p.isFunction = function( fn ) {
    return !!fn && typeof fn != "string" && !fn.nodeName && 
        fn.constructor != Array && /function/i.test( fn + "" );
}
_p.isArray = function( o ){
    return Object.prototype.toString.apply(o) === '[object Array]';
}

_p.Event = {
    listEvents: [],
    addEvent: function( obj, type, fn ) {
        if (obj.addEventListener) {
            obj.addEventListener( type, fn, false );
            this.listEvents.push(arguments);
        }
        else{
            obj.attachEvent( "on"+type, fn);
            this.listEvents.push(arguments);
        }
    },
    removeEvent: function( obj, type, fn ){
        if( obj.removeEventListener ){
            obj.removeEventListener(type, fn, false);
        }
        else{
            obj.detachEvent("on"+type, fn) ;
        }
    },
    flush : function(){
        var i, item;
        for(i = this.listEvents.length - 1; i >= 0; i = i - 1){
            item = this.listEvents[i];
            if(item[0].removeEventListener){
                item[0].removeEventListener(item[1], item[2], item[3]);
            };
            if(item[1].substring(0, 2) != "on"){
                item[1] = "on" + item[1];
            };
            if(item[0].detachEvent){
                item[0].detachEvent(item[1], item[2]);
            };
            item[0][item[1]] = null;
        };
    }
};
_p.$ = function(el){
    return(document.getElementById ? document.getElementById(el)
            : document.all ? document.all[el]
            : null);
};
_p.doc = document.documentElement ? document.documentElement : (document.body ? document.body : null);
_p.scroll = function(){
    var wh = this.viewRect.get(window, true).h;
    if( this.doc.scrollHeight>wh)
        return true
    else
        return false;
}
_p.JSONtoArray = function(json){
    if(!json) return;
    var arrOut = [];for(var k in json){arrOut[k] = json[k];}return arrOut;
}
_p.StringToArray = function(string){//JSON类型字符串
    if(string=="" || string.indexOf("{")!=0 || string.indexOf("}")!=string.length-1) return;
    var arrOut = [];var _temp = string.substr(string.indexOf("{")+1, string.indexOf("}")-1);var _arr  = _temp.split(",");for(var i=0; i<_arr.length; i++){var _t = _arr[i].split(":");arrOut[_t[0]] = _t[1];}return arrOut;
}

⌨️ 快捷键说明

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