Upcoming Events
Upcoming Events front end for In Town and Around
by omni5cience
HTML
<link rel="stylesheet" href="//cdnjs.cloudflare.com/ajax/libs/chosen/1.0/chosen.css">
<script src="//cdnjs.cloudflare.com/ajax/libs/chosen/1.0/chosen-sprite.png"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/chosen/1.0/[email protected]"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/chosen/1.0/chosen.jquery.js"></script>
<script src="https://dl.dropboxusercontent.com/u/6519882/InTownAndAround/list.changed.min.js"></script>
<script src="https://dl.dropboxusercontent.com/u/6519882/InTownAndAround/brick-1.0beta6-byob/OpenSans-SemiBold.ttf"></script>
<link rel="stylesheet" href="https://dl.dropboxusercontent.com/u/6519882/InTownAndAround/brick-1.0beta7-byob/brick-1.0beta7.byob.min.css">
<script src="https://dl.dropboxusercontent.com/u/6519882/InTownAndAround/brick-1.0beta7-byob/brick-1.0beta7.byob.min.js"></script>
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
<div class="container">
<select data-placeholder="Choose a town..." multiple class="chosen-select towns" tabindex="1">
<option value='' disabled selected style='display:none;'>Choose a town...</option>
<option>Belleville</option>
<option>Bloomfield</option>
<optgroup label="The Caldwells">
<option>Caldwell</option>
<option>North Caldwell</option>
<option>West Caldwell</option>
</optgroup>
<option>Cedar Grove</option>
<option>Essex Fells</option>
<option>Fairfield</option>
<option>Glen Ridge</option>
<option>Irvington</option>
<option>Livingston</option>
<option>Maplewood</option>
<option>Millburn</option>
<option>Montclair</option>
<option>Newark</option>
<option>Nutley</option>
<optgroup label="The Oranges">
<option>East Orange</option>
<option>Orange</option>
<option>West Orange</option>
<option>South Orange</option>
...
CSS
body {
margin: 10px;
font-family: sans-serif;
background-color: white;
font-size: 18px;
min-width: 300px;
}
.container {
position: relative;
width: 590px;
width: 33em;
margin: 0 auto;
}
.chosen-select, .chosen-container {
width: 49.5% !important;
}
.calendar-container {
position: relative;
display: inline-block;
font-size: 13px;
width: 49%;
height: 27px;
outline: 1px solid #aaa;
}
.calendar-container .placeholder {
color: #666;
margin: 1px 0;
padding: 5px;
height: 15px;
}
.calendar-container .date-picker {
margin: 0 auto;
position: absolute;
left: 0;
right: 0;
}
.calendar-container.focused .date-picker {
border: 1px solid #5897FB;
}
.calendar-container.focused {
outline: none;
}
/*.calendar-container[focused="false"] .date-picker,
.calendar-container[focused="true"] .placeholder {
display: none;
}
.calendar-container[focused="true"] .date-picker,
.calendar-container[focused="false"] .placeholder {
display: inline-block;
}*/
.calendar-container .date-picker
/*.calendar-container.focused .placeholder*/ {
display: none;
}
.calendar-container.focused .date-picker,
.calendar-container .placeholder {
display: inline-block;
}
.start_date, .end_date {
text-decoration: underline;
}
/*
#event-list {
width: 590px;
width: 33em;
}
*/
.title {
margin: 0.2em 0;
color: #007dc5;
font-weight: 300;
}
.clear {
clear: both;
}
.event-item {
padding: 0.35em 1em 0.65em;
margin: 1em 0;
list-style: none;
background-color: #e6e7e8;
color: #231f20;
font-weight: 100;
}
.list {
padding-left: 0;
}
.event-info {
float: left;
width: 75%;
}
.more-info {
font-size: 24px;
font-weight: 600;
text-align: center;
margin-top: 4px;
width: 4.1em;
float: right;
border: 0;
line-height: normal;
padding: 9px 14px 9px;
/* This seems to be jittery when the page reflows */
...
JavaScript
$(".calendar-container").focus(function(){
$(this).toggleClass("focused", true);
}).blur(function(){
$(this).toggleClass("focused", false);
}).click(function(e){
$(this).focus();
});
$("body").click(function(){
$(this).focus();
});
//Try forcing it to focus on touch
// I'm having a stupid moment here, this doesn't work at all
/*
$(":not(.calendar-container *, x-calendar *)").on("touchend", function(e){
console.log(e);
$container = $(".calendar-container");
if ($container.hasClass("focused")) {
$container.toggleClass("focused", false)
}
});
*/
//Aug 30, 2013
// Remember Brick datepicker august 30 to oct bug
var options = {
valueNames: ["title", "description", "location", "town", "url", "phone", "start_date", "end_date"],
item: '<li class="event-item"><div class="event-container">\
<div class="event-info">\
<h3 class="title"></h3>\
<span class="location"></span>, \
<span class="town"></span>\
<div>\
<span class="start_date"></span>\
to:\
<span class="end_date"></span>\
</div>\
<div class="phone"></div>\
<summary class="description"></summary>\
</div>\
<a class="url"><button class="more-info">more info</button></a>\
<div class="clear"></div>\
</div></li>'
};
var values = [{
title: "Fake Event",
description: 'From an ancient "wandering star" to a modern day celestial laboratory, Saturn tantalizes the eye, spirit and mind. This ringed wonder has been explored with telescopes, flyby probes and now the orbiting Cassini spacecraft. Ongoing.',
location: "Newark Museum",
town: "Newark",
url: "http://www.newarkmuseum.org/",
phone: "973-596-6550",
start_date: new Date("Sep 05, 2013"),
end_date: new Date("Sep 08,...