formatting

This commit is contained in:
Yaman Qalieh 2016-08-12 12:28:55 -04:00
parent 513e19046c
commit 09104bbbeb
5 changed files with 952 additions and 967 deletions

View File

@ -3,9 +3,7 @@
width: 100%; width: 100%;
margin: 0; margin: 0;
box-shadow: 2px 2px 5px 3px #666; box-shadow: 2px 2px 5px 3px #666;
background-color: #EBEBEB; background-color: #EBEBEB;
display: inline-block; display: inline-block;
position: relative; position: relative;
z-index: 50; z-index: 50;
@ -15,7 +13,6 @@
padding: 0.5%; padding: 0.5%;
padding-left: 1%; padding-left: 1%;
float: left; float: left;
-webkit-filter: drop-shadow(2px 2px 5px #333); -webkit-filter: drop-shadow(2px 2px 5px #333);
filter: drop-shadow(2px 2px 5px #333); filter: drop-shadow(2px 2px 5px #333);
} }
@ -36,7 +33,6 @@
min-height: 100%; min-height: 100%;
position: absolute; position: absolute;
top: 11%; top: 11%;
background-color: #E5E5E5; background-color: #E5E5E5;
background-image: url("banner100.jpg"); background-image: url("banner100.jpg");
} }
@ -45,13 +41,10 @@
position: fixed; position: fixed;
top: 50%; top: 50%;
left: 50%; left: 50%;
-moz-border-radius: 50%; -moz-border-radius: 50%;
-webkit-border-radius: 50%; -webkit-border-radius: 50%;
border-radius: 50%; border-radius: 50%;
background-color: rgba(0, 0, 0, 0.2);
background-color: rgba(0,0,0,0.2);
-webkit-filter: drop-shadow(2px 2px 5px #333); -webkit-filter: drop-shadow(2px 2px 5px #333);
filter: drop-shadow(2px 2px 5px #333); filter: drop-shadow(2px 2px 5px #333);
} }
@ -65,7 +58,6 @@
.text { .text {
text-align: center; text-align: center;
color: #FFF; color: #FFF;
-webkit-filter: drop-shadow(2px 2px 5px #444); -webkit-filter: drop-shadow(2px 2px 5px #444);
filter: drop-shadow(2px 2px 5px #444); filter: drop-shadow(2px 2px 5px #444);
} }
@ -84,20 +76,15 @@ p.text {
#loginButton { #loginButton {
font-size: 200%; font-size: 200%;
padding: 2%; padding: 2%;
-webkit-border-radius: 6; -webkit-border-radius: 6;
-moz-border-radius: 6; -moz-border-radius: 6;
border-radius: 6px; border-radius: 6px;
position: relative; position: relative;
background-color: #005CE6; background-color: #005CE6;
-webkit-transition: background-color 0.4s ease; -webkit-transition: background-color 0.4s ease;
-moz-transition: background-color 0.4s ease; -moz-transition: background-color 0.4s ease;
-ms-transition: background-color 0.4s ease; -ms-transition: background-color 0.4s ease;
transition: background-color 0.4s ease; transition: background-color 0.4s ease;
cursor: pointer; cursor: pointer;
} }
@ -107,7 +94,6 @@ p.text {
#loginButton:active { #loginButton:active {
background-color: #FF4D4D; background-color: #FF4D4D;
-webkit-transition: background-color 0.1s ease; -webkit-transition: background-color 0.1s ease;
-moz-transition: background-color 0.1s ease; -moz-transition: background-color 0.1s ease;
-ms-transition: background-color 0.1s ease; -ms-transition: background-color 0.1s ease;
@ -130,7 +116,6 @@ p.text {
font-size: 150%; font-size: 150%;
margin: 0; margin: 0;
padding: 1%; padding: 1%;
-webkit-filter: drop-shadow(2px 2px 5px #444); -webkit-filter: drop-shadow(2px 2px 5px #444);
filter: drop-shadow(2px 2px 5px #444); filter: drop-shadow(2px 2px 5px #444);
} }
@ -138,7 +123,6 @@ p.text {
a { a {
color: #0099CC; color: #0099CC;
text-decoration: none; text-decoration: none;
-webkit-transition: color 0.4s ease; -webkit-transition: color 0.4s ease;
-moz-transition: color 0.4s ease; -moz-transition: color 0.4s ease;
-ms-transition: color 0.4s ease; -ms-transition: color 0.4s ease;
@ -148,4 +132,3 @@ a {
a:hover { a:hover {
color: #00BFFF; color: #00BFFF;
} }

View File

@ -1,4 +1,6 @@
import { Template } from 'meteor/templating'; import {
Template
} from 'meteor/templating';
import './main.html'; import './main.html';
@ -9,12 +11,12 @@ var openValues = {
var themeColors = { var themeColors = {
"light": { "light": {
"background":"White.jpg", "background": "White.jpg",
"header":"#EBEBEB", "header": "#EBEBEB",
"sidebar":"#65839A", "sidebar": "#65839A",
"statusIcons":"#33ADFF", "statusIcons": "#33ADFF",
"highlightText":"#FF1A1A", "highlightText": "#FF1A1A",
"cards":"#FEFEFE" "cards": "#FEFEFE"
}, },
"dark": { "dark": {
@ -25,75 +27,75 @@ var calendarColors = {
"project": "blue", "project": "blue",
"normal": "green", "normal": "green",
"quiz": "black" "quiz": "black"
} };
var options = { var options = {
"privacy": ["Public", "Hidden"], "privacy": ["Public", "Hidden"],
"category": ["Class", "Club", "Other"] "category": ["Class", "Club", "Other"]
} };
var searchSchools = []; var searchSchools = [];
Session.set("sidebar",null); Session.set("sidebar", null);
Session.set("mode",null); // Change to user preferences Session.set("mode", null); // Change to user preferences
Template.registerHelper( 'divColor', (div) => { Template.registerHelper('divColor', (div) => {
return themeColors[Cookie.get("theme")][div]; return themeColors[Cookie.get("theme")][div];
}) });
Template.registerHelper( 'overlayDim', (part) => { Template.registerHelper('overlayDim', (part) => {
var dim = [window.innerWidth * .2,window.innerHeight * .2]; var dim = [window.innerWidth * .2, window.innerHeight * 0.2];
var width = "width:"+dim[0].toString() + "px;"; var width = "width:" + dim[0].toString() + "px;";
var height = "height:"+dim[1].toString() + "px;"; var height = "height:" + dim[1].toString() + "px;";
var margin = "margin-left:"+(-dim[0]/2).toString() + "px;"; var margin = "margin-left:" + (-dim[0] / 2).toString() + "px;";
var bg = "background-color:"+themeColors[Cookie.get("theme")]["header"]+";"; var bg = "background-color:" + themeColors[Cookie.get("theme")].header + ";";
return width+height+margin+bg; return width + height + margin + bg;
}) });
Template.main.helpers({ Template.main.helpers({
schoolName() { schoolName() {
return " - " + Meteor.user().profile.school; return " - " + Meteor.user().profile.school;
}, },
iconColor(icon) { iconColor(icon) {
if(Session.get("sidebar") === icon+"Container") { if (Session.get("sidebar") === icon + "Container") {
return themeColors[Cookie.get("theme")].statusIcons; return themeColors[Cookie.get("theme")].statusIcons;
} else if(Session.get("sidebar") === "both") { } else if (Session.get("sidebar") === "both") {
return themeColors[Cookie.get("theme")].statusIcons; return themeColors[Cookie.get("theme")].statusIcons;
} else { } else {
return; return;
} }
}, },
bgSrc() { bgSrc() {
var dim = [window.innerWidth,window.innerHeight]; var dim = [window.innerWidth, window.innerHeight];
var pic = themeColors[Cookie.get("theme")].background; var pic = themeColors[Cookie.get("theme")].background;
return pic; return pic;
}, },
menuStatus() { menuStatus() {
if(Session.get("sidebar") === "menuContainer") { if (Session.get("sidebar") === "menuContainer") {
return "0%"; return "0%";
} else if(Session.get("sidebar") === "both") { } else if (Session.get("sidebar") === "both") {
return "0%"; return "0%";
} else { } else {
return openValues["menu"]; return openValues.menu;
} }
}, },
optionsStatus() { optionsStatus() {
if(Session.get("sidebar") === "optionsContainer") { if (Session.get("sidebar") === "optionsContainer") {
return "0%"; return "0%";
} else if(Session.get("sidebar") === "both") { } else if (Session.get("sidebar") === "both") {
return "0%"; return "0%";
} else { } else {
return openValues["options"]; return openValues.options;
} }
}, },
modeStatus(status) { modeStatus(status) {
if(status === Session.get("mode")) { if (status === Session.get("mode")) {
return themeColors[Cookie.get("theme")].highlightText; return themeColors[Cookie.get("theme")].highlightText;
} else { } else {
return; return;
} }
}, },
currMode(name) { currMode(name) {
if(name === Session.get("mode")) { if (name === Session.get("mode")) {
return true; return true;
} else { } else {
return false; return false;
@ -105,11 +107,15 @@ Template.main.helpers({
cursor.forEach(function(current) { cursor.forEach(function(current) {
backgroundColor = calendarColors[current.type]; backgroundColor = calendarColors[current.type];
title = current.name; title = current.name;
duedate = current.dueDate.toISOString().slice(0,10); duedate = current.dueDate.toISOString().slice(0, 10);
events.push({start: duedate, title: title, backgroundColor: backgroundColor}); events.push({
start: duedate,
title: title,
backgroundColor: backgroundColor
});
}); });
return { return {
height: window.innerHeight *.8, height: window.innerHeight * .8,
events: events, events: events,
buttonText: { buttonText: {
today: 'Today', today: 'Today',
@ -120,62 +126,62 @@ Template.main.helpers({
}; };
}, },
calCenter() { calCenter() {
var width = window.innerWidth * .85; var width = window.innerWidth * 0.85;
return "width:"+width.toString()+"px;margin-left:"+(.5*window.innerWidth-.5*width).toString()+"px"; return "width:" + width.toString() + "px;margin-left:" + (0.5 * window.innerWidth - 0.5 * width).toString() + "px";
}, },
calbg() { calbg() {
var width = window.innerWidth * .865; var width = window.innerWidth * 0.865;
var height = window.innerHeight * .76; var height = window.innerHeight * 0.76;
return "width:"+width.toString()+"px;height:"+height.toString()+"px;margin-left:"+(.5*window.innerWidth-.5*width).toString()+"px;margin-top:"+(.47*window.innerHeight-.5*height).toString()+"px"; return "width:" + width.toString() + "px;height:" + height.toString() + "px;margin-left:" + (0.5 * window.innerWidth - 0.5 * width).toString() + "px;margin-top:" + (0.47 * window.innerHeight - 0.5 * height).toString() + "px";
} }
}); });
Template.main.events({ Template.main.events({
'click .fa-bars' () { 'click .fa-bars' () {
var side = Session.get("sidebar"); var side = Session.get("sidebar");
if(side === "menuContainer") { if (side === "menuContainer") {
Session.set("sidebar",null) Session.set("sidebar", null);
} else if(side === "optionsContainer") { } else if (side === "optionsContainer") {
Session.set("sidebar","both"); Session.set("sidebar", "both");
} else if(side === "both") { } else if (side === "both") {
Session.set("sidebar","optionsContainer"); Session.set("sidebar", "optionsContainer");
} else { } else {
Session.set("sidebar","menuContainer"); Session.set("sidebar", "menuContainer");
} }
}, },
'click .fa-cog' () { 'click .fa-cog' () {
var side = Session.get("sidebar"); var side = Session.get("sidebar");
if(side === "optionsContainer") { if (side === "optionsContainer") {
Session.set("sidebar",null) Session.set("sidebar", null);
} else if(side === "menuContainer") { } else if (side === "menuContainer") {
Session.set("sidebar","both"); Session.set("sidebar", "both");
} else if(side === "both") { } else if (side === "both") {
Session.set("sidebar","menuContainer"); Session.set("sidebar", "menuContainer");
} else { } else {
Session.set("sidebar","optionsContainer"); Session.set("sidebar", "optionsContainer");
} }
}, },
'click .classes' () { 'click .classes' () {
if(Session.get("mode") === "classes") return; if (Session.get("mode") === "classes") return;
var modeHolder = document.getElementById("mainBody"); var modeHolder = document.getElementById("mainBody");
closeDivFade(modeHolder); closeDivFade(modeHolder);
setTimeout(function() { setTimeout(function() {
Session.set("mode","classes"); Session.set("mode", "classes");
openDivFade(modeHolder); openDivFade(modeHolder);
}, 300); }, 300);
}, },
'click .calendar' () { 'click .calendar' () {
if(Session.get("mode") === "calendar") return; if (Session.get("mode") === "calendar") return;
var modeHolder = document.getElementById("mainBody"); var modeHolder = document.getElementById("mainBody");
closeDivFade(modeHolder); closeDivFade(modeHolder);
setTimeout(function() { setTimeout(function() {
Session.set("mode","calendar"); Session.set("mode", "calendar");
openDivFade(modeHolder); openDivFade(modeHolder);
}, 300); }, 300);
}, },
'click' (event) { 'click' (event) {
var e = event.target.className; var e = event.target.className;
if(e !== Session.get("sidebar") && if (e !== Session.get("sidebar") &&
!e.includes("fa-cog") && !e.includes("fa-cog") &&
!e.includes("fa-bars") && !e.includes("fa-bars") &&
!document.getElementById("menuContainer").contains(event.target) && !document.getElementById("menuContainer").contains(event.target) &&

View File

@ -56,7 +56,6 @@
-moz-border-radius: 50%; -moz-border-radius: 50%;
-webkit-border-radius: 50%; -webkit-border-radius: 50%;
border-radius: 50%; border-radius: 50%;
position: absolute; position: absolute;
top: 43%; top: 43%;
left: 2.5%; left: 2.5%;
@ -68,7 +67,6 @@
width: 100%; width: 100%;
height: 5%; height: 5%;
padding: 0.5% 0 0.5% 0; padding: 0.5% 0 0.5% 0;
background-color: #0D0D0D; background-color: #0D0D0D;
} }
@ -84,13 +82,10 @@
.profOptions { .profOptions {
box-shadow: 2px 2px 5px 3px #666; box-shadow: 2px 2px 5px 3px #666;
position: absolute; position: absolute;
display: none; display: none;
z-index: 5; z-index: 5;
opacity: 0; opacity: 0;
-webkit-transition: opacity 0.4s ease; -webkit-transition: opacity 0.4s ease;
-moz-transition: opacity 0.4s ease; -moz-transition: opacity 0.4s ease;
-ms-transition: opacity 0.4s ease; -ms-transition: opacity 0.4s ease;
@ -102,10 +97,8 @@
min-width: 10%; min-width: 10%;
padding: 20px; padding: 20px;
margin: 0; margin: 0;
text-align: center; text-align: center;
cursor: pointer; cursor: pointer;
-webkit-transition: box-shadow 0.4s ease; -webkit-transition: box-shadow 0.4s ease;
-moz-transition: box-shadow 0.4s ease; -moz-transition: box-shadow 0.4s ease;
-ms-transition: box-shadow 0.4s ease; -ms-transition: box-shadow 0.4s ease;
@ -113,7 +106,7 @@
} }
.profOptions p:hover { .profOptions p:hover {
box-shadow: inset 0 0 0 99999px rgba(0,0,0,0.1); box-shadow: inset 0 0 0 99999px rgba(0, 0, 0, 0.1);
} }
#profCards { #profCards {
@ -126,7 +119,6 @@
padding: 4%; padding: 4%;
padding-top: 2.5%; padding-top: 2.5%;
padding-right: 4%; padding-right: 4%;
box-shadow: 2px 2px 5px 3px #666; box-shadow: 2px 2px 5px 3px #666;
} }
@ -145,7 +137,6 @@
height: 30%; height: 30%;
float: right; float: right;
border-top: 5px solid #2E4F74; border-top: 5px solid #2E4F74;
-webkit-transition: width 0.4s ease; -webkit-transition: width 0.4s ease;
-moz-transition: width 0.4s ease; -moz-transition: width 0.4s ease;
-ms-transition: width 0.4s ease; -ms-transition: width 0.4s ease;
@ -170,12 +161,9 @@
.profFunction { .profFunction {
margin-right: 1%; margin-right: 1%;
padding: 2%; padding: 2%;
border: 2px solid rgba(0, 0, 0, 0.2);
border: 2px solid rgba(0,0,0,0.2);
display: inherit; display: inherit;
cursor: pointer; cursor: pointer;
-webkit-transition: background-color 0.4s ease; -webkit-transition: background-color 0.4s ease;
-moz-transition: background-color 0.4s ease; -moz-transition: background-color 0.4s ease;
-ms-transition: background-color 0.4s ease; -ms-transition: background-color 0.4s ease;
@ -183,11 +171,11 @@
} }
.profFunction:hover { .profFunction:hover {
background-color: rgba(0,0,0,0.1); background-color: rgba(0, 0, 0, 0.1);
} }
.profFunction i, .profFunction h4 { .profFunction i,
.profFunction h4 {
padding: 1%; padding: 1%;
} }
@ -200,29 +188,34 @@
width: 30%; width: 30%;
margin-top: 3%; margin-top: 3%;
padding: 1.5% 1% 1.5% 1%; padding: 1.5% 1% 1.5% 1%;
-webkit-animation: expand .7s ease 1; -webkit-animation: expand .7s ease 1;
animation: expand .7s ease 1; animation: expand .7s ease 1;
} }
@-webkit-keyframes expand { @-webkit-keyframes expand {
0% { width: 0%; } 0% {
100% { width: 30%; } width: 0%;
}
100% {
width: 30%;
}
} }
@keyframes expand { @keyframes expand {
0% { width: 0%; } 0% {
100% { width: 30%; } width: 0%;
}
100% {
width: 30%;
}
} }
#label { #label {
width: 90%; width: 90%;
margin-top: 2.5%; margin-top: 2.5%;
margin-bottom: 2%; margin-bottom: 2%;
background-color: rgba(0, 0, 0, 0.2);
background-color: rgba(0,0,0,0.2);
box-shadow: none; box-shadow: none;
display: table; display: table;
cursor: default; cursor: default;
} }
@ -231,9 +224,7 @@
width: 90%; width: 90%;
padding: 1%; padding: 1%;
padding-right: 100%; padding-right: 100%;
display: inline-block; display: inline-block;
overflow-x: hidden; overflow-x: hidden;
overflow-y: scroll; overflow-y: scroll;
} }
@ -242,10 +233,8 @@
font-style: italic; font-style: italic;
font-weight: 200; font-weight: 200;
margin-left: 1%; margin-left: 1%;
color: #999; color: #999;
-webkit-filter: none;
-webkit-filter :none;
filter: none; filter: none;
} }
@ -254,11 +243,9 @@
width: 100%; width: 100%;
margin-bottom: 3%; margin-bottom: 3%;
padding: 2%; padding: 2%;
box-shadow: 2px 2px 5px 3px #666; box-shadow: 2px 2px 5px 3px #666;
display: table; display: table;
cursor: pointer; cursor: pointer;
-webkit-transition: background-color 0.4s ease; -webkit-transition: background-color 0.4s ease;
-moz-transition: background-color 0.4s ease; -moz-transition: background-color 0.4s ease;
-ms-transition: background-color 0.4s ease; -ms-transition: background-color 0.4s ease;
@ -266,7 +253,7 @@
} }
.classBox:hover { .classBox:hover {
background-color: rgba(0,0,0,0.1); background-color: rgba(0, 0, 0, 0.1);
} }
.classText { .classText {
@ -327,11 +314,9 @@
font-size: 140%; font-size: 140%;
margin: 0 35% 0 35%; margin: 0 35% 0 35%;
padding: 2%; padding: 2%;
background-color: rgba(0, 0, 0, 0.25);
background-color: rgba(0,0,0,0.25);
text-align: center; text-align: center;
cursor: pointer; cursor: pointer;
-webkit-transition: background-color 0.4s ease; -webkit-transition: background-color 0.4s ease;
-moz-transition: background-color 0.4s ease; -moz-transition: background-color 0.4s ease;
-ms-transition: background-color 0.4s ease; -ms-transition: background-color 0.4s ease;
@ -339,7 +324,7 @@
} }
#creSubmit:hover { #creSubmit:hover {
background-color: rgba(0,0,0,0.15); background-color: rgba(0, 0, 0, 0.15);
} }
#restrict { #restrict {
@ -353,14 +338,11 @@
#save { #save {
font-size: 90%; font-size: 90%;
background-color: #CC4444; background-color: #CC4444;
box-shadow: -1px 2px 5px 1px #333; box-shadow: -1px 2px 5px 1px #333;
position: absolute; position: absolute;
top: 0; top: 0;
right: 10%; right: 10%;
z-index: 5; z-index: 5;
-webkit-transition: transform 0.2s ease, background-color 0.1s ease; -webkit-transition: transform 0.2s ease, background-color 0.1s ease;
-moz-transition: transform 0.2s ease, background-color 0.1s ease; -moz-transition: transform 0.2s ease, background-color 0.1s ease;
-ms-transition: transform 0.2s ease, background-color 0.1s ease; -ms-transition: transform 0.2s ease, background-color 0.1s ease;
@ -383,9 +365,6 @@
font-weight: 200; font-weight: 200;
width: 100%; width: 100%;
padding: 8%; padding: 8%;
-webkit-filter: none; -webkit-filter: none;
filter: none !important; filter: none !important;
} }

View File

@ -1,22 +1,24 @@
import { Template } from 'meteor/templating'; import {
Template
} from 'meteor/templating';
Session.set("profInputOpen",null); Session.set("profInputOpen", null);
Session.set("profClassTab","manClass"); Session.set("profClassTab", "manClass");
Session.set("modifying",null); Session.set("modifying", null);
Session.set("radioDiv",null); Session.set("radioDiv", null);
Session.set("notsearching",true); Session.set("notsearching", true);
Session.set("confirm",null); Session.set("confirm", null);
Session.set("serverData",null); Session.set("serverData", null);
Session.set("autocompleteDivs", null); Session.set("autocompleteDivs", null);
Session.set("confirmText",null); Session.set("confirmText", null);
var themeColors = { var themeColors = {
"light": { "light": {
"header":"#EBEBEB", "header": "#EBEBEB",
"sidebar":"#65839A", "sidebar": "#65839A",
"statusIcons":"#33ADFF", "statusIcons": "#33ADFF",
"highlightText":"#FF1A1A", "highlightText": "#FF1A1A",
"cards":"#FEFEFE" "cards": "#FEFEFE"
}, },
"dark": { "dark": {
@ -33,7 +35,9 @@ Template.profile.helpers({
collection: classes, collection: classes,
field: "name", field: "name",
template: Template.classDisplay, template: Template.classDisplay,
filter: {status: true} filter: {
status: true
}
}] }]
}; };
}, },
@ -63,77 +67,90 @@ Template.profile.helpers({
}; };
}, },
mainCenter() { mainCenter() {
var width = window.innerWidth * 1600/1920 + 10; var width = window.innerWidth * 1600 / 1920 + 10;
return "width:"+width.toString()+"px;margin-left:"+-.5*width.toString()+"px"; return "width:" + width.toString() + "px;margin-left:" + -0.5 * width.toString() + "px";
}, },
mainHeight() { mainHeight() {
return window.innerHeight.toString()+"px"; return window.innerHeight.toString() + "px";
}, },
banner() { banner() {
var width = window.innerWidth * 1600/1920; var width = window.innerWidth * 1600 / 1920;
var height = width * 615/1600; var height = width * 615 / 1600;
if(Meteor.user().profile.banner !== undefined) { if (Meteor.user().profile.banner !== undefined) {
var banner = Meteor.user().profile.banner; var banner = Meteor.user().profile.banner;
} else { } else {
var banner = "defaultcover.jpg"; var banner = "defaultcover.jpg";
} }
return "width:"+width.toString()+"px;height:"+height.toString()+"px;background-image:url(\'"+banner+"\');background-size:"+width.toString()+"px "+height.toString()+"px"; return "width:" + width.toString() + "px;height:" + height.toString() + "px;background-image:url(\'" + banner + "\');background-size:" + width.toString() + "px " + height.toString() + "px";
}, },
avatar() { avatar() {
var dim = window.innerWidth * 1600/1920 * .16; var dim = window.innerWidth * 1600 / 1920 * 0.16;
if(Meteor.user().profile.avatar !== undefined) { if (Meteor.user().profile.avatar !== undefined) {
var pic = "\'"+Meteor.user().profile.avatar+"\'"; var pic = "\'" + Meteor.user().profile.avatar + "\'";
} else { } else {
var pic = "defaultAvatars/"+(Math.floor(Math.random() * (11 - 1)) + 1).toString()+".png"; var pic = "defaultAvatars/" + (Math.floor(Math.random() * (11 - 1)) + 1).toString() + ".png";
} }
return "background-image:url("+pic+");background-size:"+dim.toString()+"px "+dim.toString()+"px"; return "background-image:url(" + pic + ");background-size:" + dim.toString() + "px " + dim.toString() + "px";
}, },
avatarDim() { avatarDim() {
var dim = window.innerWidth * 1600/1920 * .16; var dim = window.innerWidth * 1600 / 1920 * 0.16;
return "height:"+dim.toString()+"px;width:"+dim.toString()+"px;top:"+.43*window.innerHeight.toString()+"px;"; return "height:" + dim.toString() + "px;width:" + dim.toString() + "px;top:" + 0.43 * window.innerHeight.toString() + "px;";
}, },
username() { username() {
return Meteor.user().profile.name; return Meteor.user().profile.name;
}, },
motd() { motd() {
if(Meteor.user().profile.description !== undefined) { if (Meteor.user().profile.description !== undefined) {
return Meteor.user().profile.description; return Meteor.user().profile.description;
} else { } else {
return "Say something about yourself!"; return "Say something about yourself!";
} }
}, },
school() { school() {
if(Meteor.user().profile.school !== undefined) { if (Meteor.user().profile.school !== undefined) {
return Meteor.user().profile.school; return Meteor.user().profile.school;
} else { } else {
return "Click here to edit..."; return "Click here to edit...";
} }
}, },
grade() { grade() {
if(Meteor.user().profile.grade !== undefined) { if (Meteor.user().profile.grade !== undefined) {
return Meteor.user().profile.grade+"th"; return Meteor.user().profile.grade + "th";
} else { } else {
return "Click here to edit..."; return "Click here to edit...";
} }
}, },
classes() { classes() {
return classes.find( { status: { $eq: true }, privacy: { $eq: false }}, {sort: { subscribers: -1 }}, {limit: 20}).fetch(); return classes.find({
status: {
$eq: true
},
privacy: {
$eq: false
}
}, {
sort: {
subscribers: -1
}
}, {
limit: 20
}).fetch();
}, },
profClassHeight() { profClassHeight() {
return .6*window.innerHeight.toString()+"px"; return 0.6 * window.innerHeight.toString() + "px";
}, },
classHolderHeight() { classHolderHeight() {
return .26*window.innerHeight.toString()+"px"; return 0.26 * window.innerHeight.toString() + "px";
},
profClassTabColor(status) {        
if (status === Session.get("profClassTab")) {            
return themeColors[Cookie.get("theme")].highlightText;        
} else {            
return;        
}    
}, },
profClassTabColor(status) {
        if(status === Session.get("profClassTab")) {
            return themeColors[Cookie.get("theme")].highlightText;
        } else {
            return;
        }
    },
profClassTab(tab) { profClassTab(tab) {
if(tab === Session.get("profClassTab")) { if (tab === Session.get("profClassTab")) {
return true; return true;
} else { } else {
return false; return false;
@ -158,40 +175,40 @@ Template.profile.helpers({
confirmText() { confirmText() {
return Session.get("confirmText"); return Session.get("confirmText");
} }
}) });
Template.profile.events({ Template.profile.events({
'click profOptions p' (event) { 'click profOptions p' (event) {
var p = event.target; var p = event.target;
p.parentNode.parentNode.childNodes[1].value = p.childNodes[0].nodeValue; p.parentNode.parentNode.childNodes[1].value = p.childNodes[0].nodeValue;
closeDivFade(p.parentNode); closeDivFade(p.parentNode);
Session.set("radioDiv",null); Session.set("radioDiv", null);
Session.set("radioOffset",null); Session.set("radioOffset", null);
}, },
'click .change' (event) { 'click .change' (event) {
var ele = event.target; var ele = event.target;
var sessval = Session.get("modifying"); var sessval = Session.get("modifying");
if(ele.id !== sessval && sessval !== null) closeInput(sessval); if (ele.id !== sessval && sessval !== null) closeInput(sessval);
Session.set("modifying", ele.id); Session.set("modifying", ele.id);
var dim = ele.getBoundingClientRect(); var dim = ele.getBoundingClientRect();
ele.style.display = "none"; ele.style.display = "none";
var input = document.createElement("input"); var input = document.createElement("input");
if(ele.getAttribute("type") !== null) { if (ele.getAttribute("type") !== null) {
input.type = ele.getAttribute("type"); input.type = ele.getAttribute("type");
} else { } else {
input.type = "text"; input.type = "text";
} }
input.value = ele.childNodes[0].nodeValue; input.value = ele.childNodes[0].nodeValue;
input.className = "changeInput"; input.className = "changeInput";
input.style.height = .9*dim.height.toString()+"px"; input.style.height = 0.9 * dim.height.toString() + "px";
input.style.width = "70%"; input.style.width = "70%";
input.style.padding = "0.1%"; input.style.padding = "0.1%";
input.id = ele.id+"a"; input.id = ele.id + "a";
input.setAttribute("opc",ele.getAttribute("opc")); input.setAttribute("opc", ele.getAttribute("opc"));
ele.parentNode.appendChild(input); ele.parentNode.appendChild(input);
if(ele.getAttribute("re") == "readonly") { if (ele.getAttribute("re") == "readonly") {
input.readOnly = true; input.readOnly = true;
input.className += " op"; input.className += " op";
input.style.cursor = "pointer"; input.style.cursor = "pointer";
@ -199,63 +216,63 @@ Template.profile.events({
input.select(); input.select();
} }
input.focus(); input.focus();
if(ele.getAttribute("restrict") !== null) { if (ele.getAttribute("restrict") !== null) {
var span = document.createElement("span"); var span = document.createElement("span");
span.id = "restrict"; span.id = "restrict";
var num = parseInt(ele.getAttribute("restrict"))-input.value.length; var num = parseInt(ele.getAttribute("restrict")) - input.value.length;
if(num <= 0) { if (num <= 0) {
span.style.setProperty("color","#FF1A1A","important"); span.style.setProperty("color", "#FF1A1A", "important");
num = 0; num = 0;
} }
span.appendChild(document.createTextNode(num.toString()+" characters left")); span.appendChild(document.createTextNode(num.toString() + " characters left"));
ele.parentNode.appendChild(span); ele.parentNode.appendChild(span);
} }
}, },
'click' (event) { 'click' (event) {
var sessval = Session.get("modifying"); var sessval = Session.get("modifying");
if(event.target.id !== sessval && if (event.target.id !== sessval &&
event.target.id !== sessval+"a" && event.target.id !== sessval + "a" &&
!Session.equals("modifying",null) && !Session.equals("modifying", null) &&
!event.target.parentNode.className.includes("profOptions")) { !event.target.parentNode.className.includes("profOptions")) {
closeInput(sessval); closeInput(sessval);
} }
if(!event.target.className.includes("radio") && if (!event.target.className.includes("radio") &&
!Session.equals("radioDiv",null) && !Session.equals("radioDiv", null) &&
!event.target.parentNode.className.includes("profOptions") && !event.target.parentNode.className.includes("profOptions") &&
event.target.readOnly !== true) { event.target.readOnly !== true) {
var opnum = (parseInt(Session.get("radioDiv"))-parseInt(Session.get("radioOffset"))).toString(); var opnum = (parseInt(Session.get("radioDiv")) - parseInt(Session.get("radioOffset"))).toString();
for(var i = 0; i < document.getElementsByClassName("profOptions").length; i++) { for (var i = 0; i < document.getElementsByClassName("profOptions").length; i++) {
try { try {
closeDivFade(document.getElementsByClassName("profOptions")[i]); closeDivFade(document.getElementsByClassName("profOptions")[i]);
} catch(err) {} } catch (err) {}
} }
Session.set("radioDiv",null); Session.set("radioDiv", null);
Session.set("radioOffset",null); Session.set("radioOffset", null);
} }
}, },
'keydown' (event) { 'keydown' (event) {
var sessval = Session.get("modifying"); var sessval = Session.get("modifying");
if(event.keyCode == 13) { if (event.keyCode == 13) {
try { try {
closeInput(sessval); closeInput(sessval);
} catch(err) {} } catch (err) {}
} }
if(sessval !== null && event.keyCode !== 13) { if (sessval !== null && event.keyCode !== 13) {
var restrict = document.getElementById(sessval).getAttribute("restrict"); var restrict = document.getElementById(sessval).getAttribute("restrict");
if(restrict !== null) { if (restrict !== null) {
var num = parseInt(restrict)-event.target.value.length; var num = parseInt(restrict) - event.target.value.length;
var restext = document.getElementById("restrict"); var restext = document.getElementById("restrict");
if(num === 1) { if (num === 1) {
restext.childNodes[0].nodeValue = num.toString()+" character left"; restext.childNodes[0].nodeValue = num.toString() + " character left";
restext.style.setProperty("color","#999","important"); restext.style.setProperty("color", "#999", "important");
} else if(num <= 0) { } else if (num <= 0) {
var input = document.getElementById(sessval+"a"); var input = document.getElementById(sessval + "a");
input.value = input.value.substring(0,parseInt(restrict)); input.value = input.value.substring(0, parseInt(restrict));
restext.childNodes[0].nodeValue = "0 characters left"; restext.childNodes[0].nodeValue = "0 characters left";
restext.style.setProperty("color","#FF1A1A","important"); restext.style.setProperty("color", "#FF1A1A", "important");
} else { } else {
restext.childNodes[0].nodeValue = num.toString()+" characters left"; restext.childNodes[0].nodeValue = num.toString() + " characters left";
restext.style.setProperty("color","#999","important"); restext.style.setProperty("color", "#999", "important");
} }
} }
} }
@ -265,99 +282,99 @@ Template.profile.events({
Session.set("radioDiv", op.getAttribute("op")); Session.set("radioDiv", op.getAttribute("op"));
Session.set("radioOffset", op.getAttribute("opc")); Session.set("radioOffset", op.getAttribute("opc"));
try { try {
for(var i = 0; i < document.getElementsByClassName("profOptions").length; i++) { for (var i = 0; i < document.getElementsByClassName("profOptions").length; i++) {
var curr = document.getElementsByClassName("profOptions")[i]; var curr = document.getElementsByClassName("profOptions")[i];
if(Session.get("radioDiv") !== i.toString()) { if (Session.get("radioDiv") !== i.toString()) {
closeDivFade(document.getElementsByClassName("profOptions")[i]); closeDivFade(document.getElementsByClassName("profOptions")[i]);
} }
} }
} catch(err) {} } catch (err) {}
openDivFade(document.getElementsByClassName("profOptions")[op.getAttribute("op")]); openDivFade(document.getElementsByClassName("profOptions")[op.getAttribute("op")]);
}, },
'click .profOptions p' (event) { 'click .profOptions p' (event) {
var sessval = Session.get("modifying"); var sessval = Session.get("modifying");
var p = event.target; var p = event.target;
var opnum = (parseInt(Session.get("radioDiv"))-parseInt(Session.get("radioOffset"))).toString(); var opnum = (parseInt(Session.get("radioDiv")) - parseInt(Session.get("radioOffset"))).toString();
var input = document.getElementsByClassName("op")[opnum]; var input = document.getElementsByClassName("op")[opnum];
input.value = p.childNodes[0].nodeValue; input.value = p.childNodes[0].nodeValue;
try{ try {
closeInput(sessval); closeInput(sessval);
} catch(err) {} } catch (err) {}
closeDivFade(p.parentNode); closeDivFade(p.parentNode);
input.focus(); input.focus();
Session.set("radioDiv",null); Session.set("radioDiv", null);
Session.set("radioOffset",null); Session.set("radioOffset", null);
},
'click .addClass' () {        
var functionHolder = document.getElementById("profClassInfoHolder");
closeDivFade(functionHolder);        
setTimeout(function() {            
Session.set("profClassTab", "addClass");            
openDivFade(functionHolder);        
}, 300);    
},
    'click .manageClass' () {        
var functionHolder = document.getElementById("profClassInfoHolder");
closeDivFade(functionHolder);        
setTimeout(function() {            
Session.set("profClassTab", "manClass");            
openDivFade(functionHolder);        
}, 300);    
},
    'click .createClass' () {        
var functionHolder = document.getElementById("profClassInfoHolder");        
closeDivFade(functionHolder);        
setTimeout(function() {            
Session.set("profClassTab", "creClass");            
openDivFade(functionHolder);        
}, 300);    
}, },
'click .addClass' () {
        var functionHolder = document.getElementById("profClassInfoHolder")
        closeDivFade(functionHolder);
        setTimeout(function() {
            Session.set("profClassTab","addClass");
            openDivFade(functionHolder);
        },300);
    },
    'click .manageClass' () {
        var functionHolder = document.getElementById("profClassInfoHolder")
        closeDivFade(functionHolder);
        setTimeout(function() {
            Session.set("profClassTab","manClass");
            openDivFade(functionHolder);
        },300);
    },
    'click .createClass' () {
        var functionHolder = document.getElementById("profClassInfoHolder")
        closeDivFade(functionHolder);
        setTimeout(function() {
            Session.set("profClassTab","creClass");
            openDivFade(functionHolder);
        },300);
    },
'click .fa-search' () { 'click .fa-search' () {
Session.set("searching",true); Session.set("searching", true);
}, },
'click .fa-times-thin' () { 'click .fa-times-thin' () {
Session.set("searching",false); Session.set("searching", false);
}, },
'keydown #profClassSearch' (event) { 'keydown #profClassSearch' (event) {
if(event.target.value === "") { if (event.target.value === "") {
Session.set("notsearching",true); Session.set("notsearching", true);
} else { } else {
Session.set("notsearching",false); Session.set("notsearching", false);
} }
Session.set("autocompleteDivs",null); Session.set("autocompleteDivs", null);
var divs = []; var divs = [];
try { try {
var items = document.getElementsByClassName("-autocomplete-container")[0].childNodes[3].childNodes; var items = document.getElementsByClassName("-autocomplete-container")[0].childNodes[3].childNodes;
if(items.length === 0) { if (items.length === 0) {
Session.set("notfound",true); Session.set("notfound", true);
} else { } else {
Session.set("notfound",false); Session.set("notfound", false);
} }
for(var i = 2; i < items.length; i+=3) { for (var i = 2; i < items.length; i += 3) {
var item = items[i].childNodes[3]; var item = items[i].childNodes[3];
divs.push({ divs.push({
name: item.childNodes[1].childNodes[0].nodeValue, name: item.childNodes[1].childNodes[0].nodeValue,
teacher: item.childNodes[3].childNodes[0].nodeValue, teacher: item.childNodes[3].childNodes[0].nodeValue,
hour: item.childNodes[5].childNodes[0].nodeValue, hour: item.childNodes[5].childNodes[0].nodeValue,
subscribers: item.childNodes[7].childNodes[0].nodeValue, subscribers: item.childNodes[7].childNodes[0].nodeValue,
_id:item.getAttribute("classid") _id: item.getAttribute("classid")
}); });
Session.set("autocompleteDivs", divs); Session.set("autocompleteDivs", divs);
} }
} catch(err) {} } catch (err) {}
}, },
'click .classBox' (event) { 'click .classBox' (event) {
if(event.target.id === "label") return; if (event.target.id === "label") return;
if(event.target.className !== "classBox") { if (event.target.className !== "classBox") {
var attribute = event.target.parentNode.getAttribute("classid"); var attribute = event.target.parentNode.getAttribute("classid");
} else { } else {
var attribute = event.target.getAttribute("classid"); var attribute = event.target.getAttribute("classid");
} }
var data = [attribute,""]; var data = [attribute, ""];
Session.set("serverData",data); Session.set("serverData", data);
Session.set("confirm","joinClass"); Session.set("confirm", "joinClass");
Session.set("confirmText","Join class?"); Session.set("confirmText", "Join class?");
openDivFade(document.getElementsByClassName("overlay")[0]); openDivFade(document.getElementsByClassName("overlay")[0]);
setTimeout(function() { setTimeout(function() {
@ -367,17 +384,17 @@ Template.profile.events({
'click .fa-check-circle-o' () { 'click .fa-check-circle-o' () {
sendData(Session.get("confirm")); sendData(Session.get("confirm"));
closeDivFade(document.getElementsByClassName("overlay")[0]); closeDivFade(document.getElementsByClassName("overlay")[0]);
Session.set("serverData",null); Session.set("serverData", null);
Session.set("confirm",null); Session.set("confirm", null);
}, },
'click .fa-times-circle-o' () { 'click .fa-times-circle-o' () {
closeDivFade(document.getElementsByClassName("overlay")[0]); closeDivFade(document.getElementsByClassName("overlay")[0]);
Session.set("serverData",null); Session.set("serverData", null);
Session.set("confirm",null); Session.set("confirm", null);
}, },
'click #save' () { 'click #save' () {
Session.set("serverData",getProfileData()); Session.set("serverData", getProfileData());
Session.set("confirm","editProfile"); Session.set("confirm", "editProfile");
Session.set("confirmText", "Save new profile settings?"); Session.set("confirmText", "Save new profile settings?");
openDivFade(document.getElementsByClassName("overlay")[0]); openDivFade(document.getElementsByClassName("overlay")[0]);
@ -387,9 +404,9 @@ Template.profile.events({
}, },
'click #creSubmit' () { 'click #creSubmit' () {
var data = getCreateFormData(); var data = getCreateFormData();
if(data == null) return; if (data === null) return;
Session.set("serverData",data); Session.set("serverData", data);
Session.set("confirm","createClass"); Session.set("confirm", "createClass");
Session.set("confirmText", "Submit request?"); Session.set("confirmText", "Submit request?");
openDivFade(document.getElementsByClassName("overlay")[0]); openDivFade(document.getElementsByClassName("overlay")[0]);
@ -400,10 +417,10 @@ Template.profile.events({
'focus .op' (event) { 'focus .op' (event) {
event.target.click(); event.target.click();
} }
}) });
function openDivFade(div) { function openDivFade(div) {
if(div.className === "profOptions") { if (div.className === "profOptions") {
div.style.display = "inline-block"; div.style.display = "inline-block";
} else { } else {
div.style.display = "block"; div.style.display = "block";
@ -422,33 +439,33 @@ function closeDivFade(div) {
} }
function closeInput(sessval) { function closeInput(sessval) {
var input = document.getElementById(sessval+"a"); var input = document.getElementById(sessval + "a");
var span = document.getElementById(sessval); var span = document.getElementById(sessval);
input.parentNode.removeChild(input); input.parentNode.removeChild(input);
try{ try {
var restrict = document.getElementById("restrict"); var restrict = document.getElementById("restrict");
restrict.parentNode.removeChild(restrict) restrict.parentNode.removeChild(restrict);
} catch(err) {} } catch (err) {}
if(input.value == "") { if (input.value === "") {
span.childNodes[0].nodeValue = "Click here to edit..."; span.childNodes[0].nodeValue = "Click here to edit...";
} else { } else {
span.childNodes[0].nodeValue = input.value; span.childNodes[0].nodeValue = input.value;
} }
span.style.display = "initial"; span.style.display = "initial";
Session.set("modifying",null); Session.set("modifying", null);
} }
function sendData(funcName) { function sendData(funcName) {
Meteor.call(funcName,Session.get("serverData")); Meteor.call(funcName, Session.get("serverData"));
} }
function getProfileData() { function getProfileData() {
var description = document.getElementById("motd").childNodes[0].nodeValue; var description = document.getElementById("motd").childNodes[0].nodeValue;
var school = document.getElementById("school").childNodes[0].nodeValue; var school = document.getElementById("school").childNodes[0].nodeValue;
var gradein = document.getElementById("grade").childNodes[0].nodeValue; var gradein = document.getElementById("grade").childNodes[0].nodeValue;
var grade = parseInt(gradein.substring(gradein.length-2,gradein)); var grade = parseInt(gradein.substring(gradein.length - 2, gradein));
var avatar = document.getElementById("profAvatar").style.backgroundImage.replace(")","").replace("url(","").replace("\"","").replace("\"",""); var avatar = document.getElementById("profAvatar").style.backgroundImage.replace(")", "").replace("url(", "").replace("\"", "").replace("\"", "");
var banner = document.getElementById("profBanner").style.backgroundImage.replace(")","").replace("url(","").replace("\"","").replace("\"",""); var banner = document.getElementById("profBanner").style.backgroundImage.replace(")", "").replace("url(", "").replace("\"", "").replace("\"", "");
return { return {
school: school, school: school,
@ -462,23 +479,23 @@ function getProfileData() {
function getCreateFormData() { function getCreateFormData() {
var stop; var stop;
var form = document.getElementsByClassName("creInput"); var form = document.getElementsByClassName("creInput");
for(var i = 0; i < form.length; i++) { for (var i = 0; i < form.length; i++) {
if(form[i].value === "") { if (form[i].value === "") {
form[i].focus(); form[i].focus();
form[i].placeholder = "Missing field"; form[i].placeholder = "Missing field";
form[i].className += " formInvalid"; form[i].className += " formInvalid";
stop = true; stop = true;
} else { } else {
form[i].className = form[i].className.replace(" formInvalid",""); form[i].className = form[i].className.replace(" formInvalid", "");
} }
} }
if(stop) return null; if (stop) return null;
var school = form[0].value; var school = form[0].value;
var hour = form[1].value; var hour = form[1].value;
var teacher = form[2].value; var teacher = form[2].value;
var name = form[3].value; var name = form[3].value;
if(form[4].value == "public") { if (form[4].value == "public") {
var privacy = false; var privacy = false;
} else { } else {
var privacy = true; var privacy = true;