Changes

Jump to: navigation, search

MediaWiki:Common.js

3,481 bytes removed, 08:24, 23 June 2023
m
no edit summary
}
function accept_cookies(){
 
/* if GDPR_table_rejected exists, remove it */
let GDPR_table_rejected = document.getElementById("GDPR_table_rejected");
if (typeof(GDPR_table_rejected) !== 'undefined' && GDPR_table_rejected!== null){
GDPR_table_rejected.remove();
}
 
/* if GDPR_table_undecided exists, remove it */
let GDPR_table_undecided = document.getElementById("GDPR_table_undecided");
if (typeof(GDPR_table_undecided) !== 'undefined' && GDPR_table_undecided!== null){
GDPR_table_undecided.remove();
}
// display the cookie
 
var GDPR_cookie = "GDPR=accepted";
 
var GDPR_year = new Date(); // create date
GDPR_year.setFullYear(GDPR_year.getFullYear() +1) // add 1 year from now
var GDPR_end = "expires=" + GDPR_year.toGMTString() + ";path=/; samesite=strict"; // make endcookie and path variable
// var GDPR_end = "expires=0;path=/; samesite=strict"; // make endcookie and path variable
 
document.cookie = GDPR_cookie + ";" + GDPR_end;
console.log("Added cookie: " + document.cookie);
 
accepted();
}
 
function reject_cookies(){
var GDPR_cookie = "GDPR=rejected"
 
var GDPR_year = new Date(); // create date
GDPR_year.setFullYear(GDPR_year.getFullYear() +1) // add 1 year from now
var GDPR_end = "expires=" + GDPR_year.toGMTString() + ";path=/; samesite=strict"; // make endcookie and path variable
// var GDPR_end = "expires=0;path=/; samesite=strict"; // make endcookie and path variable
 
document.cookie = GDPR_cookie + ";" + GDPR_end;
console.log("Added cookie: " + document.cookie);
 
GDPR_table_undecided.remove();
rejected();
}
 
// read cookie and set action here
function run_onload(){
}
/*
if (GDPR_state_value == "accepted"){
accepted();
rejected();
}
*/
if (GDPR_state_value == "undecided"){
undecided();
}
 
 
}
 
function undecided(){
}
 
function remove_GDPR_cookie(){
console.log("Removed cookie: " + document.cookie);
document.cookie = "GDPR=; expires=Thu, 18 Dec 2013 12:00:00 UTC; path=/; samesite=strict";
 
}
 
 
function accepted(){
var cookie_img = document.createElement("img");
 
cookie_img.setAttribute("id","cookie_img"); /* used for link */
cookie_img.onclick=undecided; /* create click event */
cookie_img.addEventListener('click', cookie_img.remove); /* add second click event, removing cookie image */
cookie_img.addEventListener('click', remove_GDPR_cookie); /* add third click event, removing cookie */
 
cookie_img.style.cursor="pointer";
cookie_img.src = "https://www.munichbeergardens.com/images/beer/Cookie.png";
document.body.appendChild(cookie_img);
 
cookie_img.style.position="fixed";
cookie_img.style.bottom="5px";
cookie_img.style.right="5px";
 
}
 
function rejected(){
 
var GDPR_table_rejected = document.createElement("table");
GDPR_table_rejected.setAttribute("id","GDPR_table_rejected");
var GDPR_row = document.createElement("tr");
var GDPR_cell = document.createElement("td");
 
var GDPR_accept_button = document.createElement("span");
GDPR_accept_button.setAttribute("id","GDPR_accept_button");
GDPR_accept_button.style.cursor="pointer";
GDPR_accept_button.appendChild(document.createTextNode("ACCEPT COOKIES"));
 
GDPR_accept_button.onclick=accept_cookies;
 
GDPR_table_rejected.appendChild(GDPR_row);
GDPR_row.appendChild(GDPR_cell);
 
GDPR_cell.appendChild(GDPR_accept_button);
 
document.body.appendChild(GDPR_table_rejected);
 
GDPR_table_rejected.style.width="100%";
GDPR_table_rejected.style.height="100%";
GDPR_table_rejected.style.border="1px dashed blue";
GDPR_table_rejected.style.textAlign="center";
GDPR_table_rejected.style.position="fixed";
GDPR_table_rejected.style.bottom="0";
GDPR_accept_button.style.border="1px solid green";
GDPR_table_rejected.style.verticalAlign="middle"; /* some old IE convention */
}

Navigation menu