summaryrefslogtreecommitdiffstats
path: root/web
diff options
context:
space:
mode:
authorhmhealey <harrisonmhealey@gmail.com>2015-12-03 16:30:45 -0500
committerhmhealey <harrisonmhealey@gmail.com>2015-12-03 16:30:45 -0500
commitea46790fd20f01be925e4ba62317b8bb691b79bb (patch)
tree895cccc4193a496457900b783240122ebdb0ccfc /web
parentb69cc7a94a9fb69dda259b2286eeefc3d6a2ec95 (diff)
downloadchat-ea46790fd20f01be925e4ba62317b8bb691b79bb.tar.gz
chat-ea46790fd20f01be925e4ba62317b8bb691b79bb.tar.bz2
chat-ea46790fd20f01be925e4ba62317b8bb691b79bb.zip
Changed font changing code to use jquery to fix Safari weirdness
Diffstat (limited to 'web')
-rw-r--r--web/react/utils/utils.jsx22
1 files changed, 13 insertions, 9 deletions
diff --git a/web/react/utils/utils.jsx b/web/react/utils/utils.jsx
index 788d8a45c..0a52f5b37 100644
--- a/web/react/utils/utils.jsx
+++ b/web/react/utils/utils.jsx
@@ -695,15 +695,19 @@ export function applyTheme(theme) {
}
export function applyFont(fontName) {
- const body = document.querySelector('body');
- const keys = Object.getOwnPropertyNames(body.classList);
- keys.forEach((k) => {
- const className = body.classList[k];
- if (className && className.lastIndexOf('font') === 0) {
- body.classList.remove(className);
+ const body = $('body');
+
+ for (const key of Reflect.ownKeys(Constants.FONTS)) {
+ const className = Constants.FONTS[key];
+
+ if (fontName === key) {
+ if (!body.hasClass(className)) {
+ body.addClass(className);
+ }
+ } else {
+ body.removeClass(className);
}
- });
- body.classList.add(Constants.FONTS[fontName]);
+ }
}
export function changeCss(className, classValue, classRepeat) {
@@ -1238,4 +1242,4 @@ export function getPostTerm(post) {
export function isFeatureEnabled(feature) {
return PreferenceStore.getPreference(Constants.Preferences.CATEGORY_ADVANCED_SETTINGS, Constants.FeatureTogglePrefix + feature.label, {value: 'false'}).value === 'true';
-} \ No newline at end of file
+}