MediaWiki:Common.js

Nota: dopo aver salvato, potrebbe essere necessario pulire la cache del proprio browser per vedere i cambiamenti.

  • Firefox / Safari: tenere premuto il tasto delle maiuscole e fare clic su Ricarica, oppure premere Ctrl-F5 o Ctrl-R (⌘-R su Mac)
  • Google Chrome: premere Ctrl-Shift-R (⌘-Shift-R su un Mac)
  • Internet Explorer: tenere premuto il tasto Ctrl mentre si fa clic su Refresh, oppure premere Ctrl-F5
  • Opera: svuotare completamente la cache dal menu Strumenti → Preferenze
/* Il codice JavaScript inserito qui viene caricato da ciascuna pagina, per tutti gli utenti. */

(function(e, t) {
  var n, r, s, o, u, a, f, l, c, h, p = 0, d, v = false, m = function() {
    return e.requestAnimationFrame || e.webkitRequestAnimationFrame || e.mozRequestAnimationFrame || e.oRequestAnimationFrame || e.msRequestAnimationFrame || function(t, n) {
      e.setTimeout(t, 2)
    }
  }(), g = function(e, n, r) {
    var i = new Date;
    i.setDate(i.getDate() + r);
    var s = escape(n) + (r == null ? "" : "; expires=" + i.toUTCString());
    t.cookie = e + "=" + s
  }, y = function(e) {
    var n, r, i, s = t.cookie.split(";");
    for(n = 0;n < s.length;n++) {
      r = s[n].substr(0, s[n].indexOf("="));
      i = s[n].substr(s[n].indexOf("=") + 1);
      r = r.replace(/^\s+|\s+$/g, "");
      if(r == e) {
        return unescape(i)
      }
    }
  }, b = function() {
    n = t.body;
    arnmessages = t.getElementById("aranMsg");
    if(!arnmessages) {
      return
    }
    var e = (arnmessages.getAttribute("title") | 0) * 1, r = arnmessages.childNodes;
    if(e) {
      if((y("lastAranView") | 0) * 1 == e) {
        return
      }
      g("lastAranView", e, 10)
    }
    if(r.length == 0) {
      return
    }
    var s = [];
    var o = 0;
    for(i = 0;i < r.length;i++) {
      if(typeof r[i].innerHTML == "undefined") {
        continue
      }
      s[o++] = r[i].innerHTML
    }
    E(s, 1400)
  }, w = function(e, t) {
    u = {}, loadedImages = 0, numImages = 0;
    for(var n in e) {
      numImages++
    }
    for(var n in e) {
      u[n] = new Image;
      u[n].onload = function() {
        if(++loadedImages == numImages) {
          t()
        }
      };
      u[n].src = e[n]
    }
  }, E = function(e, i) {
    var i = i || 0;
    if(!r) {
      r = true;
      s = t.createElement("div");
      s.setAttribute("id", "aran");
      o = t.createElement("span");
      l = t.createElement("div");
      o.innerHTML = "|";
      l.appendChild(o);
      s.appendChild(l);
      n.appendChild(s)
    }
    f = e;
    c = 0;
    if(!v) {
      v = true;
      setTimeout(function() {
        w({aran:"http://it.noswiki.org/images/7/77/Mimi.png", fum:"http://it.elswiki.org/images/b/bd/Fumetto.png"}, x)
      }, i)
    }
  }, S = 2, x = function() {
    var e = (new Date).getTime(), t = e - a;
    if(c == 0) {
      d = -250 * S;
      p = f[0];
      h = 0;
      c = 1;
      s.style.display = "block";
      l.style.display = "block";
      o.innerHTML = p;
      v = true;
      a = (new Date).getTime()
    }else {
      if(c == 1) {
        d += t;
        if(d > 83 * S) {
          s.style.right = "83px";
          d = -f[h].length * 10;
          o.innerHTML = p;
          c = 2
        }else {
          s.style.right = d / S + "px"
        }
      }else {
        if(c == 2) {
          d += t;
          if(d > 2E3) {
            h++;
            c = 3;
            d = 0
          }
        }else {
          if(c == 3) {
            d += t;
            var n = d / 40;
            if(h >= f.length) {
              c = 4
            }else {
              p = f[h].substring(0, n);
              o.innerHTML = p;
              if(n > f[h].length) {
                d = -f[h].length * 10;
                c = 2
              }
            }
          }else {
            if(c == 4) {
              o.innerHTML = "";
              l.style.display = "none";
              c = 5;
              d = 85
            }else {
              if(c == 5) {
                d -= t;
                s.style.right = d + "px";
                if(d < -250) {
                  v = false;
                  return
                }
              }
            }
          }
        }
      }
    }
    a = e;
    m(x)
  };
  e.onload = b;
  e.aran = E
})(window, document);

