统计

js

/**
 * 统计JS
 * @author guomumin
 * @date 2013-06-25
 * @update 2014-08-06
 * @version 1.1
 */
(function(window){
    window.ucf=_ucf;
    var _ucf=(function(){
        var a=navigator.userAgent;
        ucf={getBrowser:function(){if(a.indexOf("MSIE")>0)
                                    {if(a.indexOf("MSIE 9.0")>-1)
                                    {return"IE 9";}
                                    if(a.indexOf("MSIE 10.0")>-1)
                                    {return"IE 10";}
                                    if(a.indexOf("MSIE 8.0")>-1)
                                    {return"IE 8";}
                                    if(a.indexOf("MSIE 7.0")>-1)
                                    {return"IE 7";}
                                    if(a.indexOf("MSIE 6.0")>-1)
                                    {return"IE 6";}}
                                    if(a.indexOf("Firefox")>-1)
                                    {return"Firefox";}
                                    if(a.indexOf("Chrome")>-1)
                                    {return"Chrome";}
                                    if(a.indexOf("Camino")>-1)
                                    {return"Camino";}
                                    if(a.indexOf("Gecko/")>-1)
                                    {return"Gecko";}
                                    if(a.indexOf("Opera")>-1)
                                    {return"Opera";}
                                    if(a.indexOf("Safari/")>-1)
                                    {return"Safari";}
                                    return"";},
            platform:function(){
                    var n=navigator.platform;
                    var isWin=(n=="Win32")||(n=="Windows")||(n=="Win64");
                    var isMac=(n=="Mac68K")||(n=="MacPPC")||(n=="Macintosh")||(n=="MacIntel");
                    if(isMac)return"Mac";
                    var isUnix=(n=="X11")&&!isWin&&!isMac;
                    if(isUnix)return"Unix";
                    var isLinux=(String(n).indexOf("Linux")>-1);
                    if(isLinux)return"Linux";
                    if(isWin){var isWin2K=a.indexOf("Windows NT 5.0")>-1||a.indexOf("Windows 2000")>-1;
                    if(isWin2K)return"Win2000";
                    var isWinXP=a.indexOf("Windows NT 5.1")>-1||a.indexOf("Windows XP")>-1;
                    if(isWinXP)return"WinXP";
                    var isWin2003=a.indexOf("Windows NT 5.2")>-1||a.indexOf("Windows 2003")>-1;
                    if(isWin2003)return"Win2003";
                    var isWinVista=a.indexOf("Windows NT 6.0")>-1||a.indexOf("Windows Vista")>-1;
                    if(isWinVista)return"WinVista";
                    var isWin7=a.indexOf("Windows NT 6.1")>-1||a.indexOf("Windows 7")>-1;
                    if(isWin7)return"Win7";
                    var isWin8=a.indexOf("Windows NT 6.2")>-1||a.indexOf("Windows 8")>-1;
                    if(isWin8)return"Win8";}
                    return"";},
            getSessid:function()
                    {return this.getCookie("JSESSIONID");},
            strTime:function()
                    {return new Date().getTime();},
            randNum:function(n)
                    {var chars=['0','1','2','3','4','5','6','7','8','9','a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z'];
                    var res="";
                    for(var i=0;i<n;i++){
                        var id=Math.ceil(Math.random()*35);
                        res+=chars[id];
                    }
                    return res;},
            httpStatus:function(){
                    if(window.ActiveXObject){
                        h=new ActiveXObject('Microsoft.XMLHttp');
                    }else if(window.XMLHttpRequest){
                        h=new XMLHttpRequest();}
                        h.open("get",window.location,false);
                        h.send(null);
                        return h.status;},
            chars:function(){if(document.charset){
                    return document.charset;}
                    if(document.characterSet){
                        return document.characterSet;
                    }
                    return'';},
            getMs:function(){
                    var t=new Date();
                    var m=t.getUTCMilliseconds();
                    return m;},
            setCookie:function(n,r,h){
                    var n=escape(n);
                    var a=escape(r);
                    var expires=new Date();
                    var hours=h||1;
                    expires.setTime(expires.getTime()+hours*60*60*1000);
                    _expires=(typeof hours)=="string"?"":";expires="+expires.toUTCString();
                    document.cookie=n+"="+a+_expires+";path=/;domain=9888.cn";
                    return a;},
            delCookie:function(a,k){
                    var date=new Date();
                    date.setTime(date.getTime()-1000);
                    var c=document.cookie;
                    if(c.indexOf(a)>-1){
                        document.cookie=a+"="+k+";expires="+date.toUTCString()+";path=/;domain=9888.cn";}},
            getCookie:function(s){
                    var c=document.cookie;
                    a=eval("'"+s+"'");
                    if(c.indexOf(a)>-1){
                        var regExp=new RegExp(a+"=([a-zA-Z0-9-]+)");
                        return regExp.exec(c)[1];
                    }
                    return"";},
            cooikeOnly:function(){
                    var oid=this.strTime()+"-"+this.randNum(10)+"-"+this.randNum(10);
                    return this.getCookie("UCFDATA")?this.getCookie("UCFDATA"):this.setCookie("UCFDATA",oid,216);},
            userCookie:function(){return this.getCookie("sso-uid");},
            hisCookie:function(){var c=document.cookie;
                    if(c.indexOf("ECS[history]")>-1){
                        var c=c.split("ECS[history]=");
                        var d=c[1].split(";");
                        return str.replace(new RegExp(/(,)/g),"|");
                    }else{return"";}},
            siteId:function(){
                    var name=document.getElementsByTagName("script"),ui;
                    for(var i=0;i<name.length;i++){
                        var u=document.getElementsByTagName("script")[i];
                        if(u.getAttribute("src")){
                            if(u.getAttribute("src").indexOf("count.js?siteid=")>-1){
                                ui=u.getAttribute("src");
                                break;
                            }
                        }
                    }
                    if(ui.indexOf("siteid=")>-1){
                        stid=ui.substring(ui.indexOf("siteid=")+7,ui.length).split("&");
                        return stid[0];
                    }
                    return 0;},
            creatImg:function(u,s){
                    var n="log_"+(new Date()).getTime();
                    var i=window[n]=new Image();
                    i.onload=(i.onerror=function(){window[n]=null;});
                    i.src=u+"?rs="+s;
                    i=null;
                    },
            httpTime:function(){
                    var a=window.Date();
                    var d=new Date(a);
                    return d.getTime();},
            soStype:function(u){
                    if(u.length>0){
                        if(u.indexOf("http://www.baidu.com")>-1){return"baidu";}
                        if(u.indexOf("http://www.google.com")>-1){return"google";}
                        if(u.indexOf("http://cn.bing.com")>-1){return"bing";}
                        if(u.indexOf("http://www.so.com")>-1){return"so360";}
                        if(u.indexOf("http://www.soso.com")>-1){return"soso";}
                        if(u.indexOf("http://www.sogou.com")>-1){return"sougou";}
                        if(u.indexOf("http://www.yodao.com")>-1){return"youdao";}
                    }
                    return'';},
            firstRefer:function(){
                    var a=this.getRefer();
                    if(a.length>0){
                        var so=this.soStype(a);
                        if(so.length>1){return this.setCookie("UCFREF",so,3);}
                        return this.getCookie("UCFREF");
                    }
                    if(this.getCookie("UCFREF").length>1){
                        this.delCookie("UCFREF",this.getCookie("UCFREF"));
                    }
                    return'';},
            getSokeyword:function(){
                    var c=document.cookie;
                    if(c.indexOf("UCFKWD")>-1){
                        var c=c.split("UCFKWD=");
                        if(c[1].indexOf(";")>-1){
                            var d=c[1].split(";");
                            return decodeURI(decodeURI(d[0]));
                        }
                        return decodeURI(decodeURI(c[1]));
                    }
                    return"";},
            soKeyword:function(actiontype){
                    if(actiontype==1){
                        var a=this.getRefer();
                        var f=this.firstRefer();
                        var k,q="q=";
                        if(f=="baidu"){q="wd=";}
                        if(f=="soso"){q="w=";}
                        if(f=="sogou"){q="query=";}
                        if(f.length>2&&this.soStype(a).length>3){d=a.split("&");
                            for(c in d){if(d[c].indexOf(q)>-1){
                                var key=d[c].split("=");
                                k=key[1];
                            }
                        }
                        if(k){this.setCookie("UCFKWD",encodeURI(k),3);
                        return k;}
                    }}
                    var sokwd=this.getSokeyword();
                    if(actiontype==2){if(sokwd.length>5){return sokwd;}}
                        if(actiontype==3){
                            if(sokwd.length>5){
                                this.delCookie("UCFKWD",sokwd);
                            }
                        }
                        return'';
                    },
            getRefer:function(){
                    var ref=function(){
                        try{
                            if(document.referrer)return document.referrer+'';
                            else if(window.opener)return window.opener.location+'';
                        }catch(e){}
                    return'';}();
                    return ref?ref:"";},
            actionCk:function(ac,at,an){
                        var actionId="ACTION"+ac;
                        var actionNum=an||1;
                        if(actionNum==1){return at;}
                        var pointId=this.getCookie(actionId);
                        if(at==1){
                            if(pointId>1){return"";}
                            this.setCookie(actionId,at,2);return at;
                        }
                        var diffNum=at-pointId;
                        if(diffNum==1){
                            this.setCookie(actionId,at,2);
                            if(at==actionNum){
                                this.delCookie(actionId,at);
                            }
                            return at;
                        }
                        return"";
                    },
            soKwdStr:function(at,am){
                        var ref=ucf.getRefer();
                        if(ucf.soStype(ref).length>1){
                            var soStr=",srf:"+ucf.soStype(ref)+",skwd:"+ucf.soKeyword(1);
                        }else{
                            var soStr=",srf:"+ucf.firstRefer()+",skwd:"+ucf.soKeyword(2);
                            if(at==am){
                                if(ucf.getCookie("UCFKWD").length>1){
                                    ucf.delCookie("UCFKWD",this.getSokeyword());
                                }
                            }
                        }
                        return soStr;
                    },
            actionMsg:function(ac,at,am,ad){
                        var so=this.soKwdStr(at,am);
                        var pointId=this.actionCk(ac,at,am);
                        ad=ad||"";
                        if(pointId==at){
                            var val=so+',ac:'+ac+',at:'+at+',ad:'+ad;
                            this.sentMsg(val,2);
                        }
                    },
            sendUri:function(y){
                        if(y==1){
                            var uri="http://statis.9888.cn/stat.gif";
                        }else{
                            var uri="http://statis.9888.cn/action.gif";
                        }
                        return uri;
                    },
            getStatus:function(){
                        return{frp:this.getRefer(),top:window.location+'',pf:this.platform()+'',bro:this.getBrowser(),scs:screen.width+'.'+screen.height,lag:(navigator.language?navigator.language:navigator.browserLanguage)+'',tz:((new Date().getTimezoneOffset()/60)*(-1))+'',sid:this.getSessid(),webId:this.siteId(),nt:this.strTime(),hs:this.httpStatus(),wcd:this.chars(),ckieyn:navigator.cookieEnabled?1:0,cpulv:navigator.cpuClass?navigator.cpuClass:'',ms:this.getMs(),ckId:this.cooikeOnly(),method:'get',uid:this.userCookie(),his:this.hisCookie(),lid:1};},
                        
            sentMsg:function(x,y){
                        var msg=this.getStatus();
                        var s=msg.webId+"||"+msg.lid+"||"+msg.top+"||"+msg.nt+"-"+this.randNum(10)+"||"+msg.frp+"||sid:"+msg.sid+",lan:"+msg.lag+",re:"+msg.scs+",tz:"+msg.tz+",pf:"+msg.pf+",code:"+msg.wcd+",ck:"+msg.ckieyn+",mt:"+msg.method+",cpu:"+msg.cpulv+",hs:"+msg.hs+",bs:"+msg.bro+",ckid:"+msg.ckId+",uid:"+msg.uid+",his:"+msg.his;
                        s=s+x;
                        s=s.replace(new RegExp(/(&)/g),"\%26");
                        this.creatImg(this.sendUri(y),s);}};
                        return ucf;
                    }());
    window.ucf=_ucf;
})(window);

(function(){
    var ot=0;
    var x=",ot:"+ot;
    ucf.sentMsg(x,1);
    if(ucf.soStype(ucf.getRefer()).length>1){
        var u=",srf:"+ucf.soStype(ucf.getRefer())+",skwd:"+ucf.soKeyword(1)+",ac:,at:,ad:";
        ucf.sentMsg(u,2);
    }
})();

m:

<script type="text/javascript"
        src="/pp-web2/js/count.js?siteid=701"></script>

<script>       
        $(document).ready(function() {
          var t=;
          if(t!=''){
            try {
                if (typeof (eval(ucf.actionMsg)) == "function") {
                    ucf.actionMsg(, 3, 6);
                }
            } catch (e) {
            }
          }
        })
</script>

 

posted @ 2014-12-17 16:21  洒洒  阅读(187)  评论(0编辑  收藏  举报