MediaWiki:Common.js
From MadaCamp
Revision as of 07:20, 22 July 2014 by CampMaster (talk | contribs)
Note: After saving, you may have to bypass your browser's cache to see the changes.
- Firefox / Safari: Hold Shift while clicking Reload, or press either Ctrl-F5 or Ctrl-R (⌘-R on a Mac)
- Google Chrome: Press Ctrl-Shift-R (⌘-Shift-R on a Mac)
- Internet Explorer: Hold Ctrl while clicking Refresh, or press Ctrl-F5
- Opera: Go to Menu → Settings (Opera → Preferences on a Mac) and then to Privacy & security → Clear browsing data → Cached images and files.
/* Any JavaScript here will be loaded for all users on every page load. */ /* initialise the large graphic animation */ window.onload=function(){ animator(); } if (document.location.href == "http://www.madacamp.com/Test"){ //alert(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: 'Floribis_banner_001_v3.jpg', caption: '', url: 'Floribis' }, { 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: 'Travel_Exchange_banner_001.jpg', caption: '', url: 'Travel_Exchange'}, { img: 'Le_Rossini_banner_001.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'} ] 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.random()); if (first_madacycle_index == 0){ first_madacycle_index = 1 } cycle = 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; } /****************************************************/ 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_01.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 */