Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

initial commit #1

Open
wants to merge 7 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
1 change: 1 addition & 0 deletions CNAME
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
today.t1.la
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,5 @@
# today
calendar of events at Team One

Uses Google Calendar api endpoint @
https://developers.google.com/google-apps/calendar/v3/reference/events/list
25 changes: 25 additions & 0 deletions config.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
require 'compass/import-once/activate'
# Require any additional compass plugins here.

# Set this to the root of your project when deployed:
http_path = "/"
css_dir = "media/stylesheets"
sass_dir = "media/sass"
images_dir = "media/images"
javascripts_dir = "media/javascripts"

# You can select your preferred output style here (can be overridden via the command line):
# output_style = :expanded or :nested or :compact or :compressed

# To enable relative paths to assets via compass helper functions. Uncomment:
# relative_assets = true

# To disable debugging comments that display the original location of your selectors. Uncomment:
# line_comments = false


# If you prefer the indented syntax, you might want to regenerate this
# project again passing --syntax sass, or you can uncomment this:
# preferred_syntax = :sass
# and then run:
# sass-convert -R --from scss --to sass sass scss && rm -rf sass && mv scss sass
57 changes: 57 additions & 0 deletions index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="refresh" content="1800">
<!-- Add to home screen for Safari on iOS -->
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="apple-mobile-web-app-status-bar-style" content="black">
<meta name="apple-mobile-web-app-title" content="Weather App">
<link rel="apple-touch-icon" href="./media/images/launcher-icon-3x.png">
<meta name="msapplication-TileImage" content="./media/images/launcher-icon-3x.png">
<meta name="msapplication-TileColor" content="#2F3BA2">
<title>Team One Today</title>
<link rel="manifest" href="./manifest.json">
<link href="media/stylesheets/screen.css" media="screen, projection" rel="stylesheet" type="text/css" />
<!-- <script type="text/javascript" src="./media/js/atc.min.js" async defer></script> -->
<!-- <script>
window.location.reload(true);
</script> -->

</head>
<body>
<header>
<div class="media-text diag text-anim-finish" style="color: white;">
<h1 class="title-top" style="color: white;">TEAM ONE</h1>
<hr>
<h1 class="title-bottom" style="color: white;">TODAY</h1>
</div>
</header>
<p>Check here for a collection of all of the events happening around the agency. Events are updated daily, so check back often!</p>



<div id="eventlist"></div>
<script type="text/javascript" src="./media/js/jquery-1.10.2.js"></script>
<script type="text/javascript" src="https://addevent.com/libs/atc/1.6.1/atc.min.js" async></script>
<script type="text/javascript" src="./media/js/calendar.js"></script>

<!-- <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script> -->
<script type="text/javascript">
jQuery(function ($) {
$('#eventlist').gCalReader({
calendarId:'[email protected]',
apiKey:'AIzaSyDN7tVbVYt6jBOTo0VPe6uP_FfKFl8A39o',
errorMsg:'No events in calendar',
maxEvents: 10,
futureEventsOnly: true,
sortDescending: false
});
});
</script>

<!-- <script src="./media/js/main.js" async></script> -->
</body>
</html>
26 changes: 26 additions & 0 deletions manifest.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
{
"short_name": "Team One Today",
"name": "Team One Today Events",
"gcm_sender_id": "208212738428",
"icons": [
{
"src": "media/images/launcher-icon-2x.png",
"sizes": "96x96",
"type": "image/png"
},
{
"src": "media/images/launcher-icon-3x.png",
"sizes": "144x144",
"type": "image/png"
},
{
"src": "media/images/launcher-icon-4x.png",
"sizes": "192x192",
"type": "image/png"
}
],
"start_url": "/index.html",
"display": "standalone",
"background_color": "#3E4EB8",
"theme_color": "#2F3BA2"
}
Binary file added media/images/launcher-icon-2x.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added media/images/launcher-icon-3x.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added media/images/launcher-icon-4x.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added media/images/today_header4.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 6 additions & 0 deletions media/js/atc.min.js

Large diffs are not rendered by default.

