PageSourceSearch

https://nashdom.us/awstatsjs/awstats_misc_tracker.js

js nashdom.us collected 2026-09-24 22:25:14 UTC 7,562 bytes, 162 lines download raw bytes

1// awstats_misc_tracker.js
2//-------------------------------------------------------------------
3// You can add this file onto some of your web pages (main home page can
4// be enough) by adding the following HTML code to your page body:
5//
6// <script type="text/javascript" src="/js/awstats_misc_tracker.js"></script>
7// <noscript><p><img src="/js/awstats_misc_tracker.js?nojs=y" alt="" height="0" width="0" style="display: none" /></p></noscript>
8
9//
10// * This must be added after the <body> tag, not placed within the
11//   <head> tags, or the resulting tracking <img> tag will not be handled
12//   correctly by all browsers.  Internet explorer will also not report
13//   screen height and width attributes until it begins to render the
14//   body.
15//
16// This allows AWStats to be enhanced with some miscellaneous features:
17// - Screen size detection (TRKscreen)
18// - Browser size detection (TRKwinsize)
19// - Screen color depth detection (TRKcdi)
20// - Java enabled detection (TRKjava)
21// - Macromedia Director plugin detection (TRKshk)
22// - Macromedia Shockwave plugin detection (TRKfla)
23// - Realplayer G2 plugin detection (TRKrp)
24// - QuickTime plugin detection (TRKmov)
25// - Mediaplayer plugin detection (TRKwma)
26// - Acrobat PDF plugin detection (TRKpdf)
27//-------------------------------------------------------------------
28
29// If you use pslogger.php to generate your log, you can change this line with
30// var awstatsmisctrackerurl="pslogger.php?loc=/js/awstats_misc_tracker.js";
31var awstatsmisctrackerurl="/awstatsjs/awstats_misc_tracker.js";
32
33var TRKresult;
34var TRKscreen, TRKdpr, TRKwinsize, TRKcdi, TRKjava, TRKshk, TRKsvg, TRKfla;
35var TRKrp, TRKmov, TRKwma, TRKpdf, TRKpdfver, TRKuserid, TRKsessionid;
36var TRKnow, TRKbegin, TRKend;
37var TRKnse, TRKn;
38
39function awstats_setCookie(TRKNameOfCookie, TRKvalue, TRKexpirehours) {
40	TRKExpireDate = new Date ();
41  	TRKExpireDate.setTime(TRKExpireDate.getTime() + (TRKexpirehours * 3600 * 1000));
42  	document.cookie = TRKNameOfCookie + "=" + escape(TRKvalue) + "; path=/" + ((TRKexpirehours == null) ? "" : "; expires=" + TRKExpireDate.toGMTString());
43}
44
45//function awstats_runvbscript() {
46//	TRKresult = false;
47//	p=false;
48//	document.write('<SCRIPT LANGUAGE="VBScript">\non error resume next \n p = IsObject(CreateObject("PDF.PdfCtrl.5")) \n if (p) then \n msgbox("5") \n return true \n end if</SCRIPT>\n');
49//    alert(p);
50//	if (TRKresult) return 'y';
51//	else return 'n';
52//}
53
54function awstats_detectIE(TRKClassID) {
55	TRKresult = false;  // !!! Adding var in front of TRKresult break detection !!!
56	document.write('<SCR' + 'IPT LANGUAGE="VBScript">\n on error resume next \n TRKresult = IsObject(CreateObject("' + TRKClassID + '")) \n </SCR' + 'IPT>\n');
57	if (TRKresult) return 'y';
58	else return 'n';
59}
60
61function awstats_detectNS(TRKClassID) {
62	TRKn = "n";
63	if (TRKnse.indexOf(TRKClassID) != -1) if (navigator.mimeTypes[TRKClassID].enabledPlugin != null) TRKn = "y";
64	return TRKn;
65}
66
67function awstats_getCookie(TRKNameOfCookie){
68	if (document.cookie.length > 0){
69		TRKbegin = document.cookie.indexOf(TRKNameOfCookie+"=");
70	    if (TRKbegin != -1) {
71			TRKbegin += TRKNameOfCookie.length+1; 
72			TRKend = document.cookie.indexOf(";", TRKbegin);
73			if (TRKend == -1) TRKend = document.cookie.length;
74    	  	return unescape(document.cookie.substring(TRKbegin, TRKend));
75		}
76		return null; 
77  	}
78	return null; 
79}
80
81if (window.location.search == "" || window.location.search == "?") {
82    // If no query string
83	TRKnow = new Date();
84	TRKscreen=screen.width+"x"+screen.height;
85	TRKdpr=window.devicePixelRatio;
86	if (navigator.appName != "Netscape") { TRKcdi=screen.colorDepth; }
87	else {TRKcdi=screen.pixelDepth};
88	TRKjava=navigator.javaEnabled();
89	TRKuserid=awstats_getCookie("AWSUSER_ID");
90	TRKsessionid=awstats_getCookie("AWSSESSION_ID");
91	var TRKrandomnumber=Math.floor(Math.random()*10000);
92	if (TRKuserid == null || (TRKuserid=="")) { TRKuserid = "awsuser_id" + TRKnow.getTime() +"r"+ TRKrandomnumber; }
93	if (TRKsessionid == null || (TRKsessionid=="")) { TRKsessionid = "awssession_id" + TRKnow.getTime() +"r"+ TRKrandomnumber; }
94	awstats_setCookie("AWSUSER_ID", TRKuserid, 10000);
95	awstats_setCookie("AWSSESSION_ID", TRKsessionid, 1);
96	TRKuserid=""; TRKuserid=awstats_getCookie("AWSUSER_ID");
97	TRKsessionid=""; TRKsessionid=awstats_getCookie("AWSSESSION_ID");
98	
99	var TRKnav=navigator.appName.toLowerCase();     // "internet explorer" or "netscape"
100	var TRKagt=navigator.userAgent.toLowerCase();   // "msie...", "mozilla...", "firefox..."
101    //alert(TRKnav); alert(TRKagt);
102
103	var TRKwin  = ((TRKagt.indexOf("win")!=-1) || (TRKagt.indexOf("32bit")!=-1));
104	var TRKmac  = (TRKagt.indexOf("mac")!=-1);
105
106	var TRKns   = (TRKnav.indexOf("netscape") != -1);
107	var TRKopera= (TRKnav.indexOf("opera") != -1);
108	var TRKie   = (TRKagt.indexOf("msie") != -1);
109
110    // Detect the browser internal width and height
111    var TRKwinsize;
112    if (document.documentElement && document.documentElement.clientWidth)
113        TRKwinsize = document.documentElement.clientWidth + 'x' + document.documentElement.clientHeight;
114    else if (document.body && document.body.clientWidth)
115        TRKwinsize = document.body.clientWidth + 'x' + document.body.clientHeight;
116    else
117        TRKwinsize = window.innerWidth + 'x' + window.innerHeight;
118	
119	if (TRKie && TRKwin) {
120		TRKshk = awstats_detectIE("SWCtl.SWCtl.1");
121		TRKsvg = awstats_detectIE("Adobe.SVGCtl");
122		TRKfla = awstats_detectIE("ShockwaveFlash.ShockwaveFlash.1");
123		TRKrp  = awstats_detectIE("rmocx.RealPlayer G2 Control.1");
124		TRKmov = awstats_detectIE("Quicktime.Quicktime");
125		TRKwma = awstats_detectIE("wmplayer.ocx");
126		TRKpdf = 'n'; TRKpdfver='';
127        if (awstats_detectIE("PDF.PdfCtrl.1") == 'y') { TRKpdf = 'y'; TRKpdfver='4'; } // Acrobat 4
128	    if (awstats_detectIE('PDF.PdfCtrl.5') == 'y') { TRKpdf = 'y'; TRKpdfver='5'; } // Acrobat 5
129		if (awstats_detectIE('PDF.PdfCtrl.6') == 'y') { TRKpdf = 'y'; TRKpdfver='6'; } // Acrobat 6
130		if (awstats_detectIE('AcroPDF.PDF.1') == 'y') { TRKpdf = 'y'; TRKpdfver='7'; } // Acrobat 7
131	}
132	if (TRKns || !TRKwin) {
133		TRKnse = "";
134		for (var TRKi=0;TRKi<navigator.mimeTypes.length;TRKi++) TRKnse += navigator.mimeTypes[TRKi].type.toLowerCase();
135		TRKshk = awstats_detectNS("application/x-director","");
136  		TRKsvg = awstats_detectNS("image/svg+xml","");
137		if (document.implementation.hasFeature("org.w3c.dom.svg", "")) {TRKsvg = "y"; }
138		TRKfla = awstats_detectNS("application/x-shockwave-flash"); // ou lire dans naviagtor.plugins si on trouve "Shockwave Flash" ou "Shockwav Flash 2.0"
139		TRKrp  = awstats_detectNS("audio/x-pn-realaudio-plugin");
140		TRKmov = awstats_detectNS("video/quicktime");
141		TRKwma = awstats_detectNS("application/x-mplayer2");
142		TRKpdf = awstats_detectNS("application/pdf");
143        TRKpdfver='';
144    }
145
146	var imgsrc1 = awstatsmisctrackerurl+'?dpr='+TRKdpr+'&screen='+TRKscreen+'&win='+TRKwinsize+'&cdi='+TRKcdi+'&java='+TRKjava;
147	var imgsrc2 = '&shk='+TRKshk+'&svg='+TRKsvg+'&fla='+TRKfla+'&rp='+TRKrp+'&mov='+TRKmov+'&wma='+TRKwma+'&pdf='+TRKpdf+'&uid='+TRKuserid+'&sid='+TRKsessionid;
148    //alert(imgsrc1);
149    //alert(imgsrc2);
150    var imgsrc=imgsrc1+imgsrc2;
151	if( document.createElementNS ) {
152    	var l=document.createElementNS("http://www.w3.org/1999/xhtml","img");
153        l.setAttribute("style", "display:none;");
154        l.setAttribute("src", imgsrc );
155        l.setAttribute("height", "0");
156        l.setAttribute("width", "0");
157        document.getElementsByTagName("body")[0].appendChild(l);
158	} else {
159		document.write('<img style="display:none;" src="'+ imgsrc +'" height="0" width="0">')
160	}
161
162}

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.