mirror of
https://github.com/Lissy93/dashy.git
synced 2025-07-27 07:34:43 +02:00
🔒 Allows disabling of Font-Awesome (#521)
This commit is contained in:
parent
1062251a15
commit
f7a8395f4a
@ -61,6 +61,8 @@ const HomeMixin = {
|
|||||||
},
|
},
|
||||||
/* Checks if any of the icons are Font Awesome glyphs */
|
/* Checks if any of the icons are Font Awesome glyphs */
|
||||||
checkIfFontAwesomeNeeded() {
|
checkIfFontAwesomeNeeded() {
|
||||||
|
if (this.appConfig.enableFontAwesome === false) return false;
|
||||||
|
if (this.appConfig.enableFontAwesome) return true;
|
||||||
let isNeeded = this.checkIfIconLibraryNeeded('fa-');
|
let isNeeded = this.checkIfIconLibraryNeeded('fa-');
|
||||||
const currentTheme = localStorage[localStorageKeys.THEME]; // Some themes require FA
|
const currentTheme = localStorage[localStorageKeys.THEME]; // Some themes require FA
|
||||||
if (['material', 'material-dark'].includes(currentTheme)) isNeeded = true;
|
if (['material', 'material-dark'].includes(currentTheme)) isNeeded = true;
|
||||||
@ -68,7 +70,7 @@ const HomeMixin = {
|
|||||||
},
|
},
|
||||||
/* Injects font-awesome's script tag, only if needed */
|
/* Injects font-awesome's script tag, only if needed */
|
||||||
initiateFontAwesome() {
|
initiateFontAwesome() {
|
||||||
if (this.appConfig.enableFontAwesome || this.checkIfFontAwesomeNeeded()) {
|
if (this.checkIfFontAwesomeNeeded()) {
|
||||||
const fontAwesomeScript = document.createElement('script');
|
const fontAwesomeScript = document.createElement('script');
|
||||||
const faKey = this.appConfig.fontAwesomeKey || Defaults.fontAwesomeKey;
|
const faKey = this.appConfig.fontAwesomeKey || Defaults.fontAwesomeKey;
|
||||||
fontAwesomeScript.setAttribute('src', `${iconCdns.fa}/${faKey}.js`);
|
fontAwesomeScript.setAttribute('src', `${iconCdns.fa}/${faKey}.js`);
|
||||||
@ -77,7 +79,9 @@ const HomeMixin = {
|
|||||||
},
|
},
|
||||||
/* Checks if any of the icons are Material Design Icons */
|
/* Checks if any of the icons are Material Design Icons */
|
||||||
checkIfMdiNeeded() {
|
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 */
|
/* Injects Material Design Icons, only if needed */
|
||||||
initiateMaterialDesignIcons() {
|
initiateMaterialDesignIcons() {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user