-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathcss.trackdata.js
More file actions
73 lines (60 loc) · 2.07 KB
/
css.trackdata.js
File metadata and controls
73 lines (60 loc) · 2.07 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
var intervalID = 0;
var intervalValue = 1000;
var requestCharset = "utf-8";
var requestLang = "en";
var requestStatus = 1;
var requestParams = "";
var requestRefresh = 1;
if(typeof(siteCharset) != "undefined" && siteCharset != null){
requestCharset = siteCharset;
}
if(typeof(siteLang) != "undefined" && siteLang != null){
requestLang = siteLang;
}
if(typeof(pageRefresh) != "undefined" && pageRefresh != null){
requestRefresh = pageRefresh * 1000;
}
if(requestRefresh >= 1000){
intervalValue = requestRefresh;
}
intervalID = setInterval(function(){loadData()}, intervalValue);
function httpRequest(){
var httpRequest = null;
try{
httpRequest = new XMLHttpRequest();
}catch(e){
try{
httpRequest = new ActiveXObject("Msxml2.XMLHTTP");
}catch(e){
httpRequest = new ActiveXObject("Microsoft.XMLHTTP");
}
}
return httpRequest;
}
function requestSetParams(){
requestParams = "displayLang=" + requestLang + "&ScreenWidth=" + screen.width + "&ScreenHeight=" + screen.height + "&InnerWidth=" + self.innerWidth + "&InnerHeight=" + self.innerHeight;
var inputControls = document.getElementsByTagName("input");
for(var i = 0; i < inputControls.length; i++){
if(inputControls[i].type == "hidden" && inputControls[i].value != ""){
requestParams += "&" + inputControls[i].name + "=" + inputControls[i].value;
}
}
}
function loadData(){
var dataRequest = httpRequest();
// -- Note: When using async=false, do NOT write an onreadystatechange function - just put the code after the send() statement!
if(dataRequest != null){
try{
requestSetParams();
dataRequest.open("POST", "./trackdata.php", false);
dataRequest.setRequestHeader("Content-Type", "application/x-www-form-urlencoded;charset=" + requestCharset);
dataRequest.send(requestParams);
document.getElementById("trackData").innerHTML = dataRequest.responseText;
}catch(e){
cssError.handle(1, e);
}
}else{
requestStatus = 0;
}
}
document.onLoad = loadData();