🔒 Allows disabling of Font-Awesome (#521)

This commit is contained in:
Alicia Sykes 2022-03-02 13:26:13 +00:00
parent 1062251a15
commit f7a8395f4a
1 changed files with 6 additions and 2 deletions

View File

@ -61,6 +61,8 @@ const HomeMixin = {
},
/* Checks if any of the icons are Font Awesome glyphs */
checkIfFontAwesomeNeeded() {
if (this.appConfig.enableFontAwesome === false) return false;
if (this.appConfig.enableFontAwesome) return true;
let isNeeded = this.checkIfIconLibraryNeeded('fa-');
const currentTheme = localStorage[localStorageKeys.THEME]; // Some themes require FA
if (['material', 'material-dark'].includes(currentTheme)) isNeeded = true;
@ -68,7 +70,7 @@ const HomeMixin = {
},
/* Injects font-awesome's script tag, only if needed */
initiateFontAwesome() {
if (this.appConfig.enableFontAwesome || this.checkIfFontAwesomeNeeded()) {
if (this.checkIfFontAwesomeNeeded()) {
const fontAwesomeScript = document.createElement('script');
const faKey = this.appConfig.fontAwesomeKey || Defaults.fontAwesomeKey;
fontAwesomeScript.setAttribute('src', `${iconCdns.fa}/${faKey}.js`);
@ -77,7 +79,9 @@ const HomeMixin = {
},
/* Checks if any of the icons are Material Design Icons */
checkIfMdiNeeded() {
return this.checkIfIconLibraryNeeded('mdi-');
const userOverride = this.appConfig.enableMaterialDesignIcons;
if (userOverride === false) return false;
return userOverride || this.checkIfIconLibraryNeeded('mdi-');
},
/* Injects Material Design Icons, only if needed */
initiateMaterialDesignIcons() {