Changes

MediaWiki:Common.js

8,136 bytes added, 19 February
no edit summary
/* Any JavaScript here will be loaded for all users on every page load. */
/* initialise the large graphic animation */window.onloadtestglob =function(){animator()'test';}
/* start animator() onload
https://www.mediawiki.org/wiki/ResourceLoader/Legacy_JavaScript#addOnloadHook
*/
if jQuery(document.location.href == "http://www.madacamp.com/Test"){//alertfunction(document.cookie$ );} /****************************************************/  var gallery = [/*{ img: 'Big_fish_001.jpg', caption: '', url: 'Big_fish' },*/{ img: 'Soavinandriamanitra_Culture_Park_banner_001.jpg', caption: 'Soavinandriamanitra Culture Park', url: 'Soavinandriamanitra_Culture_Park' },{ img: 'Madagasikara_Airways_banner_007.png', caption: '', url: 'Madagasikara_Airways' },{ img: 'Floribis_banner_001_v3.jpg', caption: '', url: 'Floribis' },{ img: 'PALA_banner_007.jpg', caption: '', url: 'PALA' },/*{ img: 'Hotel_Colbert_banner_002_v1.jpg', caption: '', url: 'Hotel_Colbert' },{ img: 'Hotel_Colbert_banner_008_v1.jpg', caption: '', url: 'Hotel_Colbert' },{ img: 'Hotel_Colbert_banner_006_v1.jpg', caption: '', url: 'Hotel_Colbert' },{ img: 'Hotel_Colbert_banner_007_v1.jpg', caption: '', url: 'Hotel_Colbert' },{ img: 'Hotel_Colbert_banner_010_v1.jpg', caption: '', url: 'Hotel_Colbert' },{ img: 'Hotel_Colbert_banner_004_v1.jpg', caption: '', url: 'Hotel_Colbert' },*/{ img: 'Chez_Haga_banner_001.jpg', caption: '', url: 'Chez_Haga' },{ img: 'Le_Phare_banner_001_v1.jpg', caption: '', url: 'Le_Phare'},{ img: 'Ocean Momo banner 004.png', caption: '', url: 'Ocean Momo'},{ img: 'PALA_banner_006.jpg', caption: '', url: 'PALA' },/*{ img: 'Travel_Exchange_banner_001.jpg', caption: '', url: 'Travel_Exchange'},*/{ img: 'Le_rossini_banner_v1_world_class.jpg', caption: '', url: 'Le_Rossini'},{ img: 'HomeoPharma_banner_003_en.jpg', caption: '', url: 'HomeoPharma'},{ img: 'Cent_pour_Cent_banner_001.jpg', caption: '', url: 'CENT_pour_CENT'},/*{ img: 'Chocolat_Madagascar_banner_002.jpg', caption: '', url: 'Chocolat_Madagascar'},*/{ img: 'Hotel_de_la_Poste_Ramena_Annexe_banner_001.jpg', caption: '', url: 'Hotel_de_la_Poste_Annexe'} ]   var playstate = "auto";caption_align = "center";slideshow_timeout = 2000; /* create random cycle value on first request but avoid 0 as the entry is not used in final array */ var madacycle_array_index = gallery.length -1;var first_madacycle_index = Math.round(madacycle_array_index * Math.randomanimator()); if (first_madacycle_index == 0){first_madacycle_index = 1cycle = first_madacycle_index; speed = 8000; function change_map(){document.getElementById('map1').style.width = '100%';document.getElementById('map1').style.height = '100px';}
if (document.location.href == "http://www.madacamp.com/MediaWiki:Common.js"){
//alert('gallery.length ' + gallery.length);
//alert('gallery.length -1 ' + madacycle_array_index);
// alert('cycle: ' + cycle);// alert('Math.round ' + first_madacycle_index);
//change_map;
}
 
// "Le_Lagon_Blanc_banner_01.gif",
"Travel_Exchange_banner_01.png",
// "Croc_Farm_banner_01Croc_Farm_banner_004.jpg",
"PALA_banner_01.png",
"La_Casa_en_Falafy_banner_02.jpg",
// "/admin/madacamp.com/redirect.cgi?url=/Le_Lagon_Blanc",
"/admin/madacamp.com/redirect.cgi?url=/Travel_Exchange",
// "/admin/madacamp.com/redirect.cgi?url=/Croc_Farm",
"/admin/madacamp.com/redirect.cgi?url=/PALA",
"/admin/madacamp.com/redirect.cgi?url=/La_Casa_en_Falafy",
/* end rotaing banner */
 
 
 
 
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','https://www.google-analytics.com/analytics.js','ga');
 
ga('create', 'UA-33601521-1', 'auto');
ga('send', 'pageview');
 
 
/* emulate sticky CSS */
if (document.getElementById('p-visit') !=null) {
window.onscroll = function() {
var header_height = document.getElementById("p-visit").scrollHeight;
 
var extra_scroll = 0;
 
if (document.getElementById('p-tb') !=null) {
var extra_scroll = 200;
}
 
if (window.scrollY + 330 - extra_scroll > header_height){
document.getElementById("p-visit").style.position="fixed";
document.getElementById("p-visit").style.top="0px";
}
else{
document.getElementById("p-visit").style.position="static";
}
}
}
 
/* GDPR */
 
if (window.addEventListener)
{
window.addEventListener('load', run_onload, false);
}
 
function accept_cookies(){
 
/* if GDPR_table_rejected exists, remove it */
var 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 */
var GDPR_table_undecided = document.getElementById("GDPR_table_undecided");
if (typeof(GDPR_table_undecided) !== 'undefined' && GDPR_table_undecided!== null){
GDPR_table_undecided.remove();
}
 
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(){
 
GDPR_state_value = "undecided";
 
if(document.cookie.indexOf("GDPR") != -1){
 
var state_pos = document.cookie.indexOf("GDPR=");
var state_start = state_pos + 5;
var state_end = state_start + 8;
GDPR_state_value = document.cookie.substring(state_start,state_end);
console.log(GDPR_state_value);
console.log(document.cookie);
}
 
if (GDPR_state_value == "accepted"){
accepted();
}
 
if (GDPR_state_value == "rejected"){
rejected();
}
 
 
if (GDPR_state_value == "undecided"){
undecided();
}
 
 
}
 
 
function undecided(){
 
var GDPR_table_undecided = document.createElement("table");
GDPR_table_undecided.setAttribute("id","GDPR_table_undecided");
var GDPR_row = document.createElement("tr");
var GDPR_cell = document.createElement("td");
 
var GDPR_reject_button = document.createElement("span");
GDPR_reject_button.setAttribute("id","GDPR_reject_button");
GDPR_reject_button.style.cursor="pointer";
GDPR_reject_button.appendChild(document.createTextNode("REJECT COOKIES"));
 
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_reject_button.onclick=reject_cookies;
GDPR_accept_button.onclick=accept_cookies;
 
GDPR_table_undecided.appendChild(GDPR_row);
GDPR_row.appendChild(GDPR_cell);
 
GDPR_cell.appendChild(document.createElement("br"));
 
 
GDPR_cell.appendChild(document.createTextNode("This site requires the use of cookies to comply with the "));
 
var a = document.createElement('a');
var GDPR_link = document.createTextNode("GDPR ");
a.appendChild(GDPR_link);
a.href = "https://en.wikipedia.org/wiki/General_Data_Protection_Regulation";
a.title = a.href;
GDPR_cell.appendChild(a);
 
GDPR_cell.appendChild(document.createTextNode(" and "));
 
var a = document.createElement('a');
var GOOGLE_link = document.createTextNode("Google's privacy policy");
a.appendChild(GOOGLE_link);
a.href = "https://policies.google.com/privacy";
a.title = a.href;
GDPR_cell.appendChild(a);
GDPR_cell.appendChild(document.createTextNode(". Cookies are used for "));
 
var a = document.createElement('a');
var GOOGLE_ADS_link = document.createTextNode("ads personaliation");
a.appendChild(GOOGLE_ADS_link);
a.href = "https://policies.google.com/technologies/partner-sites";
a.title = a.href;
GDPR_cell.appendChild(a);
GDPR_cell.appendChild(document.createTextNode("."));
 
GDPR_cell.appendChild(document.createElement("br"));
 
 
GDPR_cell.appendChild(GDPR_reject_button);
GDPR_cell.appendChild(GDPR_accept_button);
 
 
 
document.body.appendChild(GDPR_table_undecided);
 
GDPR_table_undecided.style.width="100%";
GDPR_table_undecided.style.backgroundColor="#f4d500"; /* yellow */
GDPR_table_undecided.style.backgroundColor="#f9f9f9";
GDPR_table_undecided.style.borderTop="dashed 1px #3f8a50";
GDPR_table_undecided.style.opacity="95%";
GDPR_table_undecided.style.textAlign="center";
GDPR_table_undecided.style.position="fixed";
GDPR_table_undecided.style.bottom="0";
GDPR_table_undecided.style.verticalAlign="middle"; /* some old IE convention */
GDPR_table_undecided.style.display="none"; /* hide GTPR table */
 
/* reject button styles */
GDPR_reject_button.style.backgroundColor="#d34603";
GDPR_reject_button.style.color="#fffcf3";
GDPR_reject_button.style.padding="12px 20px";
GDPR_reject_button.style.border="none";
GDPR_reject_button.style.textAlign="center";
GDPR_reject_button.style.borderRadius=" 20px";
GDPR_reject_button.style.cursor="pointer";
GDPR_reject_button.style.fontSize="105%";
GDPR_reject_button.style.fontWeight="bold";
GDPR_reject_button.style.minWidth="160px";
GDPR_reject_button.style.display="inline-block";
GDPR_reject_button.style.margin="10px";
/* accept button styles */
GDPR_accept_button.style.backgroundColor="#3f8a50";
GDPR_accept_button.style.color="#fffcf3";
GDPR_accept_button.style.padding="12px 20px";
GDPR_accept_button.style.border="none";
GDPR_accept_button.style.textAlign="center";
GDPR_accept_button.style.borderRadius=" 20px";
GDPR_accept_button.style.cursor="pointer";
GDPR_accept_button.style.fontSize="105%";
GDPR_accept_button.style.fontWeight="bold";
GDPR_accept_button.style.minWidth="160px";
GDPR_accept_button.style.display="inline-block";
GDPR_accept_button.style.margin="10px";
}
 
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.madacamp.com/images/madagascar/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);
 
 
GDPR_cell.appendChild(document.createElement("br"));
 
GDPR_cell.appendChild(document.createTextNode("This site requires the use of cookies to comply with the "));
 
var a = document.createElement('a');
var GDPR_link = document.createTextNode("GDPR ");
a.appendChild(GDPR_link);
a.href = "https://en.wikipedia.org/wiki/General_Data_Protection_Regulation";
a.title = a.href;
GDPR_cell.appendChild(a);
 
GDPR_cell.appendChild(document.createTextNode(" and "));
 
var a = document.createElement('a');
var GOOGLE_link = document.createTextNode("Google's privacy policy");
a.appendChild(GOOGLE_link);
a.href = "https://policies.google.com/privacy";
a.title = a.href;
GDPR_cell.appendChild(a);
GDPR_cell.appendChild(document.createTextNode(". Cookies are used for "));
 
var a = document.createElement('a');
var GOOGLE_ADS_link = document.createTextNode("ads personaliation");
a.appendChild(GOOGLE_ADS_link);
a.href = "https://policies.google.com/technologies/partner-sites";
a.title = a.href;
GDPR_cell.appendChild(a);
GDPR_cell.appendChild(document.createTextNode("."));
 
GDPR_cell.appendChild(document.createElement("br"));
 
document.body.appendChild(GDPR_table_rejected);
 
GDPR_table_rejected.style.width="100%";
GDPR_table_rejected.style.height="100%";
GDPR_table_rejected.style.backgroundColor="#f9f9f9";
GDPR_table_rejected.style.opacity="95%";
GDPR_table_rejected.style.textAlign="center";
GDPR_table_rejected.style.position="fixed";
GDPR_table_rejected.style.bottom="0";
GDPR_table_rejected.style.verticalAlign="middle"; /* some old IE convention */
/* accept button styles */
GDPR_accept_button.style.backgroundColor="#3f8a50";
GDPR_accept_button.style.color="#fffcf3";
GDPR_accept_button.style.padding="12px 20px";
GDPR_accept_button.style.border="none";
GDPR_accept_button.style.textAlign="center";
GDPR_accept_button.style.borderRadius=" 20px";
GDPR_accept_button.style.cursor="pointer";
GDPR_accept_button.style.fontSize="105%";
GDPR_accept_button.style.fontWeight="bold";
GDPR_accept_button.style.minWidth="160px";
GDPR_accept_button.style.display="inline-block";
GDPR_accept_button.style.margin="10px";
}