Difference between revisions of "MediaWiki:Common.js"

From Camp_2015_Wiki
Jump to: navigation, search
Line 18: Line 18:
 
function prepareCalendar() {
 
function prepareCalendar() {
 
   var switchLink = document.getElementById("showvillagecalendar");
 
   var switchLink = document.getElementById("showvillagecalendar");
   switchLink.innerHTML = '<a href="#" onClick="openCalendar();">show calendar</a>';
+
   switchLink.innerHTML = '<a href="#calendar" name="#calendar" onClick="openCalendar();">show calendar</a>';
 
   switchLink.style.display = 'block';
 
   switchLink.style.display = 'block';
 
}
 
}
Line 24: Line 24:
 
function openCalendar() {
 
function openCalendar() {
 
   var switchLink = document.getElementById("showvillagecalendar");
 
   var switchLink = document.getElementById("showvillagecalendar");
   switchLink.innerHTML = '<a href="#" onClick="closeCalendar();">hide calendar</a>';
+
   switchLink.innerHTML = '<a href="#calendar" name="#calendar" onClick="closeCalendar();">hide calendar</a>';
 
   var villageCalendar = document.getElementById("villagecalendar");
 
   var villageCalendar = document.getElementById("villagecalendar");
 
   villageCalendar.style.display = 'block';
 
   villageCalendar.style.display = 'block';
Line 31: Line 31:
 
function closeCalendar() {
 
function closeCalendar() {
 
   var switchLink = document.getElementById("showvillagecalendar");
 
   var switchLink = document.getElementById("showvillagecalendar");
   switchLink.innerHTML = '<a href="#" onClick="openCalendar();">show calendar</a>';
+
   switchLink.innerHTML = '<a href="#calendar" name="#calendar" onClick="openCalendar();">show calendar</a>';
 
   var villageCalendar = document.getElementById("villagecalendar");
 
   var villageCalendar = document.getElementById("villagecalendar");
 
   villageCalendar.style.display = 'none';
 
   villageCalendar.style.display = 'none';

Revision as of 10:50, 6 August 2015

/** assings congress date information to body tag **/
function setupCalendar() {
  var bodyTag = null;
  try {
    bodyTag = document.getElementsByTagName("body")[0];
    bodyTag.year = 2015;
    bodyTag.month = 8;
    bodyTag.days = [13, 14, 15, 16, 17];
    return bodyTag;
  } catch(e) {
    return null;
  }
}

console.log("setup calendar dates");
var body = setupCalendar();

function prepareCalendar() {
  var switchLink = document.getElementById("showvillagecalendar");
  switchLink.innerHTML = '<a href="#calendar" name="#calendar" onClick="openCalendar();">show calendar</a>';
  switchLink.style.display = 'block';
}

function openCalendar() {
  var switchLink = document.getElementById("showvillagecalendar");
  switchLink.innerHTML = '<a href="#calendar" name="#calendar" onClick="closeCalendar();">hide calendar</a>';
  var villageCalendar = document.getElementById("villagecalendar");
  villageCalendar.style.display = 'block';
}

function closeCalendar() {
  var switchLink = document.getElementById("showvillagecalendar");
  switchLink.innerHTML = '<a href="#calendar" name="#calendar" onClick="openCalendar();">show calendar</a>';
  var villageCalendar = document.getElementById("villagecalendar");
  villageCalendar.style.display = 'none';
}

window.setTimeout(prepareCalendar, 1000);