Difference between revisions of "MediaWiki:Common.js"

From Camp_2015_Wiki
Jump to: navigation, search
Line 36: Line 36:
 
}
 
}
  
window.setTimeout(prepareCalendar, 3000);
+
window.setTimeout(prepareCalendar, 1000);

Revision as of 10:48, 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="#" onClick="openCalendar();">show calendar</a>';
  switchLink.style.display = 'block';
}

function openCalendar() {
  var switchLink = document.getElementById("showvillagecalendar");
  switchLink.innerHTML = '<a href="#" 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="#" onClick="openCalendar();">show calendar</a>';
  var villageCalendar = document.getElementById("villagecalendar");
  villageCalendar.style.display = 'none';
}

window.setTimeout(prepareCalendar, 1000);