Null checking
This commit is contained in:
parent
566a477787
commit
5f97910f0f
@ -47,17 +47,20 @@ Session.set("classDispHover",null); // Stores current hovered filter.
|
||||
Session.set("commentRestrict",null); // Stores text for comment character restriction.
|
||||
|
||||
Template.registerHelper('divColor', (div) => { // Reactive color changing based on preferences. Colors stored in themeColors.
|
||||
if(Meteor.user() === null) return;
|
||||
if(Meteor.user().profile.preferences === undefined) return;
|
||||
return themeColors[Meteor.user().profile.preferences.theme][div];
|
||||
});
|
||||
|
||||
Template.registerHelper('textColor', () => { // Reactive color for text.
|
||||
if(Meteor.user() === null) return;
|
||||
if(Meteor.user().profile.preferences === undefined) return;
|
||||
document.getElementsByTagName("body")[0].style.color = themeColors[Meteor.user().profile.preferences.theme].text;
|
||||
return;
|
||||
});
|
||||
|
||||
Template.registerHelper('overlayDim', (part) => { // Gets size of the overlay container.
|
||||
if(Meteor.user() === null) return;
|
||||
var dim = [window.innerWidth * 0.25, window.innerHeight * 0.2];
|
||||
var width = "width:" + dim[0].toString() + "px;";
|
||||
var height = "height:" + dim[1].toString() + "px;";
|
||||
@ -67,6 +70,7 @@ Template.registerHelper('overlayDim', (part) => { // Gets size of the overlay co
|
||||
});
|
||||
|
||||
Template.registerHelper('myClasses', () => { // Gets all classes and respective works.
|
||||
if(Meteor.user() === null) return;
|
||||
if (Meteor.user().profile.classes === undefined || Meteor.user().profile.classes.length === 0) { // Null checking.
|
||||
Session.set("noclass",true); // Makes sure to display nothing.
|
||||
return [];
|
||||
|
||||
@ -147,9 +147,10 @@ Template.profile.helpers({
|
||||
classHolderHeight() { // Dimensions the container for the classes
|
||||
return 0.26 * window.innerHeight.toString() + "px";
|
||||
},
|
||||
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")) {
|
||||
return Session.get("themeColors")[Meteor.user().profile.preferences.theme].highlightText;
|
||||
return themeColors[Meteor.user().profile.preferences.theme].highlightText;
|
||||
} else {
|
||||
return;
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user