jellyfish-web/src/scripts/autoThemes.js

23 lines
697 B
JavaScript
Raw Normal View History

import * as userSettings from 'userSettings';
2020-10-25 20:20:06 +09:00
import * as webSettings from 'webSettings';
import skinManager from 'skinManager';
import events from 'events';
2020-10-25 20:20:06 +09:00
// set the default theme when loading
skinManager.setTheme(userSettings.theme());
2020-10-25 20:20:06 +09:00
// set the saved theme once a user authenticates
2020-08-30 06:06:47 +02:00
events.on(window.connectionManager, 'localusersignedin', function (e, user) {
skinManager.setTheme(userSettings.theme());
});
2020-10-25 20:20:06 +09:00
webSettings.getFonts().then(fonts => {
for (const font of fonts) {
let link = document.createElement('link');
link.setAttribute('rel', 'stylesheet');
link.href = font;
document.getElementsByTagName('head')[0].appendChild(link);
}
});