function genDays() {
	document.getElementById("calendarDays").innerHTML = "";

	var tmpDate = new Date(year, month, 0);
	var num = daysInMonth(month, year);
	var dayofweek = tmpDate.getDay();       // find where to start calendar day of week
	
	for (var i = 0; i <= dayofweek; i++) {
		var d = document.createElement("div");
		d.classList.add("day");
		d.classList.add("blank");
		document.getElementById("calendarDays").appendChild(d);
	}

	for (var i = 0; i < num; i++) {
		var tmp = i + 1;
		var d = document.createElement("div");
		d.id = "calendarday_" + i;
		d.className = "day";
		d.innerHTML = tmp;
		d.dataset.day = tmp;              // easier to retrieve the date
		
		/* ****************** Click Event ********************** */
        d.addEventListener('click', function(){
            this.classList.toggle('selected'); // changes color of day
			
			// if not in data set, select it
            if (!selectedDays.includes(this.dataset.day))
                selectedDays.push(this.dataset.day);

            else
                selectedDays.splice(selectedDays.indexOf(this.dataset.day), 1);
			console.log("GenCal", selectedDays);
			localStorage.setItem("temp", "temp");
			
			localStorage.setItem("selectedDays", selectedDays);
			
			// open url of page 
			// gets full URL of curent location
			var fullUrl = window.location.href;
			// start of URL
			var start = "http://";
			// splits URL at dashes
			var urlSplit = fullUrl.split("/");
			// gets main part of URL
			var partialURL = urlSplit[urlSplit.length-2];
			// adds the http:// and the main part of URL
			var url = start + partialURL;
			// add on extension
			if (views[view] == "Monthly") {
				url += "/monthly";
			} else if (views[view] == "Weekly") {
				url += "/weekly";
			} else {
				url += "/daily";
			}
				
			// open window
			window.open(url,"_self")
			localStorage.setItem("view", 2);
			
        });
        /* **************************************************** */
		document.getElementById("calendarDays").appendChild(d);
	}

	var clear = document.createElement("div");
	clear.className = "clear";
	document.getElementById("calendarDays").appendChild(clear);
}
// Possible TODO: add arrows to go forward, backward a week
Possible TODO: add arrows to go forward, backward a week
Possible TODO : add arrows to go forward backward a week
function genDays() {
	document.getElementById("calendarDays").innerHTML = "";
	var tmpDate = new Date(year, month, 0);
	var num = daysInMonth(month, year);
	var dayofweek = tmpDate.getDay();       
	for (var i = 0; i <= dayofweek; i++) {
		var d = document.createElement("div");
		d.classList.add("day");
		d.classList.add("blank");
		document.getElementById("calendarDays").appendChild(d);
	}
	for (var i = 0; i < num; i++) {
		var tmp = i + 1;
		var d = document.createElement("div");
		d.id = "calendarday_" + i;
		d.className = "day";
		d.innerHTML = tmp;
		d.dataset.day = tmp;              
        d.addEventListener('click', function(){
            this.classList.toggle('selected'); 
            if (!selectedDays.includes(this.dataset.day))
                selectedDays.push(this.dataset.day);
            else
                selectedDays.splice(selectedDays.indexOf(this.dataset.day), 1);
			console.log("GenCal", selectedDays);
			localStorage.setItem("temp", "temp");
			localStorage.setItem("selectedDays", selectedDays);
			var fullUrl = window.location.href;
			var start = "http://";
			var urlSplit = fullUrl.split("/");
			var partialURL = urlSplit[urlSplit.length-2];
			var url = start + partialURL;
			if (views[view] == "Monthly") {
				url += "/monthly";
			} else if (views[view] == "Weekly") {
				url += "/weekly";
			} else {
				url += "/daily";
			}
			window.open(url,"_self")
			localStorage.setItem("view", 2);
        });
		document.getElementById("calendarDays").appendChild(d);
	}
	var clear = document.createElement("div");
	clear.className = "clear";
	document.getElementById("calendarDays").appendChild(clear);
}
function genDays ( ) { document . getElementById ( "calendarDays" ) . innerHTML = "" ; var tmpDate = new Date ( year , month , 0 ) ; var num = daysInMonth ( month , year ) ; var dayofweek = tmpDate . getDay ( ) ; for ( var i = 0 ; i <= dayofweek ; i ++ ) { var d = document . createElement ( "div" ) ; d . classList . add ( "day" ) ; d . classList . add ( "blank" ) ; document . getElementById ( "calendarDays" ) . appendChild ( d ) ; } for ( var i = 0 ; i < num ; i ++ ) { var tmp = i + 1 ; var d = document . createElement ( "div" ) ; d . id = "calendarday_" + i ; d . className = "day" ; d . innerHTML = tmp ; d . dataset . day = tmp ; d . addEventListener ( 'click' , function ( ) { this . classList . toggle ( 'selected' ) ; if ( ! selectedDays . includes ( this . dataset . day ) ) selectedDays . push ( this . dataset . day ) ; else selectedDays . splice ( selectedDays . indexOf ( this . dataset . day ) , 1 ) ; console . log ( "GenCal" , selectedDays ) ; localStorage . setItem ( "temp" , "temp" ) ; localStorage . setItem ( "selectedDays" , selectedDays ) ; var fullUrl = window . location . href ; var start = "http://" ; var urlSplit = fullUrl . split ( "/" ) ; var partialURL = urlSplit [ urlSplit . length - 2 ] ; var url = start + partialURL ; if ( views [ view ] == "Monthly" ) { url += "/monthly" ; } else if ( views [ view ] == "Weekly" ) { url += "/weekly" ; } else { url += "/daily" ; } window . open ( url , "_self" ) localStorage . setItem ( "view" , 2 ) ; } ) ; document . getElementById ( "calendarDays" ) . appendChild ( d ) ; } var clear = document . createElement ( "div" ) ; clear . className = "clear" ; document . getElementById ( "calendarDays" ) . appendChild ( clear ) ; }
Possible TODO: add arrows to go forward, backward a week
Possible TODO : add arrows to go forward backward a week
// find where to start calendar day of week // easier to retrieve the date /* ****************** Click Event ********************** */ // changes color of day // if not in data set, select it // open url of page  // gets full URL of curent location // start of URL // splits URL at dashes // gets main part of URL // adds the http:// and the main part of URL // add on extension // open window /* **************************************************** */