Renaming and small optmization

This commit is contained in:
Kenneth Jao 2016-09-02 01:00:52 -04:00
parent bded6702cf
commit f95b53db08
5 changed files with 19 additions and 19 deletions

View File

View File

View File

View File

@ -171,9 +171,9 @@ Template.main.helpers({
return " - " + Meteor.user().profile.school; return " - " + Meteor.user().profile.school;
}, },
iconColor(icon) { // Sidebar status color iconColor(icon) { // Sidebar status color
if (Session.get("sidebar") === icon + "Container") { if (Session.equals("sidebar",icon + "Container")) {
return themeColors[Meteor.user().profile.preferences.theme].statusIcons; return themeColors[Meteor.user().profile.preferences.theme].statusIcons;
} else if (Session.get("sidebar") === "both") { } else if (Session.equals("sidebar","both")) {
return themeColors[Meteor.user().profile.preferences.theme].statusIcons; return themeColors[Meteor.user().profile.preferences.theme].statusIcons;
} else { } else {
return; return;
@ -192,25 +192,25 @@ Template.main.helpers({
return pic; return pic;
}, },
menuStatus() { // Status of of menu sidebar. menuStatus() { // Status of of menu sidebar.
if (Session.get("sidebar") === "menuContainer") { if (Session.equals("sidebar","menuContainer")) {
return "0%"; return "0%";
} else if (Session.get("sidebar") === "both") { } else if (Session.equals("sidebar","both")) {
return "0%"; return "0%";
} else { } else {
return openValues.menu; return openValues.menu;
} }
}, },
optionsStatus() { // Status of options sidebar. optionsStatus() { // Status of options sidebar.
if (Session.get("sidebar") === "optionsContainer") { if (Session.equals("sidebar","optionsContainer")) {
return "0%"; return "0%";
} else if (Session.get("sidebar") === "both") { } else if (Session.equals("sidebar","both")) {
return "0%"; return "0%";
} else { } else {
return openValues.options; return openValues.options;
} }
}, },
modeStatus(status) { // Color status of display modes. modeStatus(status) { // Color status of display modes.
if (status === Session.get("mode")) { if (Session.equals("mode",status)) {
return themeColors[Meteor.user().profile.preferences.theme].highlightText; return themeColors[Meteor.user().profile.preferences.theme].highlightText;
} else { } else {
return; return;
@ -344,16 +344,16 @@ Template.main.helpers({
}, },
commentDim() { // Dimensions of comment container. commentDim() { // Dimensions of comment container.
var work = Session.get("currentWork"); var work = Session.get("currentWork");
if(Session.get("newWork") === null || work === null) return; if(Session.equals("newWork",null) || work === null) return;
if(Session.get("newWork") || work.comments.length <= 3) return; if(Session.get("newWork") || work.comments.length <= 3) return;
return 0.23*window.innerHeight.toString() + "px"; return 0.23*window.innerHeight.toString() + "px";
}, },
work(value) { // Returns the specified work value. work(value) { // Returns the specified work value.
if(Session.get("currentWork") === null) return; if(Session.equals("currentWork",null)) return;
return Session.get("currentReadableWork")[value]; return Session.get("currentReadableWork")[value];
}, },
workType() { // Returns color for respective work type. workType() { // Returns color for respective work type.
if(Session.get("currentWork") === null) return; if(Session.equals("currentWork",null)) return;
if(Session.get("currentWork").type === undefined) return; if(Session.get("currentWork").type === undefined) return;
type = Session.get("currentWork").type; type = Session.get("currentWork").type;
if(type.includes("edit")) { if(type.includes("edit")) {
@ -369,7 +369,7 @@ Template.main.helpers({
return Session.get("newWork"); return Session.get("newWork");
}, },
inRole() { // Checks correct permissions. inRole() { // Checks correct permissions.
if(Session.get("currentWork") === null) return; if(Session.equals("currentWork",null)) return;
if(Session.get("newWork")) { if(Session.get("newWork")) {
return true; return true;
} else { } else {
@ -401,7 +401,7 @@ Template.main.events({
closeInput(modifyingInput); closeInput(modifyingInput);
} }
if (e !== Session.get("sidebar") && // Sidebar closing. if (!Session.equals("sidebar",e) && // Sidebar closing.
!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) &&
@ -474,7 +474,7 @@ Template.main.events({
} }
}, },
'click .classes' () { // Click classes mode button. 'click .classes' () { // Click classes mode button.
if (Session.get("mode") === "classes") return; if (Session.equals("mode","classes")) return;
var modeHolder = document.getElementById("mainBody"); var modeHolder = document.getElementById("mainBody");
closeDivFade(modeHolder); closeDivFade(modeHolder);
setTimeout(function() { setTimeout(function() {
@ -484,7 +484,7 @@ Template.main.events({
Session.set("sidebar",null); // Closes all sidebars. Session.set("sidebar",null); // Closes all sidebars.
}, },
'click .calendar' () { // Click calendar mode button. 'click .calendar' () { // Click calendar mode button.
if (Session.get("mode") === "calendar") return; if (Session.equals("mode","calendar")) return;
var modeHolder = document.getElementById("mainBody"); var modeHolder = document.getElementById("mainBody");
closeDivFade(modeHolder); closeDivFade(modeHolder);
setTimeout(function() { setTimeout(function() {

View File

@ -149,14 +149,14 @@ Template.profile.helpers({
}, },
profClassTabColor(status) { // Change this [Supposed to show the current mode that's selected via color] profClassTabColor(status) { // Change this [Supposed to show the current mode that's selected via color]
           
if (status === Session.get("profClassTab")) {             if (Session.equals("profClassTab",status)) {            
return themeColors[Meteor.user().profile.preferences.theme].highlightText;         return themeColors[Meteor.user().profile.preferences.theme].highlightText;        
} else {             } else {            
return;         return;        
}     }    
}, },
profClassTab(tab) { // Tells current class profClassTab(tab) { // Tells current class
if (tab === Session.get("profClassTab")) { if (Session.get("profClassTab",tab)) {
return true; return true;
} else { } else {
return false; return false;
@ -178,7 +178,7 @@ Template.profile.helpers({
return Session.get("confirmText"); return Session.get("confirmText");
}, },
selectedClass(val) { // Returns values for selectedClass selectedClass(val) { // Returns values for selectedClass
if(Session.get("selectClassId") === null) return; if(Session.equals("selectClassId",null)) return;
var usertype = ["moderators","banned"]; var usertype = ["moderators","banned"];
var attribute = Session.get("selectClassId"); var attribute = Session.get("selectClassId");
var array = classes.findOne({_id:attribute}); var array = classes.findOne({_id:attribute});
@ -232,7 +232,7 @@ Template.profile.events({
} }
} }
if(!document.getElementById("createdClasses").contains(event.target) && if(!document.getElementById("createdClasses").contains(event.target) &&
Session.get("code") !== null && !Session.equals("code",null) &&
!event.target.className.includes("fa-times-circle-o")) { !event.target.className.includes("fa-times-circle-o")) {
document.getElementById("createdClasses").style.marginRight = "-40%"; document.getElementById("createdClasses").style.marginRight = "-40%";
} }
@ -276,7 +276,7 @@ Template.profile.events({
}, },
'click .classBox' (event) { // When you click on a box that holds class 'click .classBox' (event) { // When you click on a box that holds class
if (event.target.id === "label" || if (event.target.id === "label" ||
Session.get("profClassTab") === "manClass" || Session.equals("profClassTab","manClass") ||
event.target.className.includes("fa-times")) return; event.target.className.includes("fa-times")) return;
if (event.target.className !== "classBox") { if (event.target.className !== "classBox") {