faster animations, reactive updating viewing work

This commit is contained in:
Kenneth Jao 2017-04-21 02:59:56 -04:00
parent 83fd8f4521
commit e17f69892e
7 changed files with 136 additions and 113 deletions

View File

@ -185,18 +185,21 @@ a:hover {
color: #FCF0F0; color: #FCF0F0;
width: 100%; width: 100%;
position: absolute; position: absolute;
top: 63vh; bottom: 9vh;
} }
#mLoginTexts h1 { #mLoginTexts h1 {
width: 90%;
font-size: 8vw; font-size: 8vw;
font-weight: 300; font-weight: 300;
margin: 0; margin: 0 auto 0 auto;
padding: 0; padding: 0;
text-align: center; text-align: center;
} }
#mLoginTexts h5 { #mLoginTexts h5 {
width: 90%;
margin: 0 auto 0 auto;
font-size: 5vw; font-size: 5vw;
font-weight: 100; font-weight: 100;
text-align: Center; text-align: Center;

View File

@ -1202,13 +1202,13 @@ textarea.clickModify {
} }
.doneUser { .doneUser {
width: 90%;
font-size: 2vh; font-size: 2vh;
margin: 0; margin: 0;
padding: 5%; padding: 5%;
background-color: rgba(0,0,0,0.1); background-color: rgba(0,0,0,0.1);
position: relative; position: relative;
cursor: default !important;
display: table; display: table;
-webkit-transition: background-color 0.4s ease; -webkit-transition: background-color 0.4s ease;
@ -1222,13 +1222,13 @@ textarea.clickModify {
} }
.doneUser div { .doneUser div {
display: inline-block;
text-align: center; text-align: center;
display: table-cell; display: table-cell;
vertical-align: middle;
} }
.doneUser div:first-child { .doneUser div:first-child {
width: 15%; width: 4vh;
vertical-align: middle; vertical-align: middle;
} }
@ -1236,6 +1236,7 @@ textarea.clickModify {
width: 4vh; width: 4vh;
height: 4vh; height: 4vh;
line-height: 4vh; line-height: 4vh;
vertical-align: middle;
-moz-border-radius: 50%; -moz-border-radius: 50%;
-webkit-border-radius: 50%; -webkit-border-radius: 50%;
@ -1266,6 +1267,10 @@ textarea.clickModify {
transition: color 0.4s ease; transition: color 0.4s ease;
} }
.workCreator, .workCreator div {
cursor: initial !important;
}
#markDone p { #markDone p {
font-size: 70%; font-size: 70%;
} }

View File

@ -219,7 +219,7 @@
<span class="cWorkCreator">{{creatorname}}</span> <span class="cWorkCreator">{{creatorname}}</span>
</div> </div>
<div class="cWorkBottom"> <div class="cWorkBottom">
<span class="cWorkDate" style="font-weight:{{cardDate}}">{{dueDate}}</span> <span class="cWorkDate" style="font-weight:{{cardDate}}">{{dateWord}}</span>
<div style="color:{{doneRatio}}"> <div style="color:{{doneRatio}}">
<i class="fa fa-thumbs-up" aria-hidden="true"></i> <i class="fa fa-thumbs-up" aria-hidden="true"></i>
<span>{{confirmationLength}}</span> <span>{{confirmationLength}}</span>
@ -246,10 +246,10 @@
<template name="doneUsers"> <template name="doneUsers">
<div class="doneUser"> <div class="doneUser">
<div style="display:inline-block"> <div>
<img src='{{avatar}}' style="width:{{screen '3' '140'}};height:{{screen '3' '140'}}"> <img src='{{avatar}}'>
</div> </div>
<div style="display:inline-block;margin-left:0.3vw"> <div>
<span>{{user}}</span> <span>{{user}}</span>
</div> </div>
</div> </div>

View File

