Commit a6a4cafa authored by Daniel W Bond's avatar Daniel W Bond
Browse files

additional file removal

parent c85edf77
This diff is collapsed.
This diff is collapsed.
/*Bootstrap*/
.navbar-default {
background-color: rgba(252,252,255,0.96);
margin-bottom: 0;
}
.navbar-toggle {
background-color: white;
}
.navbar-brand {
padding: 13px 18px;
font-size: 26px;
}
.navbar-default .navbar-nav > .active > a {
background: rgba(255,255,255,0.50);
}
.navbar-default .navbar-nav > .active > a:hover {
background: rgba(255,255,255,0.50);
color: #000;
}
/*Styles*/
body, html {
height: 100%;
}
a{
color: #006633;
}
a:hover{
color: Green;
}
a:visited{
color: #003C00;
}
.holder{
min-height: 100%;
position: relative;
}
body {
background: url(/static/img/southside.jpg) center top no-repeat fixed;
background-size: cover;
padding-top: 50px;
}
.title{
text-align: center;
font-size: 50px;
font-weight: 900;
margin-top:30px;
line-height: 50px;
}
#grid{
display: none;
}
#grid div[class*='span']{
margin-top:10px;
margin-bottom:10px;
line-height:1;
}
.grid-box{
margin-top: 10px;
margin-bottom: 10px;
cursor: pointer;
}
.grid-box .facility{
text-align:center;
background-color: white;
padding: 10px 2px;
margin-top: 5px;
margin-bottom: 5px;
height: 50px;
font-size: 21px;
overflow-y: hidden;
}
.opened{
color:#141414;
}
.facility.closing{
color: #FFCC33;
}
.facility.closed{
color: rgba(81,81,81,0.9);
background-color: rgba(255,255,255,0.65);
}
.facility .building{
font-size: 15px;
padding-left: 2px;
}
.search-row{
text-align: center;
padding-top: 15px;
}
ul.ui-autocomplete {
list-style: none;
visibility: hidden;
}
.campusDropdown{
font-size: 20px;
margin-top: 10px;
}
.gmu-brand {
padding: 0px 5px 0px 12px;
margin: none;
display: block;
text-align: center;
}
.gmu-logo {
width: 150px;
height: auto;
}
.main-container{
padding-bottom: 200px;
margin-top: 20px;
}
#footer{
background-color: rgba(252,252,255,0.96);
position: absolute;
bottom: 0;
left: 0;
right: 0;
height: 165px;
text-align: center;
font-size: 15px;
}
.footer-row {
margin: 0;
background-color: rgba(252,252,255,0.96);;
}
.footer-text{
width:100%;
text-align:center;
margin-top: 12px;
}
#footer-line {
display: none;
}
#info-body {
width: 100%;
background-color: #FFF;
padding-top: 10px;
padding-bottom: 10px;
position: fixed;
top: 51px;
bottom: 0;
z-index: 1030;
display: none;
overflow-y: scroll;
}
#info-name {
font-size: 22px;
margin-bottom: 5px;
}
#info-close, #about-close {
position: absolute;
right: 0;
padding: 6px 19px 19px 19px;
cursor: pointer;
z-index: 10;
opacity: 0.4;
}
#about-close-nav {
opacity: 0.5;
padding: 2px 15px 0px 15px;
display: none;
}
#info-close:hover, #about-close:hover, #about-close-nav:hover {
opacity: 1;
}
#about-body{
position: fixed;
z-index: 1040;
top: 51px;
width: 100%;
bottom: 0;
overflow: scroll;
display: none;
}
#about-container {
width: 100%;
overflow-y: auto;
}
.about-content {
background-color: #FFF;
padding-bottom: 20px;
}
#about-example{
background-color: rgba(255,255,255,0.4);
}
.about-top-p{
margin-top: 20px;
}
#about-link{
cursor: pointer;
}
.grid-blur{
opacity: 0.54;
-webkit-filter: blur(3px);
-moz-filter: blur(3px);
-o-filter: blur(3px);
-ms-filter: blur(3px);
filter: blur(3px);
}
.main-container{
/* Transitions for .grid-blur */
-webkit-transition: opacity 356ms ease-in-out, -webkit-filter 356ms ease-in-out;
-moz-transition: opacity 356ms ease-in-out, -moz-filter 356ms ease-in-out;;
-o-transition: opacity 356ms ease-in-out, -o-filter 356ms ease-in-out;;
-ms-transition: opacity 356ms ease-in-out, -ms-filter 356ms ease-in-out;
transition: opacity 356ms ease-in-out, "filter" 356ms ease-in-out;
}
.clip-height{
max-height: 60%;
}
/* Custom Responsive Classes */
/* xs */
@media (min-width: 480px) {
}
/* sm */
@media (min-width: 768px) {
#info-close {
padding: 6px 31px 31px 31px;
}
#about-close {
display: none;
}
}
/* md */
@media (min-width: 992px) {
#footer-line {
display: inline;
}
.gmu-brand {
position: absolute;
right: 15px;
}
.main-container{
padding-bottom: 150px;
}
#footer {
height: 100px;
background-color: rgba(252,252,255,0.82)
}
.navbar {
position: relative;
}
body{
padding-top: 0px;
}
.navbar-default {
background-color: rgba(252,252,255,0.82);
}
#info-body {
position: static;
cursor: pointer;
overflow-y: auto;
}
#info-close {
display: none;
}
#about-body {
bottom: 100px;
}
.navbar-nav li{
margin-left: 10px;
margin-right: 10px;
}
}
/* lg */
@media (min-width: 1200px) {
}
// Toggles the about page
$(document).ready(function(){
var lastosition;
$('#about-link').click(function(){
// Keep track of the users vertical position so it can be scolled back
//to when the window is closed
position = $(window).scrollTop();
$('#about-body').slideToggle(356);
$('.main-container').toggleClass('grid-blur');
$(this).parent().toggleClass('active');
// Replace "About" link with the close icon
$('#about-link-text, #about-close-nav').toggle();
if ($(window).width() >= 992){
// Animation for large displays
$('.main-container').slideToggle(356)
} else {
// Hide grid to disable scrolling when info body is active
// The delay prevents buggy scrolling on some mobile browsers
window.setTimeout(function() { $('.main-container').toggle() }, 350);
$('html, body').animate({
scrollTop: 0
}, 500);
}
});
$('#about-close').click(function(){
$('#about-link').parent().removeClass('active');
$('#about-body').slideUp(356);
$('.main-container').removeClass('grid-blur');
$('body').removeClass('clip');
$('#about-link-text').show();
$('#about-close-nav').hide();
$('.main-container').show();
// Scroll back to saved position
$('html, body').animate({
scrollTop: position
}, 500);
});
});
This diff is collapsed.
This diff is collapsed.
var facilities = JSON.parse(localStorage['facilities'] || "[]" );
function correct_grid_overflow(){
// This function ensures that all text inside the grid-boxes display nicely on one line.
$('.facility').css('font-size', '').css('overflow-y', 'scroll');
$('.facility').each(function() {
// Overflow is detected if the height of the box is less than
// the clipped scroll height of the box.
while ($(this).height() > 0 && $(this).outerHeight() < $(this)[0].scrollHeight) {
// Shrink the elements that overflow until their contents fit on one line.
var newSize = parseInt($(this).css('font-size')) - 1;
$(this).css('font-size', newSize + 'px');
$(this).children('.building').css('font-size', newSize - 6 + 'px');
// Calulated padding is added to ensure the text remains vertically centered.
$(this).css('padding-top', 31 - newSize + 'px');
}
});
$('.facility').css('overflow-y', '');
}
function sort_facilities(filtered_facilities) {
var open = $.grep(filtered_facilities,
function (r, idx) { return (r.open === true) });
var closed = $.grep(filtered_facilities,
function (r, idx) { return (r.open === false) });
return $.merge(open, closed);
}
function construct_grid(filtered_facilities) {
$('#grid').empty();
$('#grid').html('<div class="row"></div>');
if (filtered_facilities.length == 0) {
$('#grid').append('<span class="col-md-8 offset2 grid-box" id="no-results">No results found.</span>');
$('#grid').show();
return;
}
sorted_facilities = sort_facilities(filtered_facilities);
$.each(sorted_facilities, function (idx, facility) {
var open_class = 'closed';
if (facility.open) {
open_class = 'opened';
}
// Append the data into the grid scaffolding.
// Note that identical facilities can be labeled via location. If there text in square brackets
// next to a restuarant name, the text will be formatted as next to it.
$('#grid .row').append(
'<div class="col-sm-6 col-md-4 col-lg-3 grid-box" id="' + facility.id + '">\
<div class="facility ' + open_class + '">' +
facility.name.replace(/ ?\[(.+)\]/, '<span class="building"> ($1)</span>') +
'</div>\
</div>'
);
});
$('#grid').show();
correct_grid_overflow();
}
function update_grid(facilities) {
$.each(facilities, function (idx, facility) {
var now = new Date();
var endDate = new Date().setHours(5,0,0,0);
// JavaScript sets 0 to Sunday instead of Monday
var day = now.getDay() - 1;
if (day === -1) {
day = 6;
}
var schedule = undefined;
// If there exists a valid special schedule choose it.
$.each(facility.special_schedules, function (idx, special) {
// Special schedules take effect after 5am on their start day
// to prevent collisions with the previous night's schedule,
// and they end at 5am the day after their end date.
special_start = Date.parse(special.valid_start + ' 05:00:00');
special_end = Date.parse(special.valid_end + ' 05:00:00');
special_end.setDate(special_end.getDate()+1);
if (now >= special_start && now <= special_end) {
schedule = special;
}
});
// If there was no special schedule, then use main_schedule.
if (schedule === undefined) {
schedule = facility.main_schedule;
}
// Open the facilities that are open, leave the rest closed.
if (schedule.open_times.length === 0) {
facility.open = false;
}
facility.current_schedule = schedule;
$.each(schedule.open_times, function (idx, time) {
var start_day = time.start_day;
var end_day = time.end_day;
var start_time = Date.parse(time.start_time);
var end_time = Date.parse(time.end_time);
if (day === start_day) {
if (now >= Date.parse(time.start_time)) {
if (day === end_day) {
if (now <= Date.parse(time.end_time)) {
facility.open = true;
facility.current_time = time;
return false;
}
} else {
facility.open = true;
facility.current_time = time;
return false;
}
}
} else if (day === end_day) {
if (now <= Date.parse(time.end_time)) {
if (day === start_day) {
if (now >= Date.parse(time.start_time)) {
facility.open = true;
facility.current_time = time;
return false;
}
} else {
facility.open = true;
facility.current_time = time;
return false;
}
}
} else if (start_day < end_day) {
if (day > start_day && day < end_day) {
facility.open = true;
facility.current_time = time;
return false;
}
} else if (start_day > end_day) {
if (day > start_day || day < end_day) {
facility.open = true;
facility.current_time = time;
return false;
}
}
facility.open = false;
});
});
}
$(function() {
update_grid(facilities);
construct_grid(facilities);
$.ajax({
url: '/api/facilities/?format=json',
}).done(function (data) {
facilities = data;
localStorage['facilities'] = JSON.stringify(facilities);
update_grid(facilities);
construct_grid(facilities);
// Every second, check and see if it is necessary to update the grid.
var last_updated = new Date();
setInterval(function(){
now = new Date();
// If the hour has changed, it the half hour has changed
// or it has been over a half hour (180000 milliseconds) since the last update.
if (last_updated.getHours() != now.getHours() ||
(last_updated.getMinutes() < 30 && now.getMinutes() >= 30) || now - last_updated > 1800000){
update_grid(facilities);
construct_grid(facilities);
last_updated = new Date();
}
}, 1000);
$(window).on('resize', function(){
correct_grid_overflow();
});
//-------------------------------------------------------------------------
//-- FROM typeAhead.js
//-------------------------------------------------------------------------
//collecting list of facility names from server data
var rest_names = [];
for (var i = 0; i < data.length; i++) {
rest_names.push(data[i].name);
};
// For doumentation on jQuery's autocomplete: (api.jqueryui.com/autocomplete)
$("#searchBar").autocomplete({
source: rest_names,
//making it so the search result list doesn't physically appear
messages: {
noResults: '',
results: function(){}
},
minLength: 0,
response: function(event, ui) {
//ui.content array contains all names that are returned from the search
results = $.map(ui.content, function(r) { return r.value; });
filtered = $.grep(facilities, function (r, idx) {
return ($.inArray(r.name, results) != -1);
});
construct_grid(filtered);
// To prevent the page width from extending
$('.ui-autocomplete').remove();
}
});
});
});
function compareTimes(time1, time2) {
// Determine if two objects' start and end times are equal.
if (time1 === undefined || time2 === undefined){
return false;
}
else if (time1.start_time != time2.start_time){
return false;
}
else if (time1.end_time != time2.end_time){
return false;
}
return true;
}
function areConsecutiveDays(time1, time2) {
if (time1 === undefined || time2 === undefined) {
return false;
}
else if (time1.start_day !== time2.start_day - 1) {
return false;
}
return true;
}
$.fn.displaySchedule = function(open_times){
/* Display each open time in a concise format. The following loop will
* determine if two consecutive days have the same open and closing times.
* If that is the case, the time will be shown as a range.
* (ie. Mon - Sat: 10:00 AM - 6:00 PM")
* Otherwise, each date is displayed for its individual day.
* (ie. Sun: "4:00 PM - 12:00 AM
*/
var element = '';
for(var i = 0; i < open_times.length; i++){
if (!compareTimes(open_times[i], open_times[i-1]) ||
!areConsecutiveDays(open_times[i-1], open_times[i])) {
element += '<div class="col-md-3"><b>';
}
if ((!compareTimes(open_times[i], open_times[i-1])
|| !areConsecutiveDays(open_times[i-1], open_times[i]))
&& compareTimes(open_times[i], open_times[i+1])
&& areConsecutiveDays(open_times[i], open_times[i+1])) {
// Add: "StartDay - "
element += days[open_times[i].start_day] + ' - ';
}
if (!compareTimes(open_times[i], open_times[i+1]) ||
open_times[i].start_day !== (open_times[i+1].start_day - 1)) {
// Add "EndDay: OpenTime - CloseTime"
opening = Date.parse(open_times[i].start_time);
closing = Date.parse(open_times[i].end_time);
element += days[open_times[i].start_day] + '</b>: ' +
opening.toLocaleTimeString().replace(/(\d+:\d{2})(:\d+ )/, "$1 ") + ' - ' +
closing.toLocaleTimeString().replace(/(\d+:\d{2})(:\d+ )/, "$1 ") + '</div>';
$(this).append(element);