calendar styling and functionality
This commit is contained in:
@@ -114,6 +114,57 @@ Colors: Use the following - https://www.google.com/design/spec/style/color.html#
|
|||||||
|
|
||||||
/* Material design button */
|
/* Material design button */
|
||||||
|
|
||||||
|
.matbut {
|
||||||
|
border: none;
|
||||||
|
outline: none;
|
||||||
|
cursor: pointer;
|
||||||
|
color: white;
|
||||||
|
margin: 10px 10px 10px 0px;
|
||||||
|
padding: 10px 10px;
|
||||||
|
border-radius: 10px;
|
||||||
|
font-size: medium;
|
||||||
|
font-style: bold;
|
||||||
|
box-shadow: 2px 2px 4px rgba(0, 0, 0, 0.4);
|
||||||
|
}
|
||||||
|
|
||||||
|
.matbut {
|
||||||
|
position: relative;
|
||||||
|
overflow: hidden;
|
||||||
|
}
|
||||||
|
|
||||||
|
.matbut:after {
|
||||||
|
content: "";
|
||||||
|
position: absolute;
|
||||||
|
top: 50%;
|
||||||
|
left: 50%;
|
||||||
|
width: 5px;
|
||||||
|
height: 5px;
|
||||||
|
background: rgba(255, 255, 255, 0.5);
|
||||||
|
opacity: 0;
|
||||||
|
border-radius: 100%;
|
||||||
|
transform: scale(1, 1) translate(-50%);
|
||||||
|
transform-origin: 50% 50%;
|
||||||
|
}
|
||||||
|
|
||||||
|
@keyframes ripple {
|
||||||
|
0% {
|
||||||
|
transform: scale(0, 0);
|
||||||
|
opacity: 1;
|
||||||
|
}
|
||||||
|
20% {
|
||||||
|
transform: scale(25, 25);
|
||||||
|
opacity: 1;
|
||||||
|
}
|
||||||
|
100% {
|
||||||
|
opacity: 0;
|
||||||
|
transform: scale(40, 40);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.matbut:focus:not(:active)::after {
|
||||||
|
animation: ripple 1s ease-out;
|
||||||
|
}
|
||||||
|
|
||||||
.fc-button {
|
.fc-button {
|
||||||
display: inline-block;
|
display: inline-block;
|
||||||
position: relative;
|
position: relative;
|
||||||
@@ -171,4 +222,60 @@ Colors: Use the following - https://www.google.com/design/spec/style/color.html#
|
|||||||
|
|
||||||
.fc-state-default {
|
.fc-state-default {
|
||||||
box-shadow: None;
|
box-shadow: None;
|
||||||
|
}
|
||||||
|
|
||||||
|
.modal {
|
||||||
|
display: none;
|
||||||
|
position: fixed;
|
||||||
|
z-index: 1;
|
||||||
|
padding-top: 300px;
|
||||||
|
left: 0;
|
||||||
|
top: 0;
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
background-color: rgb(0, 0, 0);
|
||||||
|
background-color: rgba(0, 0, 0, 0.4);
|
||||||
|
}
|
||||||
|
|
||||||
|
.modal-content {
|
||||||
|
background-color: #fefefe;
|
||||||
|
margin: auto;
|
||||||
|
max-height: 85%;
|
||||||
|
overflow-y: auto;
|
||||||
|
padding: 20px;
|
||||||
|
border: 1px solid #888;
|
||||||
|
width: 20%;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* The Close Button */
|
||||||
|
|
||||||
|
.close {
|
||||||
|
color: #aaaaaa;
|
||||||
|
float: right;
|
||||||
|
padding: 5px;
|
||||||
|
font-size: 28px;
|
||||||
|
font-weight: bold;
|
||||||
|
}
|
||||||
|
|
||||||
|
.close:hover,
|
||||||
|
.close:focus {
|
||||||
|
color: #000;
|
||||||
|
text-decoration: none;
|
||||||
|
cursor: pointer;
|
||||||
|
}
|
||||||
|
|
||||||
|
.card {
|
||||||
|
transition: 0.3s;
|
||||||
|
margin-bottom: 10px;
|
||||||
|
box-shadow: 0 2px 5px 0 rgba(0, 0, 0, 0.16), 0 2px 10px 0 rgba(0, 0, 0, 0.12);
|
||||||
|
}
|
||||||
|
|
||||||
|
.card:hover {
|
||||||
|
box-shadow: 0 4px 10px 0 rgba(0, 0, 0, 0.2), 0 4px 20px 0 rgba(0, 0, 0, 0.19);
|
||||||
|
}
|
||||||
|
|
||||||
|
.cardcontainer {
|
||||||
|
padding: 2px 16px;
|
||||||
|
display: flex;
|
||||||
|
transition: width 300ms ease-in-out, height 300ms ease-in-out;
|
||||||
}
|
}
|
||||||
@@ -11,12 +11,16 @@ $(function () {
|
|||||||
["TH", "Thursday"],
|
["TH", "Thursday"],
|
||||||
["F", "Friday"]
|
["F", "Friday"]
|
||||||
]);
|
]);
|
||||||
|
const fadetime = 150;
|
||||||
|
const butdelay = 75;
|
||||||
|
$("#calendar").prepend('<div id="myModal" class="modal"><div class="modal-content"><span class="close">×</span><div class="card"><div class="cardcontainer"><h2 id="unique">Some text in the Modal..</h2> <button id="info" class="matbut" style="font-size:medium; margin-left: 15px; margin-top: auto; margin-bottom: auto;background: #FF9800;">More Info</button></div></div></div></div>');
|
||||||
// Counter to iterate through material colors to avoid duplicates
|
// Counter to iterate through material colors to avoid duplicates
|
||||||
var colorCounter = 0;
|
var colorCounter = 0;
|
||||||
// Each schedule needs to store 'TITLE - START TIME - END TIME - COLOR'
|
// Each schedule needs to store 'TITLE - START TIME - END TIME - COLOR'
|
||||||
var classSchedules = [];
|
var classSchedules = [];
|
||||||
var savedCourses = [];
|
var savedCourses = [];
|
||||||
|
var currLink = "";
|
||||||
|
var currunique = "";
|
||||||
chrome.storage.sync.get("savedCourses", function (data) {
|
chrome.storage.sync.get("savedCourses", function (data) {
|
||||||
// Iterate through each saved course and add to 'event'
|
// Iterate through each saved course and add to 'event'
|
||||||
savedCourses = data.savedCourses;
|
savedCourses = data.savedCourses;
|
||||||
@@ -48,16 +52,43 @@ $(function () {
|
|||||||
$(element).css("margin-bottom", "5px");
|
$(element).css("margin-bottom", "5px");
|
||||||
|
|
||||||
},
|
},
|
||||||
eventClick: function (calEvent, jsEvent, view) {
|
eventClick: function (data, event, view) {
|
||||||
console.log(calEvent);
|
$("#myModal").fadeIn(fadetime);
|
||||||
// $(this).css('background-color', 'green');
|
currunique = data.unique;
|
||||||
alert('Event: ' + savedCourses[0].coursename);
|
currLink = data.courseLink;
|
||||||
// change the border color just for fun
|
$("#unique").text(`Unique : ${data.unique}`);
|
||||||
|
// When the user clicks on <span> (x), close the modal
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
$(".close").click(() => {
|
||||||
|
$("#myModal").fadeOut(fadetime);
|
||||||
|
});
|
||||||
|
$("#info").click(() => {
|
||||||
|
setTimeout(() => {
|
||||||
|
window.open(currLink);
|
||||||
|
}, butdelay);
|
||||||
|
});
|
||||||
|
/*Close Modal when hit escape*/
|
||||||
|
$(document).keydown((e) => {
|
||||||
|
if (e.keyCode == 27) {
|
||||||
|
$("#myModal").fadeOut(fadetime);
|
||||||
|
}
|
||||||
|
$("#snackbar").attr("class", "");
|
||||||
|
});
|
||||||
|
// When the user clicks anywhere outside of the modal, close it
|
||||||
|
window.onclick = (event) => {
|
||||||
|
var modal = document.getElementById("myModal");
|
||||||
|
if (event.target == modal) {
|
||||||
|
$("#myModal").fadeOut(fadetime);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Iterate through each saved course and add to 'event'
|
// Iterate through each saved course and add to 'event'
|
||||||
function setAllEvents(savedCourses) {
|
function setAllEvents(savedCourses) {
|
||||||
colorCounter = 0;
|
colorCounter = 0;
|
||||||
@@ -68,17 +99,18 @@ $(function () {
|
|||||||
var course_nbr = classInfo.coursename.substring(classInfo.coursename.search(/\d/), classInfo.coursename.indexOf(" ", classInfo.coursename.search(/\d/)));
|
var course_nbr = classInfo.coursename.substring(classInfo.coursename.search(/\d/), classInfo.coursename.indexOf(" ", classInfo.coursename.search(/\d/)));
|
||||||
var uncapProf = classInfo.profname;
|
var uncapProf = classInfo.profname;
|
||||||
uncapProf = uncapProf.charAt(0) + uncapProf.substring(1).toLowerCase();
|
uncapProf = uncapProf.charAt(0) + uncapProf.substring(1).toLowerCase();
|
||||||
|
var uniquenum = classInfo.unique;
|
||||||
|
var link = classInfo.link;
|
||||||
for (let j = 0; j < classInfo.datetimearr.length; j++) {
|
for (let j = 0; j < classInfo.datetimearr.length; j++) {
|
||||||
let session = classInfo.datetimearr[j]; // One single session for a class
|
let session = classInfo.datetimearr[j]; // One single session for a class
|
||||||
setEventForSection(session, colorCounter, department, course_nbr, uncapProf);
|
setEventForSection(session, colorCounter, department, course_nbr, uncapProf, uniquenum, link);
|
||||||
}
|
}
|
||||||
colorCounter++;
|
colorCounter++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//create the event object for every section
|
//create the event object for every section
|
||||||
function setEventForSection(session, colorCounter, department, course_nbr, uncapProf) {
|
function setEventForSection(session, colorCounter, department, course_nbr, uncapProf, uniquenum, link) {
|
||||||
var fullday = days.get(session[0]);
|
var fullday = days.get(session[0]);
|
||||||
classSchedules.push({
|
classSchedules.push({
|
||||||
title: `${department}-${course_nbr} with ${uncapProf}`,
|
title: `${department}-${course_nbr} with ${uncapProf}`,
|
||||||
@@ -99,6 +131,8 @@ $(function () {
|
|||||||
session[1][1] +
|
session[1][1] +
|
||||||
":00",
|
":00",
|
||||||
color: materialColors[colorCounter],
|
color: materialColors[colorCounter],
|
||||||
|
unique: uniquenum,
|
||||||
|
courseLink: link,
|
||||||
allday: false
|
allday: false
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ const days = new Map([
|
|||||||
["F", "Friday"]
|
["F", "Friday"]
|
||||||
]);
|
]);
|
||||||
const fadetime = 150;
|
const fadetime = 150;
|
||||||
const butdelay = 100;
|
const butdelay = 75;
|
||||||
//This extension may be super lit, but you know what's even more lit?
|
//This extension may be super lit, but you know what's even more lit?
|
||||||
//Matthew Tran's twitter and insta: @MATTHEWTRANN and @matthew.trann
|
//Matthew Tran's twitter and insta: @MATTHEWTRANN and @matthew.trann
|
||||||
$(function () {
|
$(function () {
|
||||||
|
|||||||
Reference in New Issue
Block a user