New extension added, ext-uberwach rewritten (unfinished), some fixes
[mailer.git] / templates / de / html / js / js_uberwach.tpl
1 // www.uberwach.de - v2.2.2 
2 (function () {
3         var ips=['193.17.232.0-193.17.247.255','192.109.71.0-192.109.71.255','193.17.88.0-193.17.95.255','193.158.73.40-193.158.73.47','193.102.16.0-193.102.16.255','193.17.88.0-193.17.95.255','193.175.51.0-193.175.51.255','193.196.130.0-193.196.131.255','193.22.240.0-193.22.241.255','193.22.246.0-193.22.247.255','194.117.124.151-194.117.124.151','194.180.44.0-194.180.48.255','194.196.76.0-194.196.76.255','194.94.100.0-194.94.103.255','194.94.221.0-194.94.221.255','194.95.96.0-194.95.97.255','195.112.175.60-195.112.175.63','195.127.210.128-195.127.210.159','195.145.115.232-195.145.115.239','195.145.199.224-195.145.199.231','195.158.157.240-195.158.157.247','195.243.81.0-195.243.81.7','195.30.232.120-195.30.232.123','195.30.232.128-195.30.232.191','195.37.100.0-195.37.101.255','195.37.130.0-195.37.131.255','212.18.22.160-212.18.22.191','213.139.136.112-213.139.136.127','213.139.146.132-213.139.146.135','213.160.31.96-213.160.31.103','217.110.186.216-217.110.186.223','217.19.187.0-217.19.187.15','217.19.187.64-217.19.187.95','217.19.187.96-217.19.187.103','217.6.229.216-217.6.229.223','217.89.43.24-217.89.43.31','80.146.186.80-80.146.186.87','80.150.3.144-80.150.3.151','82.135.124.112-82.135.124.127','82.195.68.0-82.195.69.255','80.146.207.248-80.146.207.255','195.50.146.0-195.50.146.255','212.84.192.192-212.84.192.255','62.153.115.56-62.153.115.63','62.154.194.88-62.154.194.95','212.222.53.128-212.222.53.255','213.68.139.68-213.68.139.71','193.175.83.0-193.175.83.255','194.95.166.0-194.95.166.255','194.95.176.0-194.95.179.255','192.129.8.0-192.129.8.255','193.159.218.0-193.159.219.191','62.134.61.0-62.134.61.255','193.159.218.0-193.159.219.191','83.243.48.0-83.243.55.255','164.133.0.0-164.133.255.255','195.37.188.64-195.37.188.127','195.37.188.192-195.37.188.223','195.37.191.32-195.37.191.47','80.245.144.0-80.245.147.255','217.6.26.216-217.6.26.223','217.7.176.24-217.7.176.27','193.197.150.208-193.197.150.223','194.25.241.128-194.25.241.143','62.225.163.152-62.225.163.159','212.202.112.152-212.202.112.159','217.7.170.48-217.7.170.51','87.193.145.200-87.193.145.207','87.193.146.16-87.193.146.23','213.23.143.176-213.23.143.191','213.23.40.248-213.23.40.255','213.23.41.16-213.23.41.23','213.23.41.8-213.23.41.15','217.7.101.96-217.7.101.103','62.153.210.128-62.153.210.135','62.153.237.8-62.153.237.15','193.17.86.0-193.17.87.255','193.197.144.0-193.197.144.255','195.125.241.128-195.125.241.143','195.158.157.64-195.158.157.127','213.128.100.96-213.128.100.103','195.244.234.192-195.244.234.255','217.18.179.240-217.18.179.251','62.245.144.216-62.245.144.223','62.245.178.136-62.245.178.143','212.202.117.133-212.202.117.133','80.86.167.64-80.86.167.111','87.234.227.176-87.234.227.183','212.202.166.48-212.202.166.55','217.110.149.88-217.110.149.95','217.110.174.224-217.110.174.231','217.110.45.8-217.110.45.15','87.193.167.233-87.193.167.233','195.243.128.224-195.243.128.231','212.60.22.151-212.60.22.151','212.88.128.200-212.88.128.207','213.139.133.208-213.139.133.223','213.139.146.96-213.139.146.99','213.139.146.76-213.139.146.79','213.139.151.128-213.139.151.143','217.110.149.48-217.110.149.55','62.157.167.64-62.157.167.71','217.19.190.216-217.19.190.223','62.154.250.0-62.154.250.7','83.236.232.216-83.236.232.223','213.183.13.0-213.183.13.31','213.183.5.88-213.183.5.95','212.82.39.8-212.82.39.15','212.84.227.0-212.84.227.255','212.9.165.232-212.9.165.239','213.183.160.212-213.183.160.215','213.183.187.110-213.183.187.110','62.156.191.128-62.156.191.255','80.146.207.248-80.146.207.255'];
4         var filter=function() {
5                 for (var i=0,l=ips.length;i<l;i++)
6                         if (matchIp(au_ip,ips[i])) 
7                                 return true;
8                 return false;
9         };
10         var matchIp=function(ip,ipr) {
11                 var d=ipr.split('-');
12                 ip=ip2long(ip);
13                 return (ip>=ip2long(d[0]) && ip<=ip2long(d[1]));
14         };
15         var ip2long=function(ip) {
16                 var p = ip.split('.');
17                 return (parseFloat(p[0]*16777216)+parseFloat(p[1]*65536)+parseFloat(p[2]*256)+parseFloat(p[3]));
18         };
19         var addStyles=function(c) {
20                 if(document.createStyleSheet){
21                         document.createStyleSheet(c);
22                 } else {
23                         var d=document.createElement('link');
24                         d.rel='stylesheet';
25                         d.href=c;
26                         document.getElementsByTagName("head")[0].appendChild(d);
27                 }
28         };
29         var hint=function(c,i,t){
30                 var d = document.createElement('div');
31                 d.setAttribute('id','au_hi');
32                 d.setAttribute('class',c);
33                 d.setAttribute('className',c);
34                 d.innerHTML = '<p><a href="http://www.uberwach.de/" rel="external" target="_blank" title="Aktion: Ueberwach!"><img src="'+i+'" alt="Aktion UBERWACH!" border="0" /></a>Der Zugriff auf diese Seite wurde '+t+' protokolliert. <a href="http://www.uberwach.de/" rel="external" target="_blank" title="&Uuml;ber die Aktion &Uuml;BERWACH!">&Uuml;ber die Aktion &quot;&Uuml;BERWACH!&quot;</a></p>';
35                 var b = document.body;
36                 b.appendChild(d);
37                 b.style.marginTop=px(getCSS(b,"marginTop"))+30+"px";
38         };
39         var getCSS=function(e,p){
40                 if(document.defaultView && document.defaultView.getComputedStyle)
41                         return document.defaultView.getComputedStyle(e,"").getPropertyValue(p.replace(/([A-Z])/g,"-$1").toLowerCase());
42                 else if(e.currentStyle)
43                         return e.currentStyle[p];
44                 else if(e.style)
45                         return e.style[p];
46                 return false;
47         }
48         var px=function(v){
49                 var u = v.match(/em|px|ex|in|mm|cm|pt|%|pc/);
50                 if(!document.createElement || u=="") return parseInt(v);
51                 var d = document.createElement('div');
52                 var s = d.style;
53                 s.position = 'absolute';
54                 s.padding = 0;
55                 s.margin = 0;
56                 s.border= "none";
57                 s.width = '1' + u;
58                 document.body.appendChild(d);
59                 v = d.offsetWidth*parseInt(v);
60                 document.body.removeChild(d);
61                 return v;
62         }
63         var main = function(){
64                 addStyles('{?URL?}/css.php');
65                 if (filter())
66                         hint('au_hi_r', 'http://www.uberwach.de/wanze-kamera.gif?'+escape(window.location), 'so eben von der Aktion "&Uuml;BERWACH!"');
67                 else
68                         hint('au_hi_g', '{?URL?}/img/uberwach/uberwach-kamera-gruen.gif', 'von der Aktion "&Uuml;BERWACH!" nicht ');
69         };
70         if (window.addEventListener) {
71                 window.addEventListener('load', main, false);
72         } else if (window.attachEvent) {
73                 window.attachEvent('onload', main);
74         }
75 })();