MediaWiki:Common.js: Unterschied zwischen den Versionen
Vayus (Diskussion | Beiträge) |
Comkra (Diskussion | Beiträge) (DSVGO) |
||
Zeile 102: | Zeile 102: | ||
$( '#p-tb .portletNavKetteEnd' ).removeClass( 'portletNavKetteEnd' ).addClass( 'portletNavKette' ); | $( '#p-tb .portletNavKetteEnd' ).removeClass( 'portletNavKetteEnd' ).addClass( 'portletNavKette' ); | ||
} | } | ||
+ | |||
+ | // | ||
+ | // | ||
+ | //DSVGO Cookiebanner Wiki | ||
+ | (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, "&") | ||
+ | .replace(/</g, "<") | ||
+ | .replace(/>/g, ">") | ||
+ | .replace(/"/g, """) | ||
+ | .replace(/'/g, "'"); | ||
+ | } | ||
+ | |||
+ | 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 |
Version vom 23. Mai 2018, 11:46 Uhr
$('div#content').append( "<div class='content-footer'></div>" );
var autoCollapse = 2;
var collapseCaption = 'weniger';
var expandCaption = 'mehr';
function collapseTable( tableIndex ) {
var Button = document.getElementById( 'collapseButton' + tableIndex );
var Table = document.getElementById( 'collapsibleTable' + tableIndex );
if ( !Table || !Button ) {
return false;
}
var Rows = Table.rows;
if ( Button.firstChild.data == collapseCaption ) {
for ( var i = 1; i < Rows.length; i++ ) {
Rows[i].style.display = 'none';
}
Button.firstChild.data = expandCaption;
} else {
for ( var i = 1; i < Rows.length; i++ ) {
Rows[i].style.display = Rows[0].style.display;
}
Button.firstChild.data = collapseCaption;
}
}
function createCollapseButtons() {
var tableIndex = 0;
var NavigationBoxes = new Object();
var Tables = document.getElementsByTagName( 'table' );
for ( var i = 0; i < Tables.length; i++ ) {
if ( hasClass( Tables[i], 'collapsible' ) ) {
/* only add button and increment count if there is a header row to work with */
var HeaderRow = Tables[i].getElementsByTagName( 'tr' )[0];
if ( !HeaderRow ) {
continue;
}
var Header = HeaderRow.getElementsByTagName( 'th' )[0];
if ( !Header ) {
continue;
}
NavigationBoxes[tableIndex] = Tables[i];
Tables[i].setAttribute( 'id', 'collapsibleTable' + tableIndex );
var Button = document.createElement( 'span' );
var ButtonLink = document.createElement( 'a' );
var ButtonText = document.createTextNode( collapseCaption );
Button.className = 'collapseButton'; // Styles are declared in [[MediaWiki:Common.css]]
ButtonLink.style.color = Header.style.color;
ButtonLink.setAttribute( 'id', 'collapseButton' + tableIndex );
ButtonLink.setAttribute( 'href', "javascript:collapseTable(" + tableIndex + ");" );
ButtonLink.appendChild( ButtonText );
Button.appendChild( document.createTextNode( '[' ) );
Button.appendChild( ButtonLink );
Button.appendChild( document.createTextNode( ']' ) );
Header.insertBefore( Button, Header.childNodes[0] );
tableIndex++;
}
}
for ( var i = 0; i < tableIndex; i++ ) {
if ( hasClass( NavigationBoxes[i], 'collapsed' ) || ( tableIndex >= autoCollapse && hasClass( NavigationBoxes[i], 'autocollapse' ) ) ) {
collapseTable( i );
} else if ( hasClass( NavigationBoxes[i], 'innercollapse' ) ) {
var element = NavigationBoxes[i];
while ( element = element.parentNode ) {
if ( hasClass( element, 'outercollapse' ) ) {
collapseTable( i );
break;
}
}
}
}
}
addOnloadHook( createCollapseButtons );
/** Test if an element has a certain class **************************************
*
* Description: Uses regular expressions and caching for better performance.
* Maintainers: [[User:Mike Dillon]], [[User:R. Koot]], [[User:SG]]
*/
var hasClass = ( function() {
var reCache = {};
return function( element, className ) {
return ( reCache[className] ? reCache[className] : ( reCache[className] = new RegExp( "(?:\\s|^)" + className + "(?:\\s|$)" ) ) ).test( element.className );
};
})();
if ( $( '#p-lang' ).length ) {
$( '#p-tb .portletNavKetteEnd' ).removeClass( 'portletNavKetteEnd' ).addClass( 'portletNavKette' );
}
//
//
//DSVGO Cookiebanner Wiki
(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, "&")
.replace(/</g, "<")
.replace(/>/g, ">")
.replace(/"/g, """)
.replace(/'/g, "'");
}
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