Difference between revisions of "MediaWiki:Common.js"
From MadaCamp
CampMaster (talk | contribs) |
CampMaster (talk | contribs) |
||
(92 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
/* Any JavaScript here will be loaded for all users on every page load. */ | /* Any JavaScript here will be loaded for all users on every page load. */ | ||
− | + | testglob = 'test'; | |
− | |||
− | |||
− | |||
+ | /* start animator() onload | ||
+ | https://www.mediawiki.org/wiki/ResourceLoader/Legacy_JavaScript#addOnloadHook | ||
+ | */ | ||
− | + | jQuery( function( $ ) { | |
− | + | animator(); | |
− | + | } ); | |
− | |||
− | |||
− | |||
− | |||
− | |||
− | { | ||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | } | ||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | if (document.location.href == "http://www.madacamp.com/ | + | if (document.location.href == "http://www.madacamp.com/MediaWiki:Common.js"){ |
//alert('gallery.length ' + gallery.length); | //alert('gallery.length ' + gallery.length); | ||
//alert('gallery.length -1 ' + madacycle_array_index); | //alert('gallery.length -1 ' + madacycle_array_index); | ||
− | alert('cycle: ' + cycle); | + | //alert('cycle: ' + cycle); |
− | alert('Math.round ' + first_madacycle_index); | + | //alert('Math.round ' + first_madacycle_index); |
− | change_map; | + | //change_map; |
} | } | ||
− | |||
Line 99: | Line 63: | ||
// "Le_Lagon_Blanc_banner_01.gif", | // "Le_Lagon_Blanc_banner_01.gif", | ||
"Travel_Exchange_banner_01.png", | "Travel_Exchange_banner_01.png", | ||
− | + | "Croc_Farm_banner_004.jpg", | |
"PALA_banner_01.png", | "PALA_banner_01.png", | ||
"La_Casa_en_Falafy_banner_02.jpg", | "La_Casa_en_Falafy_banner_02.jpg", | ||
Line 127: | Line 91: | ||
// "/admin/madacamp.com/redirect.cgi?url=/Le_Lagon_Blanc", | // "/admin/madacamp.com/redirect.cgi?url=/Le_Lagon_Blanc", | ||
"/admin/madacamp.com/redirect.cgi?url=/Travel_Exchange", | "/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=/PALA", | ||
"/admin/madacamp.com/redirect.cgi?url=/La_Casa_en_Falafy", | "/admin/madacamp.com/redirect.cgi?url=/La_Casa_en_Falafy", | ||
Line 285: | Line 249: | ||
/* end rotaing banner */ | /* 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"; | ||
+ | } |
Latest revision as of 16:46, 19 February 2024
/* Any JavaScript here will be loaded for all users on every page load. */ testglob = 'test'; /* start animator() onload https://www.mediawiki.org/wiki/ResourceLoader/Legacy_JavaScript#addOnloadHook */ jQuery( function( $ ) { animator(); } ); 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; } /****************************************************/ var RecaptchaOptions = { theme : 'white' }; /* start rotating banner */ /* Banner 147x85 */ /* Add image and URL in array and upload/protect image and preload (first letter or image name must be capitalised) */ /* define the images directory including trailing slash */ var madacamp_banner_dir = '/images/madagascar/'; /* The arrays with images and their corresponding URLs */ var madacamp_banners = new Array("Anakao_banner.jpg", "Namako_banner_01.jpg", "Diego_Suarez_banner.jpg", "Baobab_Avenue_banner.png", "Sakalava_Bay_banner.jpg", "Morondava_banner.jpg", "Peter_Pan_banner.jpg", "Safari_Vezo_banner.jpg", "Ankarana_National_Park_banner_01.jpg", "Ankarafantsika_National_Park_banner_01.jpg", "Sambirano_banner_01.jpg", "Tana_Jacaranda_banner_01.jpg", "Hotel_Carlton_banner_01.jpg", "Ambohimanga_banner_01.jpg", // "Isalo_National_Park_banner_01.jpg", // "Isalo_National_Park_banner_02.jpg", // "Isalo_National_Park_banner_03.jpg", "Isalo_National_Park_banner_04.jpg", "Antsirabe_banner_01.jpg", "Chez_Haga_banner_01.jpg", // "Le_Lagon_Blanc_banner_01.gif", "Travel_Exchange_banner_01.png", "Croc_Farm_banner_004.jpg", "PALA_banner_01.png", "La_Casa_en_Falafy_banner_02.jpg", "Floribis_banner_06.jpg"); var madacamp_links = new Array("/admin/madacamp.com/redirect.cgi?url=/Anakao", "/admin/madacamp.com/redirect.cgi?url=/Namako", "/admin/madacamp.com/redirect.cgi?url=/Diego_Suarez", "/admin/madacamp.com/redirect.cgi?url=/Baobab_Avenue", "/admin/madacamp.com/redirect.cgi?url=/Sakalava_Bay", "/admin/madacamp.com/redirect.cgi?url=/Morondava", "/admin/madacamp.com/redirect.cgi?url=/Peter_Pan", "/admin/madacamp.com/redirect.cgi?url=/Safari_Vezo", "/admin/madacamp.com/redirect.cgi?url=/Ankarana_National_Park", "/admin/madacamp.com/redirect.cgi?url=/Ankarafantsika_National_Park", "/admin/madacamp.com/redirect.cgi?url=/Sambirano", "/admin/madacamp.com/redirect.cgi?url=/Tana_Jacaranda", "/admin/madacamp.com/redirect.cgi?url=/Hotel_Carlton", // "/admin/madacamp.com/redirect.cgi?url=/Ambohimanga", // "/admin/madacamp.com/redirect.cgi?url=/Isalo_National_Park", // "/admin/madacamp.com/redirect.cgi?url=/Isalo_National_Park", "/admin/madacamp.com/redirect.cgi?url=/Isalo_National_Park", "/admin/madacamp.com/redirect.cgi?url=/Isalo_National_Park", "/admin/madacamp.com/redirect.cgi?url=/Antsirabe", "/admin/madacamp.com/redirect.cgi?url=/Chez_Haga", // "/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", "/admin/madacamp.com/redirect.cgi?url=/Floribis"); function start_animation(){ setTimeout('madacamp_blender()',10000); /* 15 second */ } madacamp_banner_01 = new Image(147,85); madacamp_banner_01.src = madacamp_banner_dir + "Anakao_banner.jpg"; madacamp_banner_02 = new Image(147,85); madacamp_banner_02.src = madacamp_banner_dir + "Namako_banner_01.jpg"; madacamp_banner_03 = new Image(147,85); madacamp_banner_03.src = madacamp_banner_dir + "Diego_Suarez_banner.jpg"; madacamp_banner_04 = new Image(147,85); madacamp_banner_04.src = madacamp_banner_dir + "Baobab_Avenue_banner.png"; madacamp_banner_05 = new Image(147,85); madacamp_banner_05.src = madacamp_banner_dir + "Sakalava_Bay_banner.jpg"; madacamp_banner_06 = new Image(147,85); madacamp_banner_06.src = madacamp_banner_dir + "Morondava_banner.jpg"; madacamp_banner_07 = new Image(147,85); madacamp_banner_07.src = madacamp_banner_dir + "Peter_Pan_banner.jpg"; madacamp_banner_08 = new Image(147,85); madacamp_banner_08.src = madacamp_banner_dir + "Safari_Vezo_banner.jpg"; madacamp_banner_09 = new Image(147,85); madacamp_banner_09.src = madacamp_banner_dir + "Ankarana_National_Park_banner_01.jpg"; madacamp_banner_11 = new Image(147,85); madacamp_banner_11.src = madacamp_banner_dir + "Ankarafantsika_National_Park_banner_01.jpg"; madacamp_banner_12 = new Image(147,85); madacamp_banner_12.src = madacamp_banner_dir + "Sambirano_banner_01.jpg"; madacamp_banner_13 = new Image(147,85); madacamp_banner_13.src = madacamp_banner_dir + "Tana_Jacaranda_banner_01.jpg"; madacamp_banner_14 = new Image(147,85); madacamp_banner_14.src = madacamp_banner_dir + "Hotel_Carlton_banner_01.jpg"; madacamp_banner_15 = new Image(147,85); madacamp_banner_15.src = madacamp_banner_dir + "Ambohimanga_banner_01.jpg"; //madacamp_banner_16 = new Image(147,85); //madacamp_banner_16.src = madacamp_banner_dir + "Isalo_National_Park_banner_01.jpg"; //madacamp_banner_17 = new Image(147,85); //madacamp_banner_17.src = madacamp_banner_dir + "Isalo_National_Park_banner_02.jpg"; //madacamp_banner_18 = new Image(147,85); //madacamp_banner_18.src = madacamp_banner_dir + "Isalo_National_Park_banner_03.jpg"; madacamp_banner_19 = new Image(147,85); madacamp_banner_19.src = madacamp_banner_dir + "Isalo_National_Park_banner_04.jpg"; madacamp_banner_20 = new Image(147,85); madacamp_banner_20.src = madacamp_banner_dir + "Antsirabe_banner_01.jpg"; madacamp_banner_21 = new Image(147,85); madacamp_banner_21.src = madacamp_banner_dir + "Chez_Haga_banner_01.jpg"; //madacamp_banner_22 = new Image(147,85); //madacamp_banner_22.src = madacamp_banner_dir + "Le_Lagon_Blanc_banner_01.gif"; madacamp_banner_23 = new Image(147,85); madacamp_banner_23.src = madacamp_banner_dir + "Travel_Exchange_banner_01.png"; madacamp_banner_24 = new Image(147,85); madacamp_banner_24.src = madacamp_banner_dir + "Croc_Farm_banner_01.jpg"; madacamp_banner_25 = new Image(147,85); madacamp_banner_25.src = madacamp_banner_dir + "PALA_banner_01.png"; madacamp_banner_26 = new Image(147,85); madacamp_banner_26.src = madacamp_banner_dir + "Floribis_banner_06.jpg"; madacamp_banner_28 = new Image(147,85); madacamp_banner_28.src = madacamp_banner_dir + "La_Casa_en_Falafy_banner_02.jpg"; function madacamp_swap(){ madacamp_opacity = 0; IE_opacity = 0; if (navigator.appVersion.indexOf("MSIE") != -1){ document.getElementById("blendinger").style.filter = "alpha(opacity=0)"; madacamp_interval = setInterval("blendinger_IE()",50) } else { document.getElementById("blendinger").style.opacity=0; madacamp_interval = setInterval("blendinger_opacity()",50) } } function blendinger_IE(){ if (IE_opacity < 100){ IE_opacity = IE_opacity +4; document.getElementById("blendinger").style.filter = "alpha(opacity="+IE_opacity+")"; } else{ clearInterval(madacamp_interval); IE_count = 0; } } function blendinger_opacity(){ if (madacamp_opacity < 1){ madacamp_opacity = (Math.floor(madacamp_opacity * 100) +4) / 100; document.getElementById("blendinger").style.opacity=madacamp_opacity; } else{ clearInterval(madacamp_interval); } } var madacamp_array_index = madacamp_links.length -1; var first_madacamp_index = Math.round(madacamp_array_index * Math.random()) var madacamp_cycle = first_madacamp_index; var madacamp_total = madacamp_banners.length -1; var madacamp_link = madacamp_links[madacamp_cycle]; /* initially the first */ function madacamp_blender(){ /* first set current image as background */ document.getElementById('background_image').style.backgroundImage='url('+madacamp_banner_dir+madacamp_banners[madacamp_cycle]+')'; madacamp_cycle++; if (madacamp_cycle == madacamp_banners.length){ madacamp_cycle = 0; } madacamp_swap(); setTimeout("document.images.madacamp_animation.src=madacamp_banner_dir + madacamp_banners[madacamp_cycle];",10) madacamp_link = madacamp_links[madacamp_cycle] /* update link values */ } /* 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"; }