Skip to content

Instantly share code, notes, and snippets.

@andrewgilmartin
Created April 23, 2016 14:25
Show Gist options
  • Save andrewgilmartin/1cdcbc5b313fd7a42a71a30f57f172bd to your computer and use it in GitHub Desktop.
Save andrewgilmartin/1cdcbc5b313fd7a42a71a30f57f172bd to your computer and use it in GitHub Desktop.
<div id="85C18603-69F2-4331-AD8C-2CA0D7139DCA"></div>
<script>
(function (id) {
var e = [
{ date: '2016-05-4', times: '6-9 PM', location: "Kingston Library", url: "http://www.greatswamp.info/2016/04/game-nights-wednesday-thursday-may-4-5.html" },
{ date: '2016-05-5', times: '6-9 PM', location: "Kingston Library", url: "http://www.greatswamp.info/2016/04/game-nights-wednesday-thursday-may-4-5.html" }
];
var w = [ 'Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat' ];
var m = [ 'Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec' ];
var table = "<table>";
for ( var i = 0; i < e.length; i += 1 ) {
var date = new Date( e[i].date );
table += "<tr style=\"cursor: pointer\" onclick=\"window.location.href = '"+e[i].url+"'\">"
+ "<td>" + w[date.getDay()] + "</td>"
+ "<td>" + m[date.getMonth()] + " " + date.getDate() + "</td>"
+ "<td>" + e[i].times + "</td>"
+ "<td>" + e[i].location + "</td>"
+ "</tr>";
}
table += "</table>";
document.getElementById("85C18603-69F2-4331-AD8C-2CA0D7139DCA").insertAdjacentHTML('beforeend', table );
})();
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment