MediaWiki:If-sincere-visitor.js

Aus Wiktionary, dem freien Wörterbuch
 // See [[w:als:Wikipedia:Statistik/Besucher/A_simple_and_harmless_Visitor_Counter]]!
 // If you should want to re-use this counter: Do *not* gather private data like referrers; never!

 if (mw.config.get('wgNamespaceNumber') == 0 && mw.config.get('wgUserName') == null && wgIsArticle == true && wgCurRevisionId != false && navigator.cookieEnabled == true) {
  currentTime = new Date();
  visitDay = currentTime.getDate();
  if (document.cookie.indexOf("anonymouslyCountedVisit="+visitDay) < 0) {
   function visitCounter() {
    var iFrame = document.createElement("iframe");
    iFrame.src = "//als.wikipedia.org/wiki/Wikipedia:Statistik/Besucher/A_simple_and_harmless_Visitor_Counter?action=raw&ctype=text/css";
    iFrame.style.display = "none";
    $("footer").appendChild(iFrame);
    // The following cookie is just as private as all the other files in the browser's cache!
    expireDate = currentTime.getTime()+86400000; // max. 1 day
    expireTime.setTime(expireDate);
    document.cookie = "anonymouslyCountedVisit="+visitDay+"; path=/; expires="+expireTime.toGMTString();
   }
   $(visitCounter);
  }
 }