163 changes: 163 additions & 0 deletions media/js/calendar.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,163 @@
(function($) {

$.fn.gCalReader = function(options) {
var $div = $(this);

var defaults = $.extend({
calendarId: 'en.usa#[email protected]',
apiKey: 'Public_API_Key',
dateFormat: 'LongDate',
eventFormat: 'ShortDate+ShortTime',
startTime: 'ShortTime',
endTime: 'ShortTime',
errorMsg: 'No events in calendar',
maxEvents: 10,
futureEventsOnly: true,
sortDescending: true
},
options);

var s = '';
var feedUrl = 'https://www.googleapis.com/calendar/v3/calendars/' +
encodeURIComponent(defaults.calendarId.trim()) +'/events?key=' + defaults.apiKey +
'&orderBy=startTime&endTime&singleEvents=true';
if(defaults.futureEventsOnly) {
feedUrl+='&timeMin='+ new Date().toISOString();
}

$.ajax({
url: feedUrl,
dataType: 'json',
success: function(data) {
if(defaults.sortDescending){
data.items = data.items.reverse();
}
data.items = data.items.slice(0, defaults.maxEvents);

// if eventdate is the same as other eventdates, just print once

$.each(data.items, function(e, item) {
var timeZone = item.start.timeZone || '';
var eventdate = item.start.dateTime || item.start.date ||'';
var eventEnd = item.end.dateTime || item.end.date ||'';
var summary = item.summary || '';
var description = item.description;
var location = item.location;
var eventDate = formatDate(eventdate, defaults.dateFormat.trim());
var theEvent = formatDate(eventdate, defaults.eventFormat.trim());
var theEventEnd = formatDate(eventEnd, defaults.eventFormat.trim());
var eventTimeStart = formatDate(eventdate, defaults.startTime.trim());
var eventTimeEnd = formatDate(eventEnd, defaults.endTime.trim());


// s ='<div title="Add to Calendar" class="addeventatc perEvent"> Add To Calendar <span class="start">'+ theEvent +'</span> <span class="end">'+ theEventEnd +'</span> <span class="timezone"> America/Chicago</span> <span class="title">'+ summary +'</span> <span class="date_format">MM/DD/YYYY</span><span class="addeventatc_icon"></span></div>';
s ='<div class="eventdate">'+ eventDate +'</div>';
s +='<div class="eventTime"> at '+ eventTimeStart +'</div>';
s +='<div class="eventTime"> to '+ eventTimeEnd +'</div>';

s +='<div class="eventtitle">'+ summary +'</div>';
if(location) {
s +='<div class="location">Where: '+ location +'</div>';
}
if(description) {
s +='<div class="description">'+ description +'</div>';
}

$($div).append('<li>' + s + '</li>');
});
},
error: function(xhr, status) {
$($div).append('<p>' + status +' : '+ defaults.errorMsg +'</p>');
}
});

function formatDate(strDate, strFormat) {
var fd, arrDate, am, time;
var calendar = {
months: {
full: ['', 'January', 'February', 'March', 'April', 'May',
'June', 'July', 'August', 'September', 'October',
'November', 'December'
],
short: ['', 'Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul',
'Aug', 'Sep', 'Oct', 'Nov', 'Dec'
]
},
days: {
full: ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday',
'Friday', 'Saturday', 'Sunday'
],
short: ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat',
'Sun'
]
}
};

if (strDate.length > 10) {
arrDate = /(\d+)\-(\d+)\-(\d+)T(\d+)\:(\d+)/.exec(strDate);

am = (arrDate[4] < 12);
time = am ? (parseInt(arrDate[4]) + ':' + arrDate[5] + ' AM') : (
arrDate[4] - 12 + ':' + arrDate[5] + ' PM');

if (time.indexOf('0') === 0) {
if (time.indexOf(':00') === 1) {
if (time.indexOf('AM') === 5) {
time = '12:00 AM';
} else {
time = '12:00 PM';
}
} else {
time = time.replace('0:', '12:');
}
}

} else {
arrDate = /(\d+)\-(\d+)\-(\d+)/.exec(strDate);
time = 'Time not present in feed.';
}

var year = parseInt(arrDate[1]);
var month = parseInt(arrDate[2]);
var dayNum = parseInt(arrDate[3]);

var d = new Date(year, month - 1, dayNum);

switch (strFormat) {
case 'ShortTime':
fd = time;
break;
case 'ShortDate':
fd = month + '/' + dayNum + '/' + year;
break;
case 'LongDate':
fd = calendar.days.full[d.getDay()] + ' ' + calendar.months.full[
month] + ' ' + dayNum ;
break;
case 'LongDate+ShortTime':
fd = calendar.days.full[d.getDay()] + ' ' + calendar.months.full[
month] + ' ' + dayNum + ', ' + year + ' ' + time;
break;
case 'ShortDate+ShortTime':
fd = month + '/' + dayNum + '/' + year + ' ' + time;
break;
case 'DayMonth':
fd = calendar.days.short[d.getDay()] + ', ' + calendar.months.full[
month] + ' ' + dayNum;
break;
case 'MonthDay':
fd = calendar.months.full[month] + ' ' + dayNum;
break;
case 'YearMonth':
fd = calendar.months.full[month] + ' ' + year;
break;
default:
fd = calendar.days.full[d.getDay()] + ' ' + calendar.months.short[
month] + ' ' + dayNum + ', ' + year + ' ' + time;
}

return fd;
}
};

}(jQuery));
Loading