From 07810471680ca1f2e3e8e383c399213e568ddf1d Mon Sep 17 00:00:00 2001 From: Daru13 Date: Sun, 28 Apr 2019 03:43:36 +0200 Subject: [PATCH] Remove unused code and files. --- css/calendar.css | 350 ----------- css/style.css | 7 - css/tipso.css | 109 ---- index.html | 20 - js/calendar.js | 1187 ----------------------------------- js/interval_coloration.js | 84 --- js/jquery-3.3.1.min.js | 2 - js/jquery-3.3.1.slim.min.js | 2 - js/tipso.min.js | 1 - 9 files changed, 1762 deletions(-) delete mode 100644 css/calendar.css delete mode 100644 css/tipso.css delete mode 100644 js/calendar.js delete mode 100644 js/interval_coloration.js delete mode 100644 js/jquery-3.3.1.min.js delete mode 100644 js/jquery-3.3.1.slim.min.js delete mode 100644 js/tipso.min.js diff --git a/css/calendar.css b/css/calendar.css deleted file mode 100644 index 886b803..0000000 --- a/css/calendar.css +++ /dev/null @@ -1,350 +0,0 @@ -/* Calendar */ - -#cal-container { - position: relative; - - width: 100%; - /* height: 1200px; */ - padding: 0; - - font-size: 0.8rem; - line-height: 100%; -} - -#cal-container, -#cal-container * { - box-sizing: border-box; -} - - - -/* Time slots */ - -#cal-container .cal-time-slot-container { - display: grid; - /* grid-template-columns: repeat(24, 1fr); */ - grid-template-rows: 30px auto; - - position: absolute; - top: 0; - left: 0; - width: 100%; - height: calc(100% + 30px); - padding: 0; - border-bottom: 2px solid #928c79; - z-index: 10; -} - -#cal-container .cal-time-slot { - border-right: 1px solid #928c79; - background-color: rgba(255, 223, 165, 0.08); -} - -/* #cal-container .cal-time-slot:hover { - background-color: red; -} */ - -#cal-container .cal-time-slot:nth-child(even) { - background-color: rgba(255, 223, 165, 0.05); -} - -/* #cal-container .cal-time-slot:nth-child(even):hover { - background-color: #D9D9D9; -} */ - -#cal-container .cal-time-slot:last-child { - border-right: 0; -} - -#cal-container .cal-time-slot-hour { - padding: 0 0 0 calc(100% - 0.9rem + 7px); - background-color: none; /* rgba(255, 223, 165, 0.08); */ - border-bottom: 2px solid #928c79; - font-size: 0.9rem; -} - -#cal-container .cal-time-slot-hour:nth-child(even) { - background-color: none;/* rgba(255, 223, 165, 0.05);*/ -} - -#cal-container .cal-time-slot-hour:first-child { - color: transparent; - border-right: 0; -} - -#cal-container .cal-time-slot-hour.cal-last-hour { - padding: 0; - color: transparent; -} - -#cal-container .cal-time-slot.cal-last-hour, -#cal-container .cal-time-slot-hour.cal-last-hour { - border-right: 1px solid #928c79; -} - -#cal-container .cal-time-slot.cal-first-hour, -#cal-container .cal-time-slot-hour.cal-first-hour { - border-left: 1px solid #928c79; -} - -/* Events */ - -#cal-container .cal-event-container { - display: grid; - /* grid-template-columns: repeat(24, 1fr); */ - /* grid-template-rows: repeat(12, auto); */ - - position: absolute; - top: 40px; - left: 0; - width: 100%; - /* height: 100%; */ - padding: 0; - z-index: 100; -} - -#cal-container .cal-event { - position: relative; - height: 42px; - margin: 2px 0; - padding: 5px; - /* background-color: #EFEFEF; */ - border-radius: 3px; - /* border: 1px solid #CCC; */ - border-width: 1px; - border-style: solid; - text-align: center; - white-space: nowrap; - overflow: hidden; - text-overflow: ellipsis; - /* z-index: 500; */ - transition: 50ms ease-in; -} - -#cal-container .cal-event > * { - display: none; - margin: 5px; - overflow: hidden; -} - -#cal-container .cal-event > .cal-event-name, -#cal-container .cal-event > .cal-event-location, -#cal-container .cal-event > .cal-event-perm-count { - display: block; - margin: 0; -} - -#cal-container .cal-event > .cal-event-name { - font-weight: 700; -} - -#cal-container .cal-event > .cal-event-location { - font-weight: 300; - font-style: italic; -} - -/*#cal-container .cal-event > .cal-event-location::before { - content: " · "; -}*/ - -#cal-container .cal-event > .cal-event-perm-count { - position: absolute; - bottom: 0; - right: 0; -} - -#cal-container .cal-event:not(.cal-event-subscribed) > .cal-event-perm-count.cal-perms-missing { - width: calc(100% - 10px); - right: auto; - margin: 5px; - padding: 5px; - background-color: #FFF; - border: 2px solid #E44; - color: #E44; - font-weight: bold; - border-radius: 3px; - overflow: hidden; -} - -#cal-container .cal-event.cal-event-subscribed { - border-width: 3px; - border-color: #000; -} - -#cal-container .cal-event.cal-event-subscribed::after { - content: "✔"; - position: absolute; - left: 0; - bottom: 0; - width: 16px; - height: 16px; - padding: 1px; - color: #fff; - background-color: #000; - border-top-right-radius: 3px; -} - - -/* Event details popup */ - -#cal-container .cal-event-details { - position: absolute; - min-height: 100px; - /* min-width: 40%; */ - max-width: 80%; - padding: 20px; - background-color: #333; - color: #FFF; - border-radius: 4px; - box-shadow: 0 15px 50px rgba(0, 0, 0, 0.6); - z-index: 1000; -} - -#cal-container .cal-event-details:after { - bottom: 100%; - left: 50%; - border: solid transparent; - content: " "; - height: 0; - width: 0; - position: absolute; - pointer-events: none; - border-bottom-color: #333; - border-width: 20px; - margin-left: -20px; -} - -#cal-container .cal-event-details.above-event:after { - top: 100%; - left: 50%; - border: solid transparent; - content: " "; - height: 0; - width: 0; - position: absolute; - pointer-events: none; - border-top-color: #333; - border-width: 20px; - margin-left: -20px; -} - -#cal-container .cal-event-details * { - z-index: 1000; -} - -#cal-container .cal-event-details .cal-detail-close-button { - width: 35px; - height: 35px; - position: absolute; - top: 10px; - right: 10px; - margin: 0; - padding: 5px; - background: transparent; - border: none; - border-radius: 50%; - font-size: 1.2rem; - color: #BBB; - transition: 100ms ease-out; -} - -#cal-container .cal-event-details .cal-detail-close-button:hover { - background-color: #484848; - color: #EFEFEF; -} - -#cal-container .cal-event-details a, -#cal-container .cal-event-details a:hover { - color: #FFF; - text-decoration: none; -} - -#cal-container .cal-event-details .cal-detail-name { - padding: 10px; - border-radius: 4px; - font-size: 1rem; - color: #FFF; - text-transform: uppercase; - text-align: center; -} - -#cal-container .cal-event-details .cal-detail-name h3 { - margin: 0 20px 20px 20px; -} - -#cal-container .cal-event-details table { - margin: 0 auto; -} - -#cal-container .cal-event-details td.cal-detail-label { - padding: 0 10px 10px 0; - font-weight: bold; - text-align: right; -} - -#cal-container .cal-event-details td.cal-detail-value { - padding: 0 0 10px 10px; - text-align: left; -} - -#cal-container .cal-event-details .cal-detail-perm-area { - margin: 10px 0; - padding: 10px; - background-color: #DFDFDF; - color: #333; - text-align: center; - border-radius: 4px; -} - -#cal-container .cal-event-details .cal-detail-perm-title { - margin: 0 0 10px 0; -} - -#cal-container .cal-event-details .cal-detail-perm-area .cal-detail-perm-count { - margin: 0 10px 0 0; - font-size: 1.7rem; - vertical-align: middle; -} - -#cal-container .cal-event-details .cal-detail-perm-area .cal-detail-perm-count.cal-perms-missing { - color: #E44; -} - -#cal-container .cal-event-details .cal-detail-perm-area .cal-detail-perm-count.cal-perms-full { - color: #393; -} - - -#cal-container .cal-event-details .cal-detail-perm-area .cal-detail-perm-subscription-switch { - margin: 0 0 0 10px; - padding: 10px; - font-size: 1.35rem; - vertical-align: middle; -} - -#cal-container .cal-event-details .cal-detail-perm-area .cal-detail-perm-nb-missing-perms { - margin: 20px 0 0 0; - padding: 5px; - background-color: #FFF; - border-radius: 4px; - text-align: center; - font-size: 1.1rem; - color: #E44; - font-weight: bold; -} - -#cal-container .cal-event-details .cal-detail-description { - margin: 20px 0 0 0; - color: #DDD; - font-size: 0.9rem; - font-style: italic; - text-align: justify; - line-height: 130%; -} - -#cal-container .cal-event-details .cal-detail-tag { - display: inline-block; - margin: 5px; - padding: 5px; - border: 1px solid #DDD; -} diff --git a/css/style.css b/css/style.css index 279ec97..570500d 100644 --- a/css/style.css +++ b/css/style.css @@ -146,13 +146,6 @@ section h2 { margin: 0 0 25px 0; padding: 20px 0; - /* - background-image: url("../img/header/background.jpg"); - -webkit-background-clip: text; - background-clip: text; - color: transparent !important; - */ - border-bottom-width: 5px; border-bottom-style: solid; diff --git a/css/tipso.css b/css/tipso.css deleted file mode 100644 index bdac6df..0000000 --- a/css/tipso.css +++ /dev/null @@ -1,109 +0,0 @@ -/* Tipso Bubble Styles */ -.tipso_bubble, .tipso_bubble > .tipso_arrow{ - -webkit-box-sizing: border-box; - -moz-box-sizing: border-box; - box-sizing: border-box; -} -.tipso_bubble { - position: absolute; - text-align: center; - border-radius: 6px; - z-index: 9999; -} -.tipso_style{ - /* cursor: help; */ - /* border-bottom: 1px dotted; */ -} -.tipso_title { - padding: 0; - border-radius: 6px 6px 0 0; - font-weight: 700; -} -.tipso_content { - word-wrap: break-word; - padding: 0; - font-style: italic; -} - -/* Tipso Bubble size classes - Similar to Foundation's syntax*/ -.tipso_bubble.tiny { - font-size: 0.6rem; -} -.tipso_bubble.small { - font-size: 0.8rem; -} -.tipso_bubble.default { - font-size: 1rem; -} -.tipso_bubble.large { - font-size: 1.2rem; - width: 100%; -} - -.tipso_bubble.cal_small { - font-size: 0.7rem; -} - -/* Tipso Bubble Div */ -.tipso_bubble > .tipso_arrow{ - position: absolute; - width: 0; height: 0; - border: 8px solid; - pointer-events: none; -} -.tipso_bubble.top > .tipso_arrow { - border-top-color: #000; - border-right-color: transparent; - border-left-color: transparent; - border-bottom-color: transparent; - top: 100%; - left: 50%; - margin-left: -8px; -} -.tipso_bubble.bottom > .tipso_arrow { - border-bottom-color: #000; - border-right-color: transparent; - border-left-color: transparent; - border-top-color: transparent; - bottom: 100%; - left: 50%; - margin-left: -8px; -} -.tipso_bubble.left > .tipso_arrow { - border-left-color: #000; - border-top-color: transparent; - border-bottom-color: transparent; - border-right-color: transparent; - top: 50%; - left: 100%; - margin-top: -8px; -} -.tipso_bubble.right > .tipso_arrow { - border-right-color: #000; - border-top-color: transparent; - border-bottom-color: transparent; - border-left-color: transparent; - top: 50%; - right: 100%; - margin-top: -8px; -} - -.tipso_bubble .top_right_corner, -.tipso_bubble.top_right_corner { - border-bottom-left-radius: 0; -} - -.tipso_bubble .bottom_right_corner, -.tipso_bubble.bottom_right_corner { - border-top-left-radius: 0; -} - -.tipso_bubble .top_left_corner, -.tipso_bubble.top_left_corner { - border-bottom-right-radius: 0; -} - -.tipso_bubble .bottom_left_corner, -.tipso_bubble.bottom_left_corner { - border-top-right-radius: 0; -} diff --git a/index.html b/index.html index b29ee3a..c0d768c 100644 --- a/index.html +++ b/index.html @@ -11,8 +11,6 @@ -
@@ -154,23 +152,5 @@ - - - - - - - - \ No newline at end of file diff --git a/js/calendar.js b/js/calendar.js deleted file mode 100644 index 789e96c..0000000 --- a/js/calendar.js +++ /dev/null @@ -1,1187 +0,0 @@ -// Based on https://stackoverflow.com/a/15289883 -function computeDateDifferenceInHours (date1, date2) { - d1 = new Date(date1.getYear(), date1.getMonth(), date1.getDate(), date1.getHours()); - d2 = new Date(date2.getYear(), date2.getMonth(), date2.getDate(), date2.getHours()); - - const msPerHour = 60 * 60 * 1000; - return Math.abs(d2.getTime() - d1.getTime()) / msPerHour; -} - - - -class Calendar { - - constructor (calendarParameters = {}) { - this.containerNode = calendarParameters.containerNode !== undefined - ? calendarParameters.containerNode - : $("#cal-container"); - - this.eventContainerNode = null; - this.timeSlotsContainerNode = null; - this.eventDetailsContainerNode = null; - - this.startDate = calendarParameters.startDate !== undefined - ? calendarParameters.startDate - : new Date(); - this.endDate = calendarParameters.endDate !== undefined - ? calendarParameters.endDate - : new Date(Date.now() + (24 * 60 * 60 * 1000)); - - this.nbHoursToDisplay = 0; - this.firstHourToDisplay = 0; - this.endHourToDisplay = 0; - - this.events = []; - - this.onlyDisplaySubscribedEvents = calendarParameters.onlyDisplaySubscribedEvents !== undefined - ? calendarParameters.onlyDisplaySubscribedEvents - : false; - this.groupEventsByLocation = calendarParameters.groupEventsByLocation !== undefined - ? calendarParameters.groupEventsByLocation - : true; - - this.eventDetailURLFormat = calendarParameters.eventDetailURLFormat !== undefined - ? calendarParameters.eventDetailURLFormat - : ""; - this.subscriptionURLFormat = calendarParameters.subscriptionURLFormat !== undefined - ? calendarParameters.subscriptionURLFormat - : ""; - this.csrfToken = calendarParameters.csrfToken !== undefined - ? calendarParameters.csrfToken - : ""; - - // Map from locations to their CSS styles - this.locationStyles = new Map(); - - this.init(); - } - - init () { - this.updateHoursToDisplay(); - - this.createTimeSlotContainer(); - this.createEventContainer(); - this.createEventDetailsContainer(); - - this.updateTimeSlotContainerGridStyle(); - this.updateEventContainerGridStyle(); - - this.createTimeSlots(); - this.createEvents(); - - this.createLocationStyles(); - this.applyLocationStylesAsCSS(); - this.updateEventLocationStyleID(); - - //this.sortEventNodesByEndTimeAndLocation(); - this.sortEventNodesByIntervalGraphColoring(); - this.updateCalendarNodeHeight(); - - this.updateEventVisibilities(); - this.initEventOverflowTooltips(); - } - - - // Date change - - setStartDate (newStartDate) { - this.startDate = newStartDate; - - this.updateHoursToDisplay(); - this.updateEventContainerGridStyle(); - this.updateTimeSlots(); - - this.updateEventVisibilities(); - this.updateCalendarNodeHeight(); - this.sortEventNodesByIntervalGraphColoring(); - - this.startShowingEventOverflowTooltips(); - } - - setEndDate (newEndDate) { - this.endDate = newEndDate; - - this.updateHoursToDisplay(); - this.updateEventContainerGridStyle(); - this.updateTimeSlots(); - - this.updateEventVisibilities(); - this.updateCalendarNodeHeight(); - this.sortEventNodesByIntervalGraphColoring(); - - this.startShowingEventOverflowTooltips(); - } - - updateHoursToDisplay () { - this.startHourToDisplay = this.startDate.getHours(); - this.endHourToDisplay = this.endDate.getHours(); - - this.nbHoursToDisplay = Math.floor(computeDateDifferenceInHours(this.startDate, this.endDate)); - } - - - // Calendar container - - updateCalendarNodeHeight () { - // Time slot hour row - let timeSlotHourRowHeight = $(".cal-time-slot-hour").outerHeight(); - - // Event grid - this.containerNode.css("height", "calc(100% )"); - - let eventContainerHeight = this.eventContainerNode - .css("grid-template-rows") - .split("px ") - .reduce((heightAccumulator, currentRowHeight) => { - return heightAccumulator + parseInt(currentRowHeight); - }, 0); - - this.containerNode.css("height", timeSlotHourRowHeight + eventContainerHeight); - } - - - // Time slots - - createTimeSlotContainer () { - this.timeSlotsContainerNode = $("
") - .addClass("cal-time-slot-container") - .appendTo(this.containerNode); - } - - createTimeSlots () { - // Populate the container hour by hour - let self = this; - function getHourStringToDisplay (index, hour) { - if (index === self.nbHoursToDisplay - 1 - || hour === 23) { - return ""; - } - - if (hour >= 10) { - return hour + 1; - } - else { - return " " + (hour + 1); - } - } - - for (let i = 0; i < this.nbHoursToDisplay; i++) { - let hour = (this.startHourToDisplay + i) % 24; - - // Time slot hour - let timeSlotHourNode = $("
") - .addClass("cal-time-slot-hour") - .css({ - "grid-column-start": `${i + 1}`, - "grid-column-end" : "span 1", - "grid-row-start" : "1", - "grid-row-end" : "1" - }) - .html(getHourStringToDisplay(i, hour)) - .prependTo(this.timeSlotsContainerNode); - - // Time slot block - let timeSlotBlockNode = $("
") - .addClass("cal-time-slot") - .css({ - "grid-column-start": `${i + 1}`, - "grid-column-end" : "span 1", - "grid-row-start" : "2", - "grid-row-end" : "2" - }) - .appendTo(this.timeSlotsContainerNode); - - if (hour === 23) { - timeSlotHourNode.addClass("cal-last-hour"); - timeSlotBlockNode.addClass("cal-last-hour"); - } - - if (hour === 0) { - timeSlotHourNode.addClass("cal-first-hour"); - timeSlotBlockNode.addClass("cal-first-hour"); - } - } - } - - updateTimeSlotContainerGridStyle () { - this.timeSlotsContainerNode.css("grid-template-columns", - `repeat(${this.nbHoursToDisplay}, ${100 / this.nbHoursToDisplay }%)`); - } - - updateTimeSlots () { - this.timeSlotsContainerNode.empty(); - - this.createTimeSlots(); - this.updateTimeSlotContainerGridStyle(); - } - - getHourSlotWidth () { - return this.timeSlotsContainerNode.width() / this.nbHoursToDisplay; - } - - - // Events - - createEventContainer () { - this.eventContainerNode = $("
") - .addClass("cal-event-container") - .appendTo(this.containerNode); - } - - createEvents () { - // Move all event nodes into the event container - let eventElements = this.containerNode.find(".cal-event"); - eventElements.appendTo(this.eventContainerNode); - - // Create event objects from them all - for (let element of eventElements) { - let newEvent = new Event($(element), this); - this.events.push(newEvent); - } - } - - updateEventContainerGridStyle () { - this.eventContainerNode.css("grid-template-columns", - `repeat(${this.nbHoursToDisplay}, ${100 / this.nbHoursToDisplay }%)`); - } - - updateEventVisibilities () { - for (let event of this.events) { - event.updateVisibility(); - } - } - - - // Event details - - createEventDetailsContainer () { - this.eventDetailsContainerNode = $("
") - .addClass("cal-details-container") - .appendTo(this.containerNode); - } - - - // Location styles - - createLocationStyles () { - let locationIndices = new Map(); - for (let event of this.events) { - if (! locationIndices.has(event.location)) { - locationIndices.set(event.location, [...locationIndices.keys()].length); - } - } - - let nbUniqueLocations = [...locationIndices.keys()].length; - - let styleID = 0; - for (let [location, index] of locationIndices.entries()) { - let hue = (index / (nbUniqueLocations + 1)) * 255; - styleID += 1; - - this.locationStyles.set(location, { - id: styleID, - - normal: [ - `background-color: hsl(${hue}, 40%, 80%);`, - `border-color: hsl(${hue}, 40%, 50%);`, - `color: #000;` - ], - - hover: [ - `background-color: hsl(${hue}, 55%, 85%);`, - `border-color: hsl(${hue}, 45%, 55%);`, - `color: #000;` - ], - - subscribed: [ - `background-color: hsl(${hue}, 75%, 75%);`, - `border-color: hsl(${hue}, 60%, 50%);`, - `color: #000;` - ], - - selected: [ - `background-color: hsl(${hue}, 45%, 50%);`, - `border-color: hsl(${hue}, 40%, 35%);`, - `color: #FFF;` - ] - }); - } - } - - applyLocationStylesAsCSS () { - let styleNode = $("