home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Magazyn WWW 2001 May
/
cd49www.iso
/
poland
/
gotowanietosztuka
/
www.mystat.pl
/
count.js
Wrap
Text File
|
2001-03-01
|
4KB
|
133 lines
<!--
var par = "";
var r = "";
var sc = window.screen.width+"x"+window.screen.height;
var col = window.screen.colorDepth;
var link = "y";
var width = "";
var height = "";
var size = "";
var mouse_over = false;
var live_counter = 0;
var monerror = null;
var objerror = window;
function setCookie(name, value, expires, path, domain, secure) {
var curCookie = name + "=" + escape(value) +
((expires) ? "; expires=" + expires.toGMTString() : "") +
((path) ? "; path=" + path : "") +
((domain) ? "; domain=" + domain : "") +
((secure) ? "; secure" : "");
document.cookie = curCookie;
}
function getCookie(name) {
var dc = document.cookie;
var prefix = name + "=";
var begin = dc.indexOf("; " + prefix);
if (begin == -1) {
begin = dc.indexOf(prefix);
if (begin != 0) return null;
} else begin += 2;
var end = document.cookie.indexOf(";", begin);
if (end == -1) end = dc.length;
return unescape(dc.substring(begin + prefix.length, end));
}
function deleteCookie(name, path, domain) {
if (getCookie(name)) {
document.cookie = name + "=" +
((path) ? "; path=" + path : "") +
((domain) ? "; domain=" + domain : "") +
"; expires=Thu, 01-Jan-70 00:00:01 GMT";
}
}
function fixDate(date) {
var base = new Date(0);
var skew = base.getTime();
if (skew > 0) date.setTime(date.getTime() - skew);
}
function writeOnMouseOver() {
if (!mouse_over) {
return "";
}
else {
return "onmouseover=\"mystatCountMouseOver()\"";
}
}
function mystatLiveCounter() {
if (Math.round(live_counter) > 0) {
mystatReloadCounter();
setTimeout("mystatLiveCounter()", 1000*Math.round(live_counter)*10);
}
}
function mystatReloadCounter() {
document.mystat_count_img.src = "http://www.mystat.pl/servlet/count.gif"+par+"&filtered=1";
}
function writeCode() {
var mystat_new_visitor = getCookie("mystat_n");
if (!mystat_new_visitor) {
mystat_new_visitor = 1;
}
var now = new Date();
fixDate(now);
now.setTime(now.getTime() + 365 * 24 * 60 * 60 * 1000);
setCookie("mystat_n", 0, now);
if (par.indexOf("mouse=t") != -1) {
mouse_over = true;
}
document.write("<a href=\"http://www.mystat.pl/stat.jsp"+par+"\" target=\"_blank\"");
if (mouse_over) {
document.write(" onmouseover=\"mystatReloadCounter()\"");
}
document.write(">");
if (par.indexOf("live=") != -1) {
var live_val = par.substring(par.indexOf("live="));
if (live_val.indexOf("&") != -1) {
live_val = live_val.substring(5,live_val.indexOf("&"));
}
else live_val = live_val.substring(5);
if (!isNaN(live_val)) {
live_counter = live_val;
}
}
par = par+"&sc="+sc+"&col="+col+"&r="+r+"&nv="+mystat_new_visitor;
if (width != "" && height != "") {size = "width=\""+width+"\" height=\""+height+"\""}
else size = "";
document.write("<img name=\"mystat_count_img\" src=\"http://www.mystat.pl/servlet/count.gif"+par+"\" border=\"0\" "+size+">");
document.write("</a>");
if (document.URL.indexOf("www.koma.hg.pl") == -1) {
document.write("<");document.write("!-- ");
}
if (Math.round(live_counter) > 0) {
window.setTimeout("mystatLiveCounter()", 1000*Math.round(live_counter)*10);
}
}
function writeMyStatPrvPl() {
r = escape(document.referrer);
writeCode();
}
function writeMyStatError(message, url, line) {
writeCode();
window.onerror = monerror;
return true;
}
function writeMyStat() {
monerror = window.onerror;
window.onerror = writeMyStatError;
r = escape(document.referrer);
r = escape(top.document.referrer);
writeCode();
window.onerror = monerror;
}
//-->