@ -10,6 +10,7 @@ var calWorkOpen = null;
var calWorkDate = null; var calWorkDate = null;
var dragging = false; var dragging = false;
var clicked = false; var clicked = false;
var workChanger = false;
var defaultWork = { var defaultWork = {
@ -44,21 +45,23 @@ Template.login.rendered = function() {
Template.main.created = function() { Template.main.created = function() {
Session.set("mode", Session.get("user").preferences.mode); Session.set("mode", Session.get("user").preferences.mode);
Session.set("myWork", []);
Session.set("filterWork", []);
Session.set("classInfo", null); Session.set("classInfo", null);
$(document).on('keyup', (e) => { $(document).on('keyup', (e) => {
if(event.keyCode === 27 && $(".overlay").css("display") !== "none") { if(event.keyCode === 27 && $(".overlay").css("display") !== "none") {
$(".overlay").fadeOut(150); $(".overlay").velocity("fadeOut", 150);
} }
}); });
work.find().observeChanges({ work.find().observeChanges({
added: function (id, fields) { added: function (id, fields) {
updateWork(id, fields, "added"); updateWork(id, fields, "added");
filterWork(Session.get("classDisp"),Session.get("typeFilter"), Session.get("user").preferences.hideTime); filterWork();
}, },
changed: function (id, fields) { changed: function (id, fields) {
updateWork(id, fields, "changed"); updateWork(id, fields, "changed");
filterWork(Session.get("classDisp"),Session.get("typeFilter")); filterWork();
}, },
removed: function (id) { removed: function (id) {
updateWork(id, null, "remove"); updateWork(id, null, "remove");
@ -96,7 +99,10 @@ Template.classesMode.rendered = function() {
area.on({ area.on({
'mousemove': function(e) { 'mousemove': function(e) {
if(clicked && !dragging) area.scrollLeft(area.scrollLeft() + (clickX - e.pageX)/70); if(clicked && !dragging) {
area.scrollLeft(area.scrollLeft() + (clickX - e.pageX));
clickX = e.pageX;
}
}, },
'mousedown': function(e) { 'mousedown': function(e) {
clicked = true; clicked = true;
@ -278,7 +284,7 @@ Template.main.helpers({
eventClick: function(event, jsEvent, view) { // On-click for work. eventClick: function(event, jsEvent, view) { // On-click for work.
Session.set("newWork", false); Session.set("newWork", false);
Session.set("currentWork", work.findOne({_id: event.id})); Session.set("currentWork", work.findOne({_id: event.id}));
$(".overlay").fadeIn(150); $(".overlay").velocity("fadeIn", 150);
$("#comment").slimScroll({ $("#comment").slimScroll({
width: '100%', width: '100%',
height: '20vh', height: '20vh',
@ -382,7 +388,7 @@ Template.main.events({
} }
if (e === "overlay") { // Overlay closing. if (e === "overlay") { // Overlay closing.
$(".overlay").fadeOut(150); $(".overlay").velocity("fadeOut", 150);
if (!Session.get("newWork")) { if (!Session.get("newWork")) {
document.getElementById("workComment").value = ""; document.getElementById("workComment").value = "";
var res = Session.get("restrictText"); var res = Session.get("restrictText");
@ -391,7 +397,7 @@ Template.main.events({
} }
} }
if (!document.getElementById("userDropdown").contains(event.target)) $("#userDropdown").fadeOut(250); if (!document.getElementById("userDropdown").contains(event.target)) $("#userDropdown").velocity("fadeOut", 150);
}, },
// MAIN MENU BUTTONS // MAIN MENU BUTTONS
'click .fa-bars' (event) { // Click menu button. 'click .fa-bars' (event) { // Click menu button.
@ -412,7 +418,7 @@ Template.main.events({
} }
Session.set("newWork", true); Session.set("newWork", true);
Session.set("currentWork",{class: attr, dueDate: (new Date((new Date()).valueOf() + 1000*3600*24))}); Session.set("currentWork",{class: attr, dueDate: (new Date((new Date()).valueOf() + 1000*3600*24))});
$(".overlay").fadeIn(150); $(".overlay").velocity("fadeIn", 150);
$("#comment").slimScroll({ $("#comment").slimScroll({
width: '100%', width: '100%',
height: '20vh', height: '20vh',
@ -422,24 +428,23 @@ Template.main.events({
}, },
'click .fa-check-circle-o' () { // Confirmation Button 'click .fa-check-circle-o' () { // Confirmation Button
sendData(confirm); sendData(confirm);
$("#confirmOverlay").fadeOut(250); $("#confirmOverlay").velocity("fadeOut", 150);
if(confirm === "changeAdmin") { if(confirm === "changeAdmin") {
$("#changeAdminWrapper").fadeOut(250); $("#changeAdminWrapper").velocity("fadeOut", 150);
} else if(confirm === "deleteClass") { } else if(confirm === "deleteClass") {
Session.set("classInfo", null); Session.set("classInfo", null);
} }
serverData = null; serverData = null;
confirm = null; confirm = null;
}, },
'click .fa-times-circle-o' () { // Deny Button 'click .fa-times-circle-o' () { // Deny Button
$("#confirmOverlay").fadeOut(250); $("#confirmOverlay").velocity("fadeOut", 150);
serverData = null; serverData = null;
confirm = null; confirm = null;
}, },
'click #dropdown' (event) { 'click #dropdown' (event) {
if (document.getElementById("userDropdown").style.display === "block") return; if (document.getElementById("userDropdown").style.display === "block") return;
$("#userDropdown").fadeIn(250); $("#userDropdown").velocity("fadeIn", 150);
}, },
'click .workCard' (event) { // Display work information on work card click. 'click .workCard' (event) { // Display work information on work card click.
if(event.target.className.indexOf("fa") !== -1) return; if(event.target.className.indexOf("fa") !== -1) return;
@ -462,7 +467,7 @@ Template.main.events({
var inputs = $('#editWork .clickModify').css("cursor", "default"); var inputs = $('#editWork .clickModify').css("cursor", "default");
} }
} }
$(".overlay").fadeIn(150); $(".overlay").velocity("fadeIn", 150);
$("#comment").slimScroll({ $("#comment").slimScroll({
width: '100%', width: '100%',
height: '20vh', height: '20vh',
@ -484,11 +489,11 @@ Template.main.events({
area.value = ""; area.value = "";
Session.set("restrictText", {}); Session.set("restrictText", {});
$("#requestSubmit span:first-child").fadeOut(200, function() { $("#requestSubmit span:first-child").fadeOut(200, function() {
$("#requestSubmit span:nth-child(2)").fadeIn(200); $("#requestSubmit span:nth-child(2)").velocity("fadeIn", 200);
}) })
setTimeout(function() { setTimeout(function() {
$("#requestSubmit span:nth-child(2)").fadeOut(200, function() { $("#requestSubmit span:nth-child(2)").fadeOut(200, function() {
$("#requestSubmit span:first-child").fadeIn(200); $("#requestSubmit span:first-child").velocity("fadeIn", 200);
}) })
}, 1250); }, 1250);
}); });
@ -515,7 +520,7 @@ Template.main.events({
} else { } else {
work.description = " - " + work.description; work.description = " - " + work.description;
} }
var duedate = work.realDate.toJSON().slice(0,10).replace(/-/gi,""); var duedate = work.dueDate.toJSON().slice(0,10).replace(/-/gi,"");
events += "\nBEGIN:VEVENT" + events += "\nBEGIN:VEVENT" +
"\nUID:" + timestamp + work._id + "@hourglass.tk" + "\nUID:" + timestamp + work._id + "@hourglass.tk" +
"\nDTSTAMP:" + timestamp + "\nDTSTAMP:" + timestamp +
@ -670,12 +675,12 @@ Template.main.events({
serverData = Session.get("currentWork"); serverData = Session.get("currentWork");
if(checkMissing()) return; if(checkMissing()) return;
sendData("createWork"); sendData("createWork");
$(".overlay").fadeOut(150); $(".overlay").velocity("fadeIn", 150);
}, },
'click #workDelete' () { 'click #workDelete' () {
serverData = Session.get("currentWork")._id; serverData = Session.get("currentWork")._id;
sendData("deleteWork"); sendData("deleteWork");
$(".overlay").fadeOut(150); $(".overlay").velocity("fadeOut", 150);
}, },
'click #markDone' () { // Click done button. 'click #markDone' () { // Click done button.
serverData = [Session.get("currentWork")._id, "done"]; serverData = [Session.get("currentWork")._id, "done"];
@ -700,8 +705,6 @@ Template.main.events({
'click #signout' () { 'click #signout' () {
$(".noScroll").velocity("fadeOut", 50); $(".noScroll").velocity("fadeOut", 50);
Session.set('sidebarMode',''); Session.set('sidebarMode','');
Session.set("myWork", []);
Session.set("filterWork", []);
document.getElementById('login-buttons-logout').click(); document.getElementById('login-buttons-logout').click();
} }
}); });
@ -720,17 +723,19 @@ Template.classesMode.helpers({
toggleOptionMenu = function(toggle, menu) { toggleOptionMenu = function(toggle, menu) {
if(toggle) { if(toggle) {
$(".selectedOption").removeClass("selectedOption"); $(".selectedOption").removeClass("selectedOption");
$("#" + menu).next() $("#" + menu).next().css('opacity', 0)
.css('opacity', 0) $("#" + menu).next().velocity("slideDown", 100);
.slideDown(300) $("#" + menu).next().velocity(
.animate(
{ opacity: 1 }, { opacity: 1 },
{ queue: false, duration: 100 } { queue: false, duration: 50 }
); );
optionOpen = [menu, toggle]; optionOpen = [menu, toggle];
} else { } else {
$("#" + menu).next().slideUp(100, function() { $("#" + menu).next().velocity("slideUp", {
$(this).css("opacity", 0); duration: 100,
complete: function() {
$("#" + menu).next().css("opacity", 0);
}
}); });
optionOpen = [null, toggle]; optionOpen = [null, toggle];
} }
@ -741,29 +746,19 @@ sendData = function(funcName) { // Call Meteor function, and do actions after fu
for(var key in serverData) { for(var key in serverData) {
if(serverData[key] === true) serverData[key] = ""; if(serverData[key] === true) serverData[key] = "";
} }
} }
if(funcName === "editWork") workChanger = true;
if(funcName === "editProfile") filterWork();
Meteor.call(funcName, serverData, function(error, result) { Meteor.call(funcName, serverData, function(error, result) {
serverData = null; serverData = null;
currWork = Session.get("currentWork");
if(currWork !== null && currWork._id !== undefined) {
Session.set("currentWork", work.findOne({
_id: currWork._id
}));
} else {
Session.set("currentWork",null);
}
if (error !== undefined) { if (error !== undefined) {
sAlert.error(error.error[1] || error.message, { sAlert.error(error.error[1] || error.message, {
effect: 'stackslide', effect: 'stackslide',
position: 'top' position: 'top'
}); });
} else { } else {
/*sAlert.success("Success!", {
effect: 'stackslide',
position: 'bottom-right',
timeout: 2500
});*/
if(funcName === "createClass") { if(funcName === "createClass") {
var inputs = document.getElementsByClassName("creInput"); var inputs = document.getElementsByClassName("creInput");
for(var i = 0; i < inputs.length; i++) { for(var i = 0; i < inputs.length; i++) {
@ -919,12 +914,12 @@ function formReadable(input, val) { // Makes work information readable by users.
if (!_.contains(input.done, Meteor.userId())) return "fa-square-o"; if (!_.contains(input.done, Meteor.userId())) return "fa-square-o";
return "fa-check-square-o"; return "fa-check-square-o";
case "userConfirm": case "userConfirm":
if (!_.contains(input.confirmations, Meteor.userId())) return (Meteor.Device.isPhone()) ? "rgb(101,101,101)" : ""; if (!_.contains(input.confirmations, Meteor.userId())) return (Meteor.Device.isPhone() || Meteor.Device.isTablet()) ? "rgb(101,101,101)" : "";
return "#27A127"; return "#27A127";
case "confirmations": case "confirmations":
return input.confirmations.length; return input.confirmations.length;
case "userReport": case "userReport":
if (!_.contains(input.reports, Meteor.userId())) return (Meteor.Device.isPhone()) ? "rgb(101,101,101)" : ""; if (!_.contains(input.reports, Meteor.userId())) return (Meteor.Device.isPhone() || Meteor.Device.isTablet()) ? "rgb(101,101,101)" : "";
return "#FF1A1A"; return "#FF1A1A";
case "reports": case "reports":
return input.reports.length; return input.reports.length;
@ -1016,6 +1011,7 @@ getClasses = function(myClasses) {
} }
updateWork = function(id, fields, type) { updateWork = function(id, fields, type) {
if(type === "remove" && Session.get("myWork").concat(Session.get("filterWork")).length === 0) return;
if(type === "remove" && Session.get("myWork").filter(function(work) { // Removed work and exists in user data. if(type === "remove" && Session.get("myWork").filter(function(work) { // Removed work and exists in user data.
return work._id === id; return work._id === id;
}).length !== 0) { }).length !== 0) {
@ -1033,13 +1029,15 @@ updateWork = function(id, fields, type) {
workObj = work.findOne({_id: id}); workObj = work.findOne({_id: id});
} }
if(Meteor.users.findOne({_id: workObj.creator}) === undefined) return;
if(Roles.userIsInRole(Meteor.userId(), ['superadmin', 'admin']) && !_.contains(Session.get("user").classes, workObj["class"])) return;
workObj.classid = workObj.class; workObj.classid = workObj.class;
workObj.shortname = (workObj.name.length <= 20) ? workObj.name : workObj.name.substring(0,20) + "..."; workObj.shortname = (workObj.name.length <= 20) ? workObj.name : workObj.name.substring(0,20) + "...";
workObj.className = (workObj.classid === Meteor.userId()) ? "Personal" : classes.findOne({_id: workObj.classid}).name; workObj.className = (workObj.classid === Meteor.userId()) ? "Personal" : classes.findOne({_id: workObj.classid}).name;
workObj.realDate = workObj.dueDate; workObj.dateWord = moment(workObj.dueDate).calendar(null, {
workObj.dueDate = moment(workObj.dueDate).calendar(null, {
sameDay: '[Today]', sameDay: '[Today]',
nextDay: '[Tomorrow]', nextDay: '[Tomorrow]',
nextWeek: 'dddd', nextWeek: 'dddd',
@ -1050,9 +1048,9 @@ updateWork = function(id, fields, type) {
workObj.shortdesc = (workObj.description === undefined) ? "" : (workObj.description.length <= 30 ) ? workObj.description : workObj.description.substring(0,30) + "..."; workObj.shortdesc = (workObj.description === undefined) ? "" : (workObj.description.length <= 30 ) ? workObj.description : workObj.description.substring(0,30) + "...";
if (workObj.dueDate === "Today") { // Font weight based on date proximity. if (workObj.dateWord === "Today") { // Font weight based on date proximity.
workObj.cardDate = "600"; workObj.cardDate = "600";
} else if (workObj.dueDate === "Tomorrow") { } else if (workObj.dateWord === "Tomorrow") {
workObj.cardDate = "400"; workObj.cardDate = "400";
} }
@ -1088,16 +1086,34 @@ updateWork = function(id, fields, type) {
var myWork; var myWork;
if(type === "added") { if(type === "added") {
myWork = Session.get("myWork"); myWork = Session.get("myWork");
myWork.push(workObj);
} else if(type === "changed") { } else if(type === "changed") {
myWork = Session.get("myWork").filter(function(work) { myWork = Session.get("myWork").filter(function(work) {
return work._id !== id; return work._id !== id;
}); });
myWork.push(workObj);
if(Session.get("currentWork")._id === id) {
Session.set("currentWork", workObj);
if($(".overlay").css("display") !== "none") { // If currently viewing work.
var message = Object.keys(fields)[0].replace("dueDate", "due date");
if(!workChanger && message !== "comments" && message !== "done" && message !== "confirmations") sAlert.success("The " + message + " of this work was updated by someone else!", {
effect: 'stackslide',
position: 'top',
timeout: 1500
});
workChanger = false;
}
}
} }
myWork.push(workObj);
Session.set("myWork", myWork); Session.set("myWork", myWork);
} }
filterWork = function(classDisp, typeFilter, hideTime) { filterWork = function() {
var classDisp = Session.get("classDisp");
var typeFilter = Session.get("typeFilter");
var hideTime = Session.get("user").preferences.timeHide;
var allWork = Session.get("filterWork").concat(Session.get("myWork")); var allWork = Session.get("filterWork").concat(Session.get("myWork"));
var hideWork = []; var hideWork = [];
var displayWork = []; var displayWork = [];
@ -1105,8 +1121,8 @@ filterWork = function(classDisp, typeFilter, hideTime) {
_.each(allWork, function(workObj) { _.each(allWork, function(workObj) {
var notInClassFilter = classDisp.length !== 0 && !_.contains(classDisp, workObj.classid); var notInClassFilter = classDisp.length !== 0 && !_.contains(classDisp, workObj.classid);
var notInTypeFilter = typeFilter.length !== 0 && !_.contains(typeFilter, workObj.type); var notInTypeFilter = typeFilter.length !== 0 && !_.contains(typeFilter, workObj.type);
var pastHideDate = hideTime !== 0 && (moment().subtract(hideTime, 'days'))._d > (moment(workObj.realDate))._d; var pastHideDate = hideTime !== 0 && (moment().subtract(hideTime, 'days'))._d > (moment(workObj.dueDate))._d;
var markedDone = Session.get("user").preferences.done && !Meteor.Device.isPhone() && _.contains(workObj.done, Meteor.userId()); var markedDone = Session.get("user").preferences.done && !(Meteor.Device.isPhone() || Meteor.Device.isTablet()) && _.contains(workObj.done, Meteor.userId());
var reported = (workObj.reportLength / (workObj.reportLength + workObj.confirmationLength)) > 0.7; // Over 70% are reports var reported = (workObj.reportLength / (workObj.reportLength + workObj.confirmationLength)) > 0.7; // Over 70% are reports
if(notInClassFilter || notInTypeFilter || pastHideDate || markedDone || reported) { if(notInClassFilter || notInTypeFilter || pastHideDate || markedDone || reported) {
@ -1116,7 +1132,7 @@ filterWork = function(classDisp, typeFilter, hideTime) {
} }
}); });
Session.set("myWork", displayWork.sort(function(a,b) { // Display work. Session.set("myWork", displayWork.sort(function(a,b) { // Display work.
return Date.parse(a.realDate) - Date.parse(b.realDate); return Date.parse(a.dueDate) - Date.parse(b.dueDate);
})); }));
Session.set("filterWork", hideWork); // Not displayed Session.set("filterWork", hideWork); // Not displayed
@ -1142,7 +1158,7 @@ function calendarEvents() {
events.push({ events.push({
id: work._id, id: work._id,
start: work.realDate.toISOString().slice(0, 10), start: work.dueDate.toISOString().slice(0, 10),
title: work.name, title: work.name,
backgroundColor: workColors[work.type], backgroundColor: workColors[work.type],
borderColor: "#444", borderColor: "#444",

View File

@ -71,7 +71,6 @@
width: 100%; width: 100%;
height: 64vh; height: 64vh;
max-height: 64vh; max-height: 64vh;
display: none;
} }
#backgroundOverlay { #backgroundOverlay {

View File

@ -5,11 +5,11 @@ Session.set("notsearching", true); // If user isn't searching
Session.set("noclass", null); // If user doesn't have classes. Session.set("noclass", null); // If user doesn't have classes.
Session.set("notfound", null); // If no results for autocomplete. Session.set("notfound", null); // If no results for autocomplete.
var filterOpen = [false, true, true, true, true]; var filterOpen = [true, true, true, true, true];
var sidebarMode = [null, null]; var sidebarMode = [null, null];
Template.sidebarMenuPlate.rendered = function() { Template.sidebarMenuPlate.rendered = function() {
$(".menuWrapper").slideDown(300); $(".menuWrapper").velocity("slideDown", 150);
$("#classListHolder").slimScroll({ $("#classListHolder").slimScroll({
width: '100%', width: '100%',
height: '', height: '',
@ -18,13 +18,13 @@ Template.sidebarMenuPlate.rendered = function() {
$("#filterWrapper.slimScrollBar").css("display", "none"); $("#filterWrapper.slimScrollBar").css("display", "none");
}; };
Template.sidebarOptionPlate.rendered = function() { Template.sidebarOptionPlate.rendered = function() {
$(".menuWrapper").slideDown(300); $(".menuWrapper").velocity("slideDown", 150);
}; };
Template.sidebarRequestPlate.rendered = function() { Template.sidebarRequestPlate.rendered = function() {
$(".menuWrapper").slideDown(300); $(".menuWrapper").velocity("slideDown", 150);
}; };
Template.sidebarCreatePlate.rendered = function() { Template.sidebarCreatePlate.rendered = function() {
$(".menuWrapper").slideDown(300); $(".menuWrapper").velocity("slideDown", 150);
}; };
Template.sidebarMenuPlate.helpers({ Template.sidebarMenuPlate.helpers({
@ -63,19 +63,19 @@ Template.sidebarMenuPlate.events({
'click #filterHead' (event) { 'click #filterHead' (event) {
if (event.target.id === "disableFilter") return; if (event.target.id === "disableFilter") return;
if (!filterOpen[0]) { if (!filterOpen[0]) {
$("#filterWrapper").slideDown(300); $("#filterWrapper").velocity("slideDown", 150);
} else { } else {
$("#filterWrapper").slideUp(300); $("#filterWrapper").velocity("slideUp", 150);
} }
filterOpen[0] = !filterOpen[0]; filterOpen[0] = !filterOpen[0];
}, },
'click #typeFilterWrapper' () { 'click #typeFilterWrapper' () {
if (!filterOpen[1]) { if (!filterOpen[1]) {
$("#classFilterHolder").slideDown(300); $("#classFilterHolder").velocity("slideDown", 150);
$("#classListHolder").animate({'max-height':'27.4507vh'},300); $("#classListHolder").velocity({'max-height':'27.4507vh'},300);
} else { } else {
$("#classFilterHolder").slideUp(300) $("#classFilterHolder").velocity("slideUp", 150);
$("#classListHolder").animate({'max-height':'52vh'},300); $("#classListHolder").velocity({'max-height':'52vh'},300);
} }
filterOpen[1] = !filterOpen[1]; filterOpen[1] = !filterOpen[1];
}, },
@ -83,9 +83,9 @@ Template.sidebarMenuPlate.events({
if (!filterOpen[2]) { if (!filterOpen[2]) {
var height = (88-100*$("#classFilterWrapper").offset().top / window.innerHeight) + "vh"; var height = (88-100*$("#classFilterWrapper").offset().top / window.innerHeight) + "vh";
$("#classListHolder").css('max-height',height); $("#classListHolder").css('max-height',height);
$("#classListHolder").slideDown(300); $("#classListHolder").velocity("slideDown", 150);
} else { } else {
$("#classListHolder").slideUp(300); $("#classListHolder").velocity("slideUp", 150);
} }
filterOpen[2] = !filterOpen[2]; filterOpen[2] = !filterOpen[2];
}, },
@ -99,7 +99,7 @@ Template.sidebarMenuPlate.events({
array.push(classid); array.push(classid);
} }
Session.set("classDisp", array); Session.set("classDisp", array);
filterWork(Session.get("classDisp"),Session.get("typeFilter"), Session.get("user").preferences.hideTime); filterWork();
}, },
'click .sideFilter' (event) { 'click .sideFilter' (event) {
var type = event.target.getAttribute("type"); var type = event.target.getAttribute("type");
@ -110,7 +110,7 @@ Template.sidebarMenuPlate.events({
array.push(type); array.push(type);
} }
Session.set("typeFilter", array); Session.set("typeFilter", array);
filterWork(Session.get("classDisp"),Session.get("typeFilter"), Session.get("user").preferences.hideTime); filterWork();
}, },
'click #disableFilter' () { 'click #disableFilter' () {
Session.set("classDisp", []); Session.set("classDisp", []);
@ -175,17 +175,17 @@ Template.sidebarOptionPlate.events({
}, },
'click #settingMode' () { 'click #settingMode' () {
if (!filterOpen[3]) { if (!filterOpen[3]) {
$("#settingModeWrapper").slideDown(300); $("#settingModeWrapper").velocity("slideDown", 150);
} else { } else {
$("#settingModeWrapper").slideUp(300); $("#settingModeWrapper").velocity("slideUp", 150);
} }
filterOpen[3] = !filterOpen[3]; filterOpen[3] = !filterOpen[3];
}, },
'click #preferencesWrapper' () { 'click #preferencesWrapper' () {
if (!filterOpen[4]) { if (!filterOpen[4]) {
$("#prefCont").slideDown(300); $("#prefCont").velocity("slideDown", 150);
} else { } else {
$("#prefCont").slideUp(300); $("#prefCont").velocity("slideUp", 150);
} }
filterOpen[4] = !filterOpen[4]; filterOpen[4] = !filterOpen[4];
} }
@ -301,7 +301,7 @@ Template.manageClass.events({
toggleToClassInfoMode("users"); toggleToClassInfoMode("users");
}, },
'click .infoCard .fa-pencil-square-o' () { 'click .infoCard .fa-pencil-square-o' () {
$("#changeAdminWrapper").fadeIn(250); $("#changeAdminWrapper").velocity("fadeIn", 150);
}, },
'click #adminSubmit' () { 'click #adminSubmit' () {
var input = document.getElementById("changeAdmin"); var input = document.getElementById("changeAdmin");
@ -324,19 +324,19 @@ Template.manageClass.events({
]; ];
Session.set("confirmText", "Change ownership?"); Session.set("confirmText", "Change ownership?");
confirm = "changeAdmin"; confirm = "changeAdmin";
$("#confirmOverlay").fadeIn(250); $("#confirmOverlay").velocity("fadeIn", 150);
}, },
'click #deleteClass' () { 'click #deleteClass' () {
serverData = Session.get("classInfo"); serverData = Session.get("classInfo");
confirm = "deleteClass"; confirm = "deleteClass";
Session.set("confirmText", "Delete this class?"); Session.set("confirmText", "Delete this class?");
$("#confirmOverlay").fadeIn(250); $("#confirmOverlay").velocity("fadeIn", 150);
}, },
'click .classBox .fa-times' (event) { 'click .classBox .fa-times' (event) {
serverData = event.target.parentNode.getAttribute("classid"); serverData = event.target.parentNode.getAttribute("classid");
confirm = "leaveClass"; confirm = "leaveClass";
Session.set("confirmText", "Leave this class?"); Session.set("confirmText", "Leave this class?");
$("#confirmOverlay").fadeIn(250); $("#confirmOverlay").velocity("fadeIn", 150);
} }
}); });
@ -580,7 +580,7 @@ Template.classInfoCode.events({
document.execCommand("copy"); document.execCommand("copy");
$(event.target.parentNode.childNodes[9]).fadeIn(100, function() { $(event.target.parentNode.childNodes[9]).fadeIn(100, function() {
setTimeout(function() { setTimeout(function() {
$(event.target.parentNode.childNodes[9]).fadeOut(250); $(event.target.parentNode.childNodes[9]).velocity("fadeOut", 150);
}, 500); }, 500);
}); });
} }
@ -650,52 +650,52 @@ Template.classInfoUsers.events({
}); });
toggleToMode = function(mode) { toggleToMode = function(mode) {
$("#mainBody").fadeOut(250, function() { $("#mainBody").fadeOut(150, function() {
(Session.equals("sidebarMode", "option")) ? Session.set("settingMode", mode): Session.set("mode", mode); (Session.equals("sidebarMode", "option")) ? Session.set("settingMode", mode): Session.set("mode", mode);
Session.set("classInfo", null); Session.set("classInfo", null);
$("#mainBody").fadeIn(250); $("#mainBody").fadeIn(150);
}); });
}; };
toggleToSidebar = function(sidebar) { toggleToSidebar = function(sidebar) {
try { try {
$("#backgroundOverlay").fadeOut(250); $("#backgroundOverlay").velocity("fadeOut", 200);
} catch (err) {} } catch (err) {}
if (Session.equals("sidebarMode", sidebar) || !sidebar) { if (Session.equals("sidebarMode", sidebar) || !sidebar) {
$("#menuContainer").hide("slide", { $("#menuContainer").hide("slide", {
direction: "left" direction: "left"
}, 250); }, 200);
$("#divCenter").stop().animate({ $("#divCenter").stop().velocity({
left: '6vh' left: '6vh'
}, 250, function() { }, 200, function() {
Session.set("sidebarMode", ""); Session.set("sidebarMode", "");
}); });
} else { } else {
$("#menuContainer").show("slide", { $("#menuContainer").show("slide", {
direction: "left" direction: "left"
}, 250); }, 200);
$("#divCenter").stop().animate({ $("#divCenter").stop().velocity({
left: '36vh' left: '36vh'
}, 250); }, 200);
$(".menuWrapper").fadeOut(200, function() { $(".menuWrapper").fadeOut(200, function() {
Session.set("sidebarMode", sidebar); Session.set("sidebarMode", sidebar);
}); });
} }
filterOpen = [false, true, true, true, true]; filterOpen = [true, true, true, true, true];
}; };
toggleToClassInfo = function(classId) { toggleToClassInfo = function(classId) {
$("#changeAdminWrapper").fadeOut(250); $("#changeAdminWrapper").fadeOut(150);
$("#infoClassCont").fadeOut(250, function() { $("#infoClassCont").fadeOut(150, function() {
Session.set("classInfo", classId); Session.set("classInfo", classId);
Session.set("classInfoMode", "general"); Session.set("classInfoMode", "general");
$(this).fadeIn(250); $(this).fadeIn(150);
}); });
}; };
toggleToClassInfoMode = function(mode) { toggleToClassInfoMode = function(mode) {
$("#infoClassCont").fadeOut(250, function() { $("#infoClassCont").fadeOut(150, function() {
Session.set("classInfoMode", mode); Session.set("classInfoMode", mode);
$(this).fadeIn(250); $(this).fadeIn(150);
}); });
}; };

View File

@ -17,15 +17,17 @@ Template.registerHelper('optionInfo', (type) => {
}); });
Template.mobile.created = function() { Template.mobile.created = function() {
Session.set("myWork", []);
Session.set("filterWork", []);
getClasses(Session.get("user").classes); getClasses(Session.get("user").classes);
work.find().observeChanges({ work.find().observeChanges({
added: function (id, fields) { added: function (id, fields) {
updateWork(id, fields, "added"); updateWork(id, fields, "added");
filterWork(Session.get("classDisp"),Session.get("typeFilter"), Session.get("user").preferences.hideTime); filterWork();
}, },
changed: function (id, fields) { changed: function (id, fields) {
updateWork(id, fields, "changed"); updateWork(id, fields, "changed");
filterWork(Session.get("classDisp"),Session.get("typeFilter"), Session.get("user").preferences.hideTime); filterWork();
}, },
removed: function (id) { removed: function (id) {
updateWork(id, null, "remove"); updateWork(id, null, "remove");
@ -168,8 +170,6 @@ Template.defaultSidebar.rendered = function() {
addMobileButton($("#mSignOut"), 0.1, "brightness", function() { addMobileButton($("#mSignOut"), 0.1, "brightness", function() {
$(".noScroll").velocity("fadeOut", 50); $(".noScroll").velocity("fadeOut", 50);
Session.set("myWork", []);
Session.set("filterWork", []);
document.getElementById('login-buttons-logout').click(); document.getElementById('login-buttons-logout').click();
}) })
@ -388,7 +388,7 @@ Template.mSidebarClasses.rendered = function() {
} }
Session.set("classDisp", array); Session.set("classDisp", array);
timedPushback(true); timedPushback(true);
filterWork(Session.get("classDisp"),Session.get("typeFilter"), Session.get("user").preferences.hideTime); filterWork();
} }
}); });
} }
@ -411,7 +411,7 @@ Template.mSideTypeFilter.rendered = function() {
} }
Session.set("typeFilter", array); Session.set("typeFilter", array);
timedPushback(true); timedPushback(true);
filterWork(Session.get("classDisp"),Session.get("typeFilter"), Session.get("user").preferences.hideTime); filterWork();
} }
}); });
} }
@ -451,12 +451,12 @@ Template.mobile.helpers({
noneText(type) { noneText(type) {
return (type === "main") ? return (type === "main") ?
(Session.get("myWork").filter(function(work) { (Session.get("myWork").filter(function(work) {
return _.contains(work.done, Meteor.userId()); return !_.contains(work.done, Meteor.userId());
}).length === 0) ? "none" : "block" }).length === 0) ? "block" : "none"
: :
(Session.get("myWork").filter(function(work) { (Session.get("myWork").filter(function(work) {
return !_.contains(work.done, Meteor.userId()); return _.contains(work.done, Meteor.userId());
}).length === 0) ? "none" : "block"; }).length === 0) ? "block" : "none";
}, },
buttonType() { buttonType() {
if(Session.equals("mobileMode","main") || Session.equals("mobileMode","done")) { if(Session.equals("mobileMode","main") || Session.equals("mobileMode","done")) {