Merge pull request #1 from tadakda/feature/fullcalendar
Feature/fullcalendar
This commit is contained in:
14
calendar.html
Normal file
14
calendar.html
Normal file
@@ -0,0 +1,14 @@
|
||||
<!DOCTYPE html>
|
||||
<head>
|
||||
<link rel='stylesheet' href='css/fullcalendar.css' />
|
||||
<link rel='stylesheet' href='css/_materialFullCalendar.css' />
|
||||
<script src='js/jquery-3.3.1.min.js'></script>
|
||||
<script src='js/moment.min.js'></script>
|
||||
<script src='js/fullcalendar.js'></script>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<div id='calendar'></div>
|
||||
</body>
|
||||
|
||||
<script src='js/calendar.js'></script>
|
||||
148
css/_materialFullCalendar.css
Normal file
148
css/_materialFullCalendar.css
Normal file
@@ -0,0 +1,148 @@
|
||||
/*
|
||||
|
||||
This is the Material Design theme for FullCalendar Weekly Agenda view
|
||||
|
||||
Creation Date: Aug 19th 2015
|
||||
Author: Jacky Liang
|
||||
Version: FullCalendar 2.4.0
|
||||
Tested Using the Following FC Settings:
|
||||
|
||||
editable: false,
|
||||
handleWindowResize: true,
|
||||
weekends: false, // Hide weekends
|
||||
defaultView: 'agendaWeek', // Only show week view
|
||||
header: false, // Hide buttons/titles
|
||||
minTime: '07:30:00', // Start time for the calendar
|
||||
maxTime: '22:00:00', // End time for the calendar
|
||||
columnFormat: {
|
||||
week: 'ddd' // Only show day of the week names
|
||||
},
|
||||
displayEventTime: true,
|
||||
allDayText: 'Online/TBD'
|
||||
|
||||
Note: This has NOT been tested on Monthly or Daily views.
|
||||
|
||||
Colors: Use the following - https://www.google.com/design/spec/style/color.html#color-color-palette
|
||||
at the 700 level. An opacity of 0.65 is automatically applied to the
|
||||
700 level colors to generate a soft and pleasing look.
|
||||
|
||||
Color were applied to each event using the following code:
|
||||
|
||||
events.push({
|
||||
title: 'This is a Material Design event!',
|
||||
start: 'someStartDate',
|
||||
end: 'someEndDate',
|
||||
color: '#C2185B'
|
||||
});
|
||||
|
||||
*/
|
||||
/* Remove that awful yellow color and border from today in Schedule */
|
||||
.fc-state-highlight {
|
||||
opacity: 0;
|
||||
border: none;
|
||||
}
|
||||
|
||||
/* Styling for each event from Schedule */
|
||||
.fc-time-grid-event.fc-v-event.fc-event {
|
||||
border-radius: 4px;
|
||||
border: none;
|
||||
padding: 5px;
|
||||
opacity: 1;
|
||||
}
|
||||
|
||||
/* Bolds the name of the event and inherits the font size */
|
||||
.fc-event {
|
||||
font-size: inherit !important;
|
||||
font-weight: bold !important;
|
||||
}
|
||||
|
||||
/* Remove the header border from Schedule */
|
||||
.fc td, .fc th {
|
||||
border-style: none !important;
|
||||
border-width: 1px !important;
|
||||
padding: 0 !important;
|
||||
vertical-align: top !important;
|
||||
}
|
||||
|
||||
/* Inherits background for each event from Schedule. */
|
||||
.fc-event .fc-bg {
|
||||
z-index: 1 !important;
|
||||
background: inherit !important;
|
||||
opacity: 0.25 !important;
|
||||
}
|
||||
|
||||
/* Normal font weight for the time in each event */
|
||||
.fc-time-grid-event .fc-time {
|
||||
font-weight: normal !important;
|
||||
}
|
||||
|
||||
/* Apply same opacity to all day events */
|
||||
.fc-ltr .fc-h-event.fc-not-end, .fc-rtl .fc-h-event.fc-not-start {
|
||||
opacity: 0.65 !important;
|
||||
margin-left: 12px !important;
|
||||
padding: 5px !important;
|
||||
}
|
||||
|
||||
/* Apply same opacity to all day events */
|
||||
.fc-day-grid-event.fc-h-event.fc-event.fc-not-start.fc-end {
|
||||
opacity: 0.65 !important;
|
||||
margin-left: 12px !important;
|
||||
padding: 5px !important;
|
||||
}
|
||||
|
||||
/* Material design button */
|
||||
.fc-button {
|
||||
display: inline-block;
|
||||
position: relative;
|
||||
cursor: pointer;
|
||||
min-height: 36px;
|
||||
min-width: 88px;
|
||||
line-height: 36px;
|
||||
vertical-align: middle;
|
||||
-webkit-box-align: center;
|
||||
-webkit-align-items: center;
|
||||
align-items: center;
|
||||
text-align: center;
|
||||
border-radius: 2px;
|
||||
box-sizing: border-box;
|
||||
-webkit-user-select: none;
|
||||
-moz-user-select: none;
|
||||
-ms-user-select: none;
|
||||
user-select: none;
|
||||
outline: none;
|
||||
border: 0;
|
||||
padding: 0 6px;
|
||||
margin: 6px 8px;
|
||||
letter-spacing: 0.01em;
|
||||
background: transparent;
|
||||
color: currentColor;
|
||||
white-space: nowrap;
|
||||
text-transform: uppercase;
|
||||
font-weight: 500;
|
||||
font-size: 14px;
|
||||
font-style: inherit;
|
||||
font-variant: inherit;
|
||||
font-family: inherit;
|
||||
text-decoration: none;
|
||||
overflow: hidden;
|
||||
-webkit-transition: box-shadow 0.4s cubic-bezier(0.25, 0.8, 0.25, 1), background-color 0.4s cubic-bezier(0.25, 0.8, 0.25, 1);
|
||||
transition: box-shadow 0.4s cubic-bezier(0.25, 0.8, 0.25, 1), background-color 0.4s cubic-bezier(0.25, 0.8, 0.25, 1);
|
||||
}
|
||||
|
||||
.fc-button:hover {
|
||||
background-color: rgba(158, 158, 158, 0.2);
|
||||
}
|
||||
|
||||
.fc-button:focus, .fc-button:hover {
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
/* The active button box is ugly so the active button will have the same appearance of the hover */
|
||||
.fc-state-active {
|
||||
background-color: rgba(158, 158, 158, 0.2);
|
||||
}
|
||||
|
||||
/* Not raised button */
|
||||
.fc-state-default {
|
||||
box-shadow: None;
|
||||
}
|
||||
1293
css/fullcalendar.css
Normal file
1293
css/fullcalendar.css
Normal file
File diff suppressed because it is too large
Load Diff
@@ -19,7 +19,7 @@
|
||||
|
||||
}
|
||||
body{
|
||||
min-width: 350px;
|
||||
min-width: 500px;
|
||||
min-height: 400px;
|
||||
}
|
||||
.matbut {
|
||||
|
||||
102
js/calendar.js
Normal file
102
js/calendar.js
Normal file
@@ -0,0 +1,102 @@
|
||||
$(function() {
|
||||
|
||||
const materialColors =
|
||||
['#FF1744', '#F50057', '#D500F9', '#651FFF',
|
||||
'#3D5AFE', '#2979FF', '#00B0FF', '#00E5FF',
|
||||
'#1DE9B6', '#00E676', '#76FF03', '#C6FF00',
|
||||
'#FFEA00', '#FFC400', '#FF9100', 'FF3D00',
|
||||
'#4E342E', '#424242', '#37474F'];
|
||||
|
||||
// Counter to iterate through material colors to avoid duplicates
|
||||
var colorCounter = 0;
|
||||
|
||||
// Each schedule needs to store 'TITLE - START TIME - END TIME - COLOR'
|
||||
var classSchedules = [];
|
||||
|
||||
chrome.storage.sync.get('savedCourses', function (data) {
|
||||
var savedCourses = data.savedCourses;
|
||||
|
||||
// Iterate through each saved course and add to 'event'
|
||||
for (let i = 0; i < savedCourses.length; i++) {
|
||||
var classInfo = savedCourses[i]; // Store all info for a single class
|
||||
|
||||
var department = classInfo.coursename.substring(0,classInfo.coursename.search(/\d/)-2);
|
||||
var course_nbr = classInfo.coursename.substring(classInfo.coursename.search(/\d/),classInfo.coursename.indexOf(" ",classInfo.coursename.search(/\d/)));
|
||||
var uncapProf = classInfo.profname;
|
||||
|
||||
uncapProf = uncapProf.charAt(0) + uncapProf.substring(1).toLowerCase();
|
||||
|
||||
for (let j = 0; j < classInfo.datetimearr.length; j++) {
|
||||
let session = classInfo.datetimearr[j]; // One single session for a class
|
||||
|
||||
if (session[0] == 'M') {
|
||||
classSchedules.push({
|
||||
title: `${department}-${course_nbr}\n${uncapProf}`,
|
||||
start: moment().format("YYYY-MM-") + moment().day('Monday')._d.toString().split(' ')[2] + 'T' + session[1][0] + ':00',
|
||||
end: moment().format("YYYY-MM-") + moment().day('Monday')._d.toString().split(' ')[2] + 'T' + session[1][1] + ':00',
|
||||
color: materialColors[colorCounter],
|
||||
allday: false
|
||||
});
|
||||
}
|
||||
|
||||
if (session[0] == 'T') {
|
||||
classSchedules.push({
|
||||
title: `${department}-${course_nbr}\n${uncapProf}`,
|
||||
start: moment().format("YYYY-MM-") + moment().day('Tuesday')._d.toString().split(' ')[2] + 'T' + session[1][0] + ':00',
|
||||
end: moment().format("YYYY-MM-") + moment().day('Tuesday')._d.toString().split(' ')[2] + 'T' + session[1][1] + ':00',
|
||||
color: materialColors[colorCounter],
|
||||
allday: false
|
||||
});
|
||||
}
|
||||
|
||||
if (session[0] == 'W') {
|
||||
classSchedules.push({
|
||||
title: `${department}-${course_nbr}\n${uncapProf}`,
|
||||
start: moment().format("YYYY-MM-") + moment().day('Wednesday')._d.toString().split(' ')[2] + 'T' + session[1][0] + ':00',
|
||||
end: moment().format("YYYY-MM-") + moment().day('Wednesday')._d.toString().split(' ')[2] + 'T' + session[1][1] + ':00',
|
||||
color: materialColors[colorCounter],
|
||||
allday: false
|
||||
});
|
||||
}
|
||||
|
||||
if (session[0] == 'TH') {
|
||||
classSchedules.push({
|
||||
title: `${department}-${course_nbr}\n${uncapProf}`,
|
||||
start: moment().format("YYYY-MM-") + moment().day('Thursday')._d.toString().split(' ')[2] + 'T' + session[1][0] + ':00',
|
||||
end: moment().format("YYYY-MM-") + moment().day('Thursday')._d.toString().split(' ')[2] + 'T' + session[1][1] + ':00',
|
||||
color: materialColors[colorCounter],
|
||||
allday: false
|
||||
});
|
||||
}
|
||||
|
||||
if (session[0] == 'F') {
|
||||
classSchedules.push({
|
||||
title: `${department}-${course_nbr}\n${uncapProf}`,
|
||||
start: moment().format("YYYY-MM-") + moment().day('Friday')._d.toString().split(' ')[2] + 'T' + session[1][0] + ':00',
|
||||
end: moment().format("YYYY-MM-") + moment().day('Friday')._d.toString().split(' ')[2] + 'T' + session[1][1] + ':00',
|
||||
color: materialColors[colorCounter],
|
||||
allday: false
|
||||
});
|
||||
}
|
||||
colorCounter++;
|
||||
}
|
||||
}
|
||||
|
||||
$('#calendar').fullCalendar({
|
||||
editable: false, // Don't allow editing of events
|
||||
handleWindowResize: true,
|
||||
weekends: false, // will hide Saturdays and Sundays
|
||||
slotDuration: '00:15:00', // 15 minute intervals on vertical column
|
||||
slotEventOverlap: false, // No overlapping between events
|
||||
defaultView: 'agendaWeek', // Only show week view
|
||||
header: false, // Hide buttons/titles
|
||||
minTime: '08:00:00', // Start time
|
||||
maxTime: '21:00:00', // End time
|
||||
columnHeaderFormat: 'ddd', // Only show day of the week names
|
||||
displayEventTime: true, // Display event time
|
||||
allDaySlot: false,
|
||||
events: classSchedules
|
||||
})
|
||||
});
|
||||
|
||||
});
|
||||
15010
js/fullcalendar.js
Normal file
15010
js/fullcalendar.js
Normal file
File diff suppressed because it is too large
Load Diff
@@ -112,6 +112,9 @@ $(document).ready(function() {
|
||||
$("#open").click(function(){
|
||||
chrome.tabs.create({ 'url': "options.html"});
|
||||
});
|
||||
$("#calendar").click(function() {
|
||||
chrome.tabs.create({ 'url': "calendar.html"});
|
||||
});
|
||||
});
|
||||
|
||||
/* convert from the dtarr and maek the time lines*/
|
||||
|
||||
@@ -10,6 +10,7 @@
|
||||
<button id="clear" class="matbut" style="font-size:medium; background:#4CAF50;margin: 10px;">Clear All</button>
|
||||
<button id="schedule" class="matbut" style="font-size:medium;background:#FF9800;margin: 10px">Course List</button>
|
||||
<button id="open" class="matbut" style="font-size:medium;background:#FFC107;margin: 10px;">Options</button>
|
||||
<button id="calendar" class="matbut" style="font-size:medium; background: #FF0000;margin: 10px;">Weekly Calendar</button>
|
||||
</div>
|
||||
</div>
|
||||
<ul id= "courseList" style="list-style-type: none;padding: 5px;"></ul>
|
||||
|
||||
Reference in New Issue
Block a user