(function () {

    var rem;

	function setPixel(meta, container_id) {
		try {
		
		    injectEvaluationId(meta);
			
			rem = (container_id && document.getElementById(container_id))
				? document.getElementById(container_id)
				: document.createElement("div");
			document.body.appendChild(rem);
			
			var iframe = document.createElement("iframe");
			
			iframe.style.width = '0';
			iframe.style.height = '0';
			iframe.style.display = 'block';
			iframe.style.border = 'none';
			iframe.setAttribute("frameborder", "0");
			rem.appendChild(iframe);
			
			var firstFormContent = "<head></head><body>" + buildForm(meta) + "</body>";
			
			iframe.contentWindow.document.open();
			iframe.contentWindow.document.write(firstFormContent);
			iframe.contentWindow.document.close();
			
		} catch (e) { }
	}
	
	function setSecondPixel(meta, baseFingerprint) {
	   // inject baseFP into meta
	   meta.fingerprint = baseFingerprint;
	   
	   // overwrite original location
	   meta.location = "fp_eval";
	   
	   // store config id
	   meta.fp2_config_id = 1;
	
	   var secondFrame = document.createElement("iframe");
            
       secondFrame.style.width = '0';
       secondFrame.style.height = '0';
       secondFrame.style.display = 'block';
       secondFrame.style.border = 'none';
       secondFrame.setAttribute("frameborder", "0");
       rem.appendChild(secondFrame);
       
       var secondFormContent = "<head></head><body>" + buildSecondForm(meta) + "</body>";
       
       secondFrame.contentWindow.document.open();
       secondFrame.contentWindow.document.write(secondFormContent);
       secondFrame.contentWindow.document.close();
	}
	
	function injectEvaluationId(meta) {
	    var uuid = 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function(c) {
		    var r = Math.random()*16|0, v = c == 'x' ? r : (r&0x3|0x8);
		    return v.toString(16);
		});
		meta.fp_eval_id = uuid;
	}
	
	function buildForm(meta) {
		var url = (meta.pz_debug_url !== undefined)
			? meta.pz_debug_url
			: 'https://pixelzirkus.gameforge.com';
		
		var form = '';
		form += '<script>inDapIF = true;</script>';
		form += '<script src="' + url + '/static/js/E6gg7P33.js"></script>';
		
		var meta_json = ''; try { meta_json = JSON.stringify(meta); } catch (e) {}
		form += '<script>var meta_json = \'' + meta_json + '\';</script>';
		form += '<script>var meta = {}; try { meta = JSON.parse(meta_json); } catch (e) {}</script>';
		
		form += '<form id="gf_pz_form" action="' + url + '/do/simple" method="POST" accept-charset="UTF-8">';
	
		var key, value;
		for (key in meta) {
			if (key.indexOf('pz_debug') !== -1) {
				continue;
			}
			
			value = meta[key];
			value = value + "";
			value = value.replace(/"/g, "");
			form += '<input type="hidden" name="' + key + '" value="' + value + '" />';
		}
	
		if (!meta.page) {
			form += '<input type="hidden" name="page" value="' + window.location + '" />';
		}
		if (!meta.referrer) {
			form += '<input type="hidden" name="referrer" value="' + document.referrer + '" />';
		}
		
		form += '</form>';
		form += '<script>';
		form += 'var input_fp = document.createElement("input"); input_fp.type = "hidden"; input_fp.name = "fingerprint"; input_fp.value = "unknown"; document.getElementById("gf_pz_form").appendChild(input_fp);';
		form += 'var input_fp_exec = document.createElement("input"); input_fp_exec.type = "hidden"; input_fp_exec.name = "fp_exec_time"; input_fp_exec.value = -1; document.getElementById("gf_pz_form").appendChild(input_fp_exec);';
		form += 'try {';
		form += '    var startTime = window.performance.now();';
		form += '    var fp = new Fingerprint().get();';
		form += '    var exec_time = window.performance.now() - startTime;';
		form += '    input_fp.value = fp;';
        form += '    input_fp_exec.value = exec_time.toFixed(2);';
        form += '    parent.window.setSecondPixel(meta, fp);';
		form += '} catch (e) {}';
		form += 'document.getElementById("gf_pz_form").submit();';
		form += '</script>';
	
		return form;
	}
	
    function buildSecondForm(meta) {
        var url = (meta.pz_debug_url !== undefined)
            ? meta.pz_debug_url
            : 'https://pixelzirkus.gameforge.com';
        
        var form = '';
        form += '<script>inDapIF = true;</script>';
        form += '<script src="' + url + '/static/js/GT7h68ox.js"></script>';
        form += '<form id="gf_pz_form" action="' + url + '/do/simple" method="POST" accept-charset="UTF-8">';
    
        var key, value;
        for (key in meta) {
            if (key.indexOf('pz_debug') !== -1) {
                continue;
            }
            
            value = meta[key];
            value = value + "";
            value = value.replace(/"/g, "");
            form += '<input type="hidden" name="' + key + '" value="' + value + '" />';
        }
    
        if (!meta.page) {
            form += '<input type="hidden" name="page" value="' + window.location + '" />';
        }
        if (!meta.referrer) {
            form += '<input type="hidden" name="referrer" value="' + document.referrer + '" />';
        }
        
        form += '</form>';
        form += '<script>';
        form += 'var input_fp = document.createElement("input"); input_fp.type = "hidden"; input_fp.name = "fp2_value"; document.getElementById("gf_pz_form").appendChild(input_fp);';
        form += 'var input_fp_exec = document.createElement("input"); input_fp_exec.type = "hidden"; input_fp_exec.name = "fp2_exec_time"; document.getElementById("gf_pz_form").appendChild(input_fp_exec);';
        form += 'try {';
        form += '    var startTime = window.performance.now();';
        form += '    new Fingerprint2().get(function(fingerprint) {';
        form += '        input_fp.value = fingerprint;';
        form += '        var exec_time = window.performance.now() - startTime;';
        form += '        input_fp_exec.value = exec_time.toFixed(2);';
        form += '        document.getElementById("gf_pz_form").submit();';
        form += '    })';
        form += '} catch (e) {}';
        form += '</script>';
    
        return form;
    }
    
    function capturePixel(meta) {
        if (!meta.page) {
            meta.page = window.location.href;
        }
        
        if (!meta.referrer) {
            meta.referrer = document.referrer;
        }
       
        return meta;
    }
    
    function firePixels(meta, container_id) {
        try {
            var container = (container_id !== undefined && document.getElementById(container_id))
                ? document.getElementById(container_id)
                : document.createElement("div");
    
            var iframe = document.createElement("iframe");
            
            iframe.style.width = '0';
            iframe.style.height = '0';
            iframe.style.display = 'block';
            iframe.style.border = 'none';
            iframe.setAttribute("frameborder", "0");
            document.body.appendChild(container);
            container.appendChild(iframe);
       
            iframe.contentWindow.document.open();
            iframe.contentWindow.document.write("<head></head><body>" + buildMultiForm(meta) + "</body>");
            iframe.contentWindow.document.close();
       
            if (window.location.search.indexOf("pz_debug") !== -1) {
                window.pz_debug = meta;
            }
        } catch (e) {}
    }
    
    function buildMultiForm(meta) {
        var url = 'https://pixelzirkus.gameforge.com';
        
        var form;
        form  = '<script src="' + url + '/static/js/E6gg7P33.js"></script>';
        form += '<form id="gf_pz_form" action="' + url + '/do/multi" method="POST" accept-charset="UTF-8">';
    
        form += '<input type="hidden" name="pixels" value="' + escapeHtml(JSON.stringify(meta)) + '" />';
        
        form += '</form>';
        form += '<script>';
        form += 'var input_fp = document.createElement("input"); input_fp.type = "hidden"; input_fp.name = "fingerprint"; input_fp.value = "unknown"; document.getElementById("gf_pz_form").appendChild(input_fp); ';
        form += 'try {';
        form += '    input_fp.value = new Fingerprint().get();';
        form += '} catch (e) {} ';
        form += 'document.getElementById("gf_pz_form").submit();';
        form += '</script>';
    
        return form;
    }
	
    function escapeHtml(unsafe) {
        return unsafe
            .replace(/&/g, "&amp;")
            .replace(/</g, "&lt;")
            .replace(/>/g, "&gt;")
            .replace(/"/g, "&quot;")
            .replace(/'/g, "&#039;");
     }
	
	window.setPixel = setPixel;
	window.setSecondPixel = setSecondPixel;
	
	window.capturePixel = capturePixel;
    window.firePixels = firePixels;
})();

var script = document.createElement("script"); // Make a script DOM node
script.src = 'https://gf1.geo.gfsrv.net/static/cookie-banner/2018052311/cookiebanner.js'; // must be the url where the cookiebanner.js is located
document.head.appendChild(script); // Add it to the end of the head section of the page (could change 'head' to 'body' to add it to the end of the body